ThingSpeak IOT Cloud with NodeMCU ESP8266- Temperature Monitoring Dashboard

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this lesson we're going to learn how we can able to send a sensor data from the node mcu so we will going to connect a temperature sensor lm35 to the node mcu and then we will send it to the things pick cloud platform now if you know thinkspeak is a very popular iot platform which can be used to send a data to the server and then you can able to show that into nice beautiful widgets or you can even store the data in the database on a thingspeak server so it's really great and it's very easy to use this video is sponsored by altium designer world's leading pcb design software company if you want to take your idea from a breadboard to an actual professional looking circuit board just like any other electronics product you must give it a try it's a free check the link in the video description to get your first hand experience and i'm sure you will enjoy working with it if you have a thinkspeak account already then you have to head over to the dashboard and dashboard will look something like this as it's shown on my screen so in the thinkspeak world they call something called channel so we have to create a channel in order to show the data or temperature data coming from the node mcu so we will click on a new channel and then it will give us some sort of form there we have to give the name to the channel now because we will be sending a temperature data we will give the name temperature monitoring and description basically it's an optional so i will say lm35 temperature sensor data whatever it's spelling is wrong but that's fine and there is something in the things peak they called field now you you can enable a multiple field if you like okay like this you can enable as many as you want but basically you need a field based on how many sensor data point that you want to send so here in this case we have only one temperature sensor connected to node mcu esp8266 so we are just interested in showing just the temperature value so we will just select or by default let's get selected the field one and then we scroll down and we will click on the save channel button now this channel will get created and as you can see there is a field one chart now look at this this is your channel name this is your unique channel id this is the author and the access is private for now it just doesn't matter whatever it is now if you look at this uh basically it show you in a private view so there's a chart of a field one now field well doesn't have any sensor value right now but if you have a real sensor value then you can able to see the temperature data into this field shows up and then you can even add more widgets and other things which maybe we will talk a little bit later all right so everything is fine so far now let's head over to the microcontroller programming part this is a temperature sensor lm35 and i'm going to place on the breadboard something like this so you can clearly see all three licks of the temperature sensor and make sure the flat surface of the temperature sensor is facing towards us means towards the camera and the extreme left pin will be vcc that's gonna connect to 3.3 volts the middle one will be uh an output of the lm35 temperature sensor that will going to connect to a0 pin because an m35 is an analog temperature sensor and the extreme right most pin this one will going to connect to the ground so let me take the jumper wire as i said extreme left pin this one will going to connect to 3.3 volt to give the power to lm35 all right then the middle pin which is an output of the temperature sensor this one will going to connect to the a0 pin and here is the a0 pin on node mcu because uh lm35 is an analog temperature sensor and then we need another jumper wire extreme right pin of the temperature sensor and that will going to connect to the ground pin on the node mcu okay so that's how we're gonna connect lm35 with nodemcu that means esp8266 now we have to open up the arduino ide so if you have the arduino ide then we have to head over to the sketch include library and we have to click on manage libraries because since we want esp8266 nodemcu to talk to the thingspic we have to install thingspic libraries so that we don't have to write a bare metal code or the http request and everything hard coded otherwise this code will be very very long so keep it simple and just search here think speak and uh probably once the search finish you can see things picked by mathwork corporation so thinkspeak is basically a product of network corporation it's a famous product you might know matlab software so we select the library and we click on install so the latest uh firmware or the latest library will get installed when we click on install button so we have to wait till this things pick library get installed for node mcu or esp8266 and now you can see it is installed so we give a little respect and we can click on the close so the library manager goes away now we have to create a fresh new uh project so uh now there's a project by default it came up so i just select all this piece of code and i already have written a code which i can just paste it here and just to save the time i will going to explain you line by line whatever it is okay so first of all before we do anything we have to save the file it's basically a good practice so click on save as select desktop and i would like to give this name as a thingspeak nodemcu esp8266 this will be usb and then save it now this program got saved now the way our node mcu talks to our thingspeak cloud platform through wi-fi right because our nodemcu has to have the wi-fi so we have to put the ssid into this code ssid is basically your wi-fi access point name so in my case it's a binary update and then we have to put the password so i'm going to put my password here all right and then with the code so you see we have one integer variable val and then we have integer variable pin which is a0 because um to pin a0 we will going to connect lm35 temperature sensor on esp8266 or the node mcu now we have this wi-fi client class so we create the client object and we call all the time this nodemcu as a client the hardware client that will talk to the thinkspeak server and then you see here you have my channel number so basically every things big channel has to have a unique channel number or channel id what you can say so we have to head over to our thingspeak dashboard and we have to click on api keys in the api keys you see there's a write api key and we have to copy this right api key that means this one right so this is the right api key so we'll copy this right api key and then we oh sorry this is a channel number by the way so we have to go to the thingspeak channel again and we have to copy this channel id so copy this channel id and then we have to replace it here so here goes our channel id and now another is right api key right so this is the right api key that i have explained you so i can copy this right api key and i will put it here so this is my write api key basically and then you see there's a serial a 9600 portrait and then delay and then you know it just connects to the internet through the wi-fi because we put the ssid and password and if you have wrote any you know arduino program then you know that we are using this val variable which is a global variable which is defined on the top and we read the pin a0 pin and then we multiply with 0.3 to 2265 to convert the lm35 temperature sensor data into degree celsius because uh when we read the analog value from the analog sensor using microcontroller we get a default adc counts and we have to convert that into degree celsius and now the reason i have to multiply with this number is because lm 35 basically operates on the voltage range 4 volt to i think 30 volts or something like that i don't exactly remember it but and the node mcu works on 3.3 volts so i just have calculated this this number and if you if you want to know how to calculate this number i put up another video where i explained about how to work with lm35 temperature sensor with arduino so you can check that video and then you can easily come up with this number it's not a very big deal and then we store the temperature sensor value into this valve variable and then we just print on a serial monitor and then we print it print it this all nonsense then wait for one second and then finally we call this function called right field now this right fill function which belongs to the thinkspeak library that just we have installed this will going to push the data into your channel because this channel number is unique this channel uh write api key will be unique for your uh things big channel that we just have created temperature monitoring and this value variable will be something that we want to push the data all right so that's how this data will gonna go into the into the cloud or the server now what i'm gonna do is i'm going to save uh the file okay save the code and then head over to the tools and uh make sure the board is properly selected so in my case it's a nodemcu 12e module because we are using esp8266 and then also make sure that you have to select the right com port but when you select the com port make sure your nodemcu is connected to uh to the laptop so just now i have connected and you see the port shows up so i select the com3 and then on the top left corner i click on upload button and that's basically how this code will get uploaded onto the nodemcu and if everything goes well then uh i mean before you make sure that everything goes well we have to open a serial monitor and then we can see the temperature sensor data shows up on our serial monitor and then we can go to a things peak channel just to confirm whether we really receive the temperature sensor data from the node mcu esp8266 to the thinkspeak cloud platform and then in a thingspeak because it supports http protocol now if you wonder like uh what this uh thinks big.header file is all about then the thingspeak.h header file basically implements the http protocol so um the way nodemcu talks to the thingspeak is by using http protocol in order to send the temperature sensor data from nodemcu to the thinkspeak server so every time when you send a piece of data from your nodemcu to the thingspeak it will send in the form of http request and then you get the response back from the things picked to the hardware that okay this communication works absolutely fine and then only you can able to see the temperature sensor data on to the things pick server so that's basically just to avoid writing the http uh request from the scratch we use this thingspeak library so that we get so you see the code is uploading right now in our lower left corner it still says uploading so we have to wait till it shows done uploading so let's be little bit patience and make sure we receive the data so now you see it says done uploading so we go to tools and click on serial monitor and if everything goes well then we can able to see the temperature data will show up as you can see i am getting a 25 degree celsius now if i go to my thinkspeak dashboard make sure we have to head over to the private view because by default this uh channel will be a private so it will not share the data will not share with everybody and then you can see you have the temperature coming up right now you might look at this both you know windows side by side and uh you might see that there is a delay between the data is coming here so basically in the things peak the free version of things pick you are limited to send your data after every 15 seconds so in the code we have given uh look at let's look at here like maybe somewhere okay i'm not sure it's just sending continuously but it sends the data every 15 seconds okay because that's the limitation that's why you don't see every second the data is coming up okay if you read the documentation and pricing and other things then you can able to see that they say like with the free account you are limited and you're bounded to send it after 15 seconds so it takes 15 seconds so that's how this code basically works now you can see the temperature is coming up now if i uh rub my sensors flat surface okay you will see slowly the temperature rise up you can see the data printing is 31 now okay it will take a 15 seconds or something like that to show the changes onto the dashboard but as i said you know you have to be little bit patience so let's just wait for new piece of data and as i start rubbing the sensor maybe you see now the temperature jumps up it's become 32 now and the temperature will gradually decrease it would not just quickly come back to just a normal thing so you see the data is coming up now so let's say if you want to show this temperature data into nice beautiful widgets okay instead of um showing into just in a chart form so you have to click on the add widget and then we have to select the widget let's say in this case it's a gauge so select the gauge click on next and then give the name to the gauge i would rather give it a temperature i'm okay with that then the field one value that we want to show because we have now lm35 temperature data in the field one and the minimum value is zero maximum i live in india and it never goes more than 50 degree celsius so i would say 50 even 50 never reaches but that's fine then you have something you can make the additional beauty so range between 0 to 30 it will show in some sort of yellow color because it's maybe something i love and then if you want you can add more colors like let's say from 30 to let's say 40 you want to show that into something like let's make it 50 because it's the end of everything it will be more colorful which maybe some people may not like it i don't know like just taking the random color so that's it so that's how range 0 to 30 will be in yellow and from 30 to 50 you can do more customization it doesn't matter even there is something called unit you can give unit anything that you like i would say degree celsius whatever you can design as you like then click on create and as you can see right now you have a nice beautiful widgets right and then you could possibly able to see the data shows up here right and if you want to share this data with somebody you know then you have to make this channel public basically and to make the channel public you have to go to uh the sharing option and in the sharing you say the channel view with everyone and that's basically how the channel will show up now in the public view you don't see uh the gate shows up here because if you want to add the gauge then let me add the gate you can you're right it's like a waste of time but i just want to quickly show you how it's done and then as we put it here celsius and then 0 to 30 i'm sorry this video will get a little bit longer but i just wanted to show you the real magic of this uh platform right and so it will be like uh the rate color as we made it for the private view and then we say create and now this this is a private uh sorry this is a public view right you can look at this it's in a public view now this uh url on the top in the browser this will be public now so if i copy this url and if i give it to my friend he can able to see my data in a real time life so let me show you so let's say if i open another browser firefox where i have not logged in to my uh thinkspeak account okay oh no it takes a time crazy i'm sorry you're going to waste your time i never used firefox by the way show let's just wait this browser to come up and now we have the browser here so now we have the browser here and i just simply uh copy everything remove it and then put the url that we copied from the thingspeak channel so this is our unique uh you know url that belongs to our channel and it's a public so when i hit enter here i can then be able to see the channel is public so globally anybody anywhere in the world look at this even i have not logged into things pick right so i still can able to uh see the data look at this right the access is public and world can able to see this channel so that's basically how you create a beautiful dashboard and url and the other things and a lot of things can be can be discussed but i think this short video will give you a decent understanding how you can able to send the temperature sensor data lm35 temperature sensor which is connected to the node mcu or esp8266 to the things big i hope you have found this video educational and entertaining if you need a premium courses everything will be explained in a nice detail to become a professional embedded software developer then i would ask you to check out the link in the description and we have a awesome great quality courses for you waiting for you to be successful in your career thank you very much and we'll see us into the next video bye bye for now take care
Info
Channel: BINARYUPDATES
Views: 41,600
Rating: undefined out of 5
Keywords: ThingSpeak, NodeMCU, ESP8266, IoT
Id: wE-ysLM5bbs
Channel Id: undefined
Length: 19min 46sec (1186 seconds)
Published: Sun Oct 31 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.