fbpx

Monitoring Sensor’s Data Over Internet

Once upon a time, we used to see the data of our sensor on a 16×2 LCD. So whenever we need to monitor the readings, we need to see on that LCD and need to stay near to it. But now the world has changed and so we need to. Now let’s see how we can monitor sensor’s reading on any internet enabled devices.

OK!!! it was too filmy.

So now in this article, we will be learning how we can upload our sensor’s data to the internet and observe it in a graphical manner with the help of a great platform for our IoT projects called Thingspeak.com.

Process

The process of this project goes something like this.

So, first of all, the data from the DHT11 sensor will be given to Arduino Board. This board will process the data and will give the signal to ESP8266 for uploading it to Thingspeak.com. This website, after receiving the data will automatically plot the graph of Data vs Time.

DHT11 Sensor

DHT11 is a sensor for measurement of temperature and humidity. Looking inside, it consists of two parts, i)  A microcontroller

ii) Sensor

This sensor acts like a capacitor whose capacitance changes along with Temperature and Humidity. This raw data is given to the inbuilt microcontroller who will process this analog data and will convert it into a 40-bit digital Serial packet of data. And that 40 bit consists of,

Hence decoding of this serial stream of data is done in Arduino. For that, we are using one library by Adafruit, which you can download it from here.

After that, you need to interface ESP8266 with Arduino in order to transfer data to Thingspeak.com

Thingspeak

Thingspeak.com is a perfect companion for you IoT projects.It provides you a platform, which you can use for different applications. As I have used it to create APIs for my project “Fetching Data from Any Website” In this project, we are creating channels in this for plotting graphs. For that first make an account on this website, then go to a channel and then into my channel. In one single channel, you can plot up to 8 graphs or we can say 8 fields. You need to give the name of each field. As we are plotting a graph of Temperature and Humidity, I have named the fields accordingly.

After that, you need to copy the API keys from the API key button on the website. We will copy Write API key as we need to write data on to the graph.

CODE

In the code, we are first reading data from the sensor, then connecting ESP8266 to the router whose hostname and password we have already entered in the code. Then we will establish a TCP connection at port 80 as to communicate with Thigspeak.com. After that, we will be updating the values from a sensor to thingspeak.com. We will be providing 15 s delay hence we will be able to observe new value on the graph every 15 s.

You can download the code from here. After that, you are ready to monitor data from your phone, laptop and any other internet-enabled device just log in to your thingspeak.com account. The graph will be something like this.

I have made tutorial videos for this project in both Hindi and English Languages. So if you still didn’t get what to do, just have a look at the videos.

HINDI

ENGLISH