Thursday 9 June 2016

Monitoring Sensor's Data Over Internet





Once upon a time, we used to see the data of our sensor on a 16x2 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 world has changed and so we need to. Now lets 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 internet and observe it in graphical manner with the help of a great platform for our IoT projects called Thingspeak.com.

Process

Process of this project goes something like this.


So, first of all the data from DHT11 sensor will be given to Arduino Board. This board will process the data and will giving 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 in done in Arduino. For that, we are using one library by Adafruit, which you can download it form 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 of 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 in this website, then go to channel and then into my channel. In one single channel you can plot upto 8 graphs or we can say 8 fields. You need to give name of each field. As we are plotting 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, than connecting ESP8266 to the router whose host name and password we have already entered in the code. Than we will establish a TCP connection at port 80 as to communicate with Thigspeak.com. After that we will be updating the values from sensor to thingspeak.com. We will be providing 15 s delay hence we will be able to observer 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 to the videos.


Hindi


English 





#techiesms
explore | learn | share

Wednesday 1 June 2016

Testing Your Internet Speed using ESP8266 WiFi module



In this world of connected devices, all our appliances need a proper internet connection all the time. But their is always some fluctuations in the speed or connection of the internet due to some issues. Sometimes its okay but this problem of fluctuation annoys at time of payment gate way, or submitting your college fees. After filling the form, when you press enter button, the scenario is like this


so you need to fill that form again and repeat the procedure. But still this don't happens all the time but I faced this problem so I have tried to make a small solution of this.

           I will be constantly measuring my internet connection's speed so that I come to know
           that my connection is alive or not. Hence at time of pressing submit button after filling
          any form, I will check the status of my internet speed and if the speed is great at that time
          I will submit my form so that I need not to repeat the same procedure again.


Now lets see how can we make a internet speed-o-meter using ESP8266. ESP8266 a great great great module to start with IoT. Cheapest Smallest yet fastest module and again easy to be used. In the era of Internet Of Things, demand of this module has increased a lot. With this, number of projects has also increased using this module. We can do almost anything we can think of using this WiFi module. So I have also made one simple yet useful project using this module along with my Arduino MEGA board.

With the help of only single AT command, you can get your internet speed. Hence this project is really easy to make. The speed you will get is nothing but the response time in milliseconds taken by you internet connection. After that, we can manipulate or map the data into different categorizes like Fast , Normal , Slow.

First I will explain you this concept on your laptop only and than we will implement this logic on our ESP8266 board. On you windows PC, open Command Prompt. Or simply press Windows button and type CMD.

After opening that window just type following statement, and press the enter button

ping -t www.google.com

Result of this will be as follows,


So we are just pinging the server of Google and observing the response time in milliseconds. That's what we gonna do in our project, just pinging the server and mapping this time into suitable speed of our connection. Now lets move towards the hardware part.


Connections

Connection of this module is with Arduino MEGA board is shown below,




This is simple connection in which I have connected ESP8266 WiFi  Rx Tx pins to Serial 1 of my MEGA Board. If you have UNO board, you can go for Software Serial connections.An d I have connected 3 LEDs for indicating status of our internet speed. So this is all on the hardware side, now lets movie towards the code.



Code

As we know that we need to just ping google.com continuosly as to monitor its speed. Their is an AT command for pinging whose syntax is,

AT+PING="www.google.com" 

This command will ping google.com you can ping any other website also by just editing the name of the website in above AT command. So we will just send this AT command through our WiFi module and in response we will get the time in milliseconds which we will be converting into speed by simple calculations.

I have attached the link of the code below, so you can definitely download it from there.I have also made a video tutorial on this, so have a look if you haven't understood this yet.




I have also recorded this tutorial in Hindi so in case you are more familiar with Hindi have a look over this video.






Code :- https://github.com/techiesms/Internet-Speed-O-Meter/blob/master/Internet_Speed-o-meter.ino



#techiesms
explore | learn | share