Hi guys! In this Instructable, we're going to learn how to interface LM35 sensor to NodeMCU and Display that temperature info over the internet on a smartphone with Blynk application.
(Also in this project we will be using SuperChart widget in the Blynk application so the data gets stored in the Blynk cloud and we get to see all the past data in a chart. In short, no sensor data is lost and you get to see a cool looking graph. )
List of items needed for this project
5.Arduino ide (with blynk libraries installed)
Step 1: Circuit Connection
LM35 has 3 pins. (When the flat face of the sensor is facing you, Let pin1 be the leftmost pin, middle pin will be pin2 and the rightmost pin will be pin3)
Pin1 is connected to 3.3v on NodeMCU.
Pin2 is connected to A0. (one and only analogue pin on NodeMCU)
Pin3 is connected to Ground on NodeMCU.
(I won't be using jumper wires as I intend to keep this connected for some time)
Step 2: Setting Up Blynk Application
1. Install the Blynk app from Playstore/ App store and login to your account.
2. Create a new project by selecting NodeMCU as the device and Wi-Fi as the connection type. (Auth token will be sent to your mail id, this will be used later in the code)
3. Click + icon and add the following widgets - Labelled value display, gauge and superchart. (resize the widgets to your liking)
4. We will be using the labelled value widget to display the uptime. ( number of seconds from the time we powerup NodeMCU) By using this we have a few advantages- we can know whether or not the Nodemcu is connected to the internet (the counter should rise by 1 every second) and this counter resets every time the power resets(so you'll get a rough idea when the power supply is not proper).we will be using virtual pin V6 for this and reading rate set to 1 second.
5. We will use the gauge widget to display temperature. let's send data to the blynk app through virtual pin V5
, the display range will be 0 to 50 degrees Celsius and reading rate set to PUSH(since we will be using superchart).
6. Now comes Superchart. We will use this to view previous temperature readings in a graph. In the widget settings add Temperature as a data stream. by clicking the settings icon next to the created data stream, select input pin as virtual pin V5.(You can modify rest of settings to your liking).
**NOTE: If you don't understand what I meant in the above steps, you can simply follow above pictures to set up the application.
Step 3: Code
I'll be attaching the required code file in this page.
Step 4: Wrapping Up...
Upload the code to NodeMCU by connecting it to your PC. press play button in the Blynk app, by now you should be receiving data to your smartphone and that's it you can unplug it from PC and connect it to some powerbank and place the whole temperature sensing apparatus wherever needed.
**NOTE: Few things to notice-
1. UPTIME: When Blynk app connects to NodeMCU over the internet, it requests uptime every second .if this counter is not going up every second, it simply means the network connection on either phone side or NodeMCU side is weak or broken(or the NodeMCU is not powered).
2. SUPERCHART: You can export your recorded sensor data as a CSV file or even delete previous data to start fresh. ( the temperature reading rate must be set to PUSH in order to use Superchart)
3. I've added notes to few pictures. (might clear some doubts)
Hope you enjoyed this instructable!