ESP8266 NodeMCU + LM35 + Blynk ( IOT Weather Station/ Digital Temp Sensor)

2,029

7

4

Introduction: ESP8266 NodeMCU + LM35 + Blynk ( IOT Weather Station/ Digital Temp Sensor)

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. )

Supplies:

Getting started...

List of items needed for this project

1. NodeMCU

2.LM35

3.jumper wires

4.Breadboard

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!

Be the First to Share

    Recommendations

    • Puzzles Speed Challenge

      Puzzles Speed Challenge
    • "Can't Touch This" Family Contest

      "Can't Touch This" Family Contest
    • CNC Contest 2020

      CNC Contest 2020

    4 Discussions

    0
    hsab96576
    hsab96576

    3 months ago

    Hi,how are you,Thank you so much for this great work,please i want your help ,if i use Ad8232(ecg sensor)with node mcu ,what is the modification on this code,and did i need all this widget,i want to display the result on superchart and idea the labeling value widget so liked it,and Thank you again

    0
    hspanwar1
    hspanwar1

    Question 3 months ago

    Hi, Greetings of the day. I am new to coding, If you can please help me with this, I want to receive temp. every 10 sec and up time to be in Minutes. What part to change in the coding.

    0
    S3KH4R
    S3KH4R

    Answer 3 months ago

    Hello! Sorry for the late reply.
    To get the temperature every 10 seconds we need to initiate timer event every 10 seconds, so we need to change timer interval to " timer.setInterval(10000L, myTimerEvent); "
    and in order to get uptime in minutes change the code to " Blynk.virtualWrite(PIN_UPTIME, millis() / (1000*60)); " we are essentially multiplying 1 second with 60 to get a value equivalent to 1 minute , and also don't forget to change the reading rate for Up time to 1 minute in the blynk application. Hope this helps!

    Capture.PNG