People have been discussing about the true meaning of IoT (Internet of Things) and the agreed is that in order to have a fully IoT system it is necessary at least the following features:

  • having sensor(s) and actuator(s);
  • tasks´ automation;
  • Internet connectivity.

On this demo, the requirements are served so it is a true IoT system even though not fully optimized.
Items list for this demo:

  • Arduino uno;
  • A Debian distro;
  • Temperature sensor (thermistor – NTC module);
  • Raspberry pi.

topologia arduino sensor temperatura

The thermistor works as an analog input for Arduino, that sends the temperature reading every 3 seconds through a serial connection to Node-RED. The data analysis is done by Arduino native functions and a also functions from a Thermistor library. Node-RED is a GUI for IoT and it runs underneath Node.js on a Debian Linux machine.

When Node-RED is deployed it gets the sensor reading via serial communication. At this moment, the current temperature is shown in a gauge format and also like a graph. At the same time, the related reading value is sent to a comparator function node (that detects any difference greater than 2ºC) that avoid this value to be sent ahead if the temperature difference to its previous one is lower than 2ºC. It considers that the reading prior to the initial one is undefined and because of that the initial value is considered to be 2ºC+ different from its previous one. So the initial temperature reaches the comparator node and then continues its way to the next node(s). By the other hand, the following reading values do have previous well defined values to compare.
The nodes ahead of the comparator are: MySQL (running on Raspberry pi) and Notify My Android (NMA) mobile app.
In order to have an inceasing temperature kept on the sensor, it was put in contact with a glass of hot water.
When the temperature increases more than 2ºC, this value is appended to both NMA and MySQL as shown below in the video.

 

PS. On its free version, NMA can take just 5 notifications daily so that´s why in the demo the values above 27ºC were not sent to the app (at the same day I had already received 3 other notifications before the demo took time). Anyway the database had recorded all the 2ºC+ values.

 

tela nma
 

The data related to the temperature was sent from arduino to Node-RED (Linux) via usb/serial connection so because the distro had Internet connectivity it was possible to reach NMA. The main constraint in this demo is that Arduino relies on the serial connection instead of a wireless transport preventing the board´s mobility. To solve this a possible workaround could be attaching an Internet connection-oriented piece of hardware like a wi-fi Arduino Shield or an ESP microcontroller.