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 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 is a sensor for measurement of temperature and humidity. Looking inside, it consists of two parts,
i) A microcontroller
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.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.
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.
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.
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.
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,
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.
Many time it happens that we are unable to find our keys as we have misplaced it. And generally this happens when we are in great hurry. Frustrating moment......
Try to make a smart keychain for you.
Now not to worry about your keys, they will be always in touch with you. Just trigger them whenever you are unable to find them, they will automatically tell you where they are.
Smart keychain is a WiFi keychain, made using ESP8266 12E development board. ESP8266 are great modules to dive into the world of connected devices. So if you find IoT catchy and want to do some projects on this topic, than go grab your own esp8266 first.
Ok so talking about this project, In project, I have attached a buzzer with this WiFi module and a battery to power them. So in case we are unable to find our keys, we will just take out our smart phone, open an app named Telnet, and will just send data and the keychain will start ringing and with this we can easily track our keys.
Components and Programming
We will require only few components for making this project.They are,
General Purpose PCB
ESP8266 12E dev board
We have to connect the negative termincal of buzzer to D0 pin of ESP8266 12E board and positive pin to 3.3V. Here D0 pin is nothing but the Built In LED pin of ESP8266 wifi board. Ok so you are done with the connections.Now lets have a look over the code.
I have done its programming in Arduino. I have edited the example code of Telnet to Serial of ESP8266 library by Adafruit. So I have written the code in such a way that first of all it will connect to the wifi router or hotspot device whose ssid name and password we have already provided in the code. After that it will wait for the data from our smart phone. And as soon as any data is received, the buzzer will turn ON and it will start buzzing.
On your smart phone side, you need to download an app named Telnet for the communication with your keys.I have also made a video on this, so In case you didn't understand how to make it, have a look over the video.
Signal from device generated is known as base band signal which is not directly transmitted to the desired place but it is modulated before feeding the signal to transmitter. Modulation is a technique of varying any component of carrier signal in proportion to that of base band signal. In this article I have covered several Analog and Digital modulation techniques. Mentioned its basic definition with figure and the important thing, practical application of that modulation technique.So lets go into brief description and application of some of the techniques.
In the simplest way possible, AM can be explained as changing Amplitude of the carrier signal or the high frequency signal with respect to the modulating signal.
1.It is used in Aircraft for communicationbetween station to pilot and vice versa. So why didn't they opt for FM which is less affected to noise as compared to AM. The reason I found is that, AM is used so that multiple stations on the same channel can be received. While in FM, reception of weaker signal is blocked by the stronger signal which is normally known as capture effect.
2.It is still used in commercial radio broadcasting. But AM having Low frequency, they only broadcast the commentary or news or we can say only vocals will be their. As the frequency is increased, in ground wave propagation attenuation will increase. Hence FM having higher frequency will get more degraded in ground wave as compared to AM. But still use of FM is more than AM. Because it uses direct wave propagation(line of sight).
In case of frequency Modulation, the frequency of Carrier is varied with the instantaneous value of modulating signal.Advantage of FM over AM is that it has ability to reject the noise or in the other way, noise doesn't affect much in FM.
1.The most common application which I don't thing any of you is not aware of this. i.e. FM Radio broadcasting.
2.It was surprise for me also to know that, FM was used in VCR tape recorder. For storing Luminance i.e. the black and White portion of the video is recorded by FM modulation in this analog Tape while the color part is directly recorded by the base band signal. I didn't got more data in this but I came to know that it uses FM for recording.
Quadrature Amplitude Modulation
Till now we have seen that, only single parameter is changed with the instantaneous value of base band signal. But in QAM, two parameters of the signal are changed Amplitude and Phase. In short, QAM is made up of AM and PM. QAM is also known as QPSK(Quadrature Phase Shift Keying) which can be treated as mixture of ASK(Amplitude Shift Keying) and PSK(Phase Shift Keying).
QAM can be of different types depending upon the number of possibilities of Amplitude and Phase.
For Eg. I have shown two fig. in which first is 8-QAM (2 diff. Amplitude & 4 diff. Phase), and the second fig. is 16-QAM ( 4 diff. Amplitude & 4 diff Phase).
1. NTSC and PALare color encoding techniques used in analogue TV and both these encoding techniques uses QAM modulation for encoding the luminance and chrominance information combinedly, for composite video signal.
2.WCDMA(Wideband Code Division Multiple Access)commonly known as 3G connectionof our mobile phones also uses QAM. WCDMA uses 64 QAM. 64 QAM has 6 bits per symbol while our 2G connection has only 3 bit per symbol hence 3G is much faster than 2G.
Amplitude Shift Keying
Till now, the modulation techniques were used for analog signal, but now the modulation techniques we will discuss are used in digital signal modulation. First is ASK, it is very much similar to AM, in which Amplitude of the carrier is varied in proportional to the digital base band signal. As digital signal is a binary signal, so we will have only 2 different amplitude value in ASK. ASK modulation is shown below.
1.ASK Modulation is used inRF Modules. I have used this module many time for making wireless robo car. We need to attach Encoder and Decoder IC to code decode the data. And the digital data from the Encoder is modulated by ASK and than it is transmitted.
2. Some of the RF remotesand RF car keys also uses ASK modulation for transmitting digital data over air. While studying about RF car keys, I found that in some of the car keys, every time the button is pressed different data is transmitted so that one can't just simply copy and transmit the same data to unlock the car.
On Off Keying
On Off Keying(OOK) modulation technique is similar to that of ASK. Difference is that in On Off keying, binary '0' is represented by 0 volt while binary '1' is represented by some fixed amplitude. And frequency in both the cases will be same as carrier frequency.
1. This modulation technique is used only for low data transfer rate around 100 bits per second. One application of this technique which we use daily is in IR Remote Control. That remote can be of TV, AC, Radio etc. It works on 38 kHz carrier frequency.
Frequency Shift Keying
FSK can be related with FM. But this modulation technique is used on digital modulation. In this, frequency of the carrier is changed in accordance with the data bit. For digital '1' frequency will be high while for digital '0' frequency will be low. FSK modulation technique is shown in below fig.
1.Bluetooth or BLE(Bluetooth Low Energy)which normally used everywhere like in mobile phone, wireless speakers, Laptops, etc usesGFSK( Gaussian Frequency Shift Keying ) modulation technique for data transmission. Difference between GFSK and FSK is nothing but GFSK has an additional Gaussian Filter to reduce the side band power.
Phase Shift Keying
In phase shift keying, phase of the carrier is changed in accordance with the data or base band signal. For digital data '1', phase shift will be 180 degree while for digital data '0', phase shift will be 0 degree.
1. WiFihas different versions based upon different IEEE standards. Different versions have different speeds and also uses different modulation Techniques. Out of them IEEE 802.11b uses QPSK modulation and 802.11a and g uses 16 or 64 QAM modulation for transmission. Difference between this two is the speed of data transfer. Obviously, 64-QAM is faster than QPSK. 2.Enhanced version of GSM is known asEDGE ( Enhanced Data rates for GSM Evolution ) uses 8-PSK modulation technique for faster data transfer as compared to GSM. GSM uses only 1 bit per symbol for data transfer while EDGE uses 3 bits per symbol for data transfer. It is commonly called as 2.75G network
Minimum Shift Keying
MSK modulation can be compared with PSK modulation but the difference between them is, in MSK their is no abrupt change in the phase of the carrier signal, rather their is very smooth transition between different phases. It looks similar to that of FSK.
1.MSK is used with Gaussian filter ( commonly known as GMSK ) is used in GSM mobile communication or 2G network. Gaussian filter is used to reduce the side band power of the spectrum. It's data transfer rate is only 1 bit per symbol. Enhanced version of GSM was developed which is known as EDGE( Enhanced Data rates for GSM Evolution ) which uses 8-PSK modulation which uses 3 bits per symbol, faster than GSM.
2.Ships uses GMSK modulation technique for communication with other ships as well as the station. Data like speed of the ship, its current position, Estimated Arrival Time, Type of the ship etc is constantly transmitted through Time division multiplexing. This Tracking system is known as Automatic Identification System (AIS).
This much of data I got when I was researching the topic "Application of modulation techniques". If you know something more than this, do share it with others by commenting below.
We all like to come FIRST and if we easily achieve this result by mugging the stuff, than what is the use of understanding the stuff??? Statements
“Don’t go for the glory by mugging up, Go for passion and glory will follow.” says Jayraj Sagar
“People mistaken marks as knowledge/talent and that are the reason the past and coming generation both was and is practicing this.” says Parth Kalarthi
“Mugging up is nothing else than writing shit on a piece of a paper.” says Pratheesh Prasad
“Saari mark sheets samosa ki dish saaf karne k kaam aayenge, agar tumhe kuch nahi aata. (All mark sheets would be eventually used as garbage if you don’t know the things practically)” says Makwana Amit
“Sometimes in the battle of coming first, we forget that we are learning it for self development.” says Vijay Dhanwani.
What is the Problem?
In your journey of engineering, we come to learn new techniques, new methods, new technology and new theories many more such stuffs. But the problem is that, we exactly don't know that which of the technique is actually practically used and where it is used. Are we using that devices whose theory we have just studied?? Or are we studying the stuff which was never ever used practically??
Due to this lack of practical understanding I personally faced the problem of learning all the theories. I started mugging up all the contents. But soon I realized that why not try to see the actual applications of all this stuffs. So my interest took me on this way of researching and the result was I actually started loving those stuff and understanding that why particular thing is used in this device and It helped me learning new theories very quickly because I can now related the things with the device using particular technique.
In Digital Communication lecture, all guys were sitting doing their own stuff
rather than focusing on what the professor is saying. Some were acting to be
focused and very few actually are. The topic which professor was teaching was based
on Digital Modulation techniques. To be precise, he was teaching QAM (Quadrature Amplitude Modulation). This full form sounds too boring and I personally didn't pay attention to the
theory and was busy in my mind thinking another stuff. So this is the current phase
of almost all the students and classes. Lets look into another form.
In Digital Communication lecture, all guys were sitting doing their own stuff
rather than focusing on what the professor is saying. Some were acting to be
focused and very few actually are. The topic which professor was teaching was based
on Digital Modulation techniques. To be precise, he was teaching QAM (Quadrature Amplitude Modulation). But this time, before going into theory he asked one question,
Do you the modulation technique used for 3G data transfer???
Why 3G data rate is faster than 2G???
This was the technique to draw attention of the student and to excite them. And actually 3G
data transfer or 3G communication uses 64 QAM modulation technique for faster data
transfer. And I don't think now the professor has to tell the students to pay attention.
And seriously, if the students know the practical application and if they are using
that techniques, I don't think they were ever going to forget this stuff. And Mugging dies here.
As the tagline of my blog says, “If you have knowledge and
experience more than others, then share it with others.” I would post the Practical
Application of various theories on the blog. Anyone who doesn’t want to be
mainstream; anyone who wants to understand the things would be entertained for
It’s quite intricate for me, finding the practical
application of every theory but I came up with few interesting ones.As a not so famous quote says that,
So on next Sunday, I'll be posting one article based on practical application of a particular Theory. And will share all the data gathered which I think will be definitely useful to you.
So this was my thinking based on my experiences and I came to this conclusion of writing such articles. So lets see how much this remedy will cure the disease named Mugging.
There was a problem faced by one my viewer in interfacing ESP8266 wifi module with Arduino UNO. In UNO, he was using Software Serial for communication with the module. Problem was that older version of ESP8266 was having default baud rate of 115200 and Software Serial doesn't work at this high baud rate. Software Serial perfectly works at 9600 baud rate. So the Solution is that, we need to change the baud rate of our ESP8266 wifi module.
One of the solution is that we can change the Baud Rate by giving AT command,
AT+CIOBAUD= Required Baud Rate
We can change the baud rate to 9600 by just writing AT+CIOBAUD=9600. And our problem is solved. But what I found is that, in my module this command was not at all working. I don't know the reason but it may be because of older firmware may not have this command defined in it.
So first go for this step. If Your Baud Rate get changed, than no need to read this blog further. The response after entering this command will be something like this.
But If you face the similar problem which I have faced i.e. The command is not at all working on your module, than you need to go for firmware upgrading of your wifi module.
Firmware upgrading is not at all difficult. Just 2-3 steps and 2-3 minutes and you are done with it. First of all you need to download these necessary files before proceeding further.
After that, Open esp8266_flasher in that folder. And than select the bin file i.e. the firmware version you want to update, and also provide the COM port. It will be same port on which your Arduino is connected. Than click the download button.
It will take a minute while flashing your module. And after it complete its work, than you are ready to play with this module at 9600 Baud rate using Software Serial. And the good news is that, in this firmware, you can change the baud rate by the command AT+CIOBAUD to you required baud rate.
You can definitely watch my video in which I'm flashing my own module. I have made it in two Languages,
MQTT(Message Queue Telemetry Transport) is a
Client Server publish/subscribe messaging transport protocol. This protocol is
widely used in the field of IoT for communication between Machine to Machine
because of its following features ,
designed so as to be easy to implement.
Hence these features are Ideal for the IoT
purpose as we need to transmit mostly status of one machine to another.It was originally developed by IBM and is now an
open standard. Note: If you are not familiar with Node MCU module, I'll request you to watch my video Getting started with Node MCU before going into MQTT.
Working of MQTT Transport Protocol.
This protocol is easy to implement and also very
easy to understand. It basically comprises of one Broker and multiple clients
where clients can be treated as our smart phone, sensors, etc. and they all
communicate with the server which is known as Broker.
In this protocol, every client need to connect to
any address of the broker which is known as the topic to be subscribed in MQTT.
In single broker there can be multiple topics and clients can also subscribe to
multiple topics of the same broker.
First lets see this process in block diagram which
will be easy for you to understand.
So basically here we have one broker and 3 clients
subscribed to the topic “temperature”.
So as soon as any of the
client(Temperature Sensor) publishes or updates the value of Temperature to the
broker, than all the clients(Smart Phone) subscribed to that topic will receive
the value of temperature updated.
We can do a lot with this simple protocol. We can
even subscribe to the topics of any other person if we know the username and
password of the broker.
We will be making a project on "Controlling Home Appliances through Internet via MQTT". I will be demonstrating this by controlling Radio and Light of my room.
Things required for making this:
ESP8266 12e development Board
6V Relay x2
BC547 Transistor x2
330 ohm Resistor x2
First of all we will need a MQTT broker. There are many broker for MQTT but I have used Adafruit MQTT broker. Its quite simple and its UI is also great. You will love to use that broker. For using Adafruit MQTT broker, first of all you need to make an account on Adafruit.io. Fill up the basic details and you are ready to use that broker.
Than goto your dashboard. My dashboard is like this.
There many options on the right corner of the page to edit the blocks, add new blocks,get the key,etc.
Now we will start with making a new button on the dashboard. For that click on the 2nd button i.e."Create a New block". It will show this window.
There are number of blocks to be added in this window like toggle button, push button, slider etc. In our project we will be using the first block i.e. toggle button. Click on create button and you will get following options.
Than you have to provide feed name which should be unique because this feed name is nothing but the topic which clients will be subscribing. I have given name of the feed as onoff. Than click the create button. And click on the choose button front of your feed name. Than click on the next step.
Than we need to provide what string to be sent when the button is ON and OFF. So, I have wriiten 1 for ON and 0 for OFF.
That's it. You are done with the broker side. No complexity, nothing. Only simple and great UI and that's why I like adafruit broker. You can even drag and resize the block according to your need.
Account holder at Adafruit IO will have their unique key which is also called as password for the subscription. You can get your key by clicking on the third button on the right corner. It is a key shaped icon on the button.
We will be using two clients in our project first is the ESP866 12e development board and another is our Smart Phone. First of all you need to download library for MQTT client by Adafruit. You can download the library from here.
Now open example in your Arduino IDE named "mqtt_esp8266". Just change the ssid name, password for internet access and also provide your broker username and password(AIO key). And than just upload the program because in the example sketch, they have already subscribed to the topic onoff so no need to change anything in this. Than open serial monitor and your adafruit dashboard side by side.
As MQTT is very light weight, the response we can observe is around in couple of milliseconds. It's really fast!!! As you can see in the Serial monitor, whenever I toggle the switch it shows the response like "GOT 1" or "GOT 0". And side by side it is also publishing value of counter on the topic named photocell.
Another Client is our smart phone. For that you need to download an app of MQTT client. I have downloaded this app in my android device. Just provide 4 details.
Broker URL, here it is (io.adafruit.com)
Username ( username you have registered while making your account)
Password (Key which you can get by clicking the key icon on your dashboard)
After filling this details just subscribe to any of the topic and send either 0 or 1 to turn the button on or off. And yeah!!!!, now you can toggle the button from anywhere in the planet earth as long as you are in coverage area of your Internet service provider.