Menu Close

NodeMCU LM35 Temperature Sensro on Arduino IDE

This tutorial of Robo India explains how to take temperature from LM35 temperature sensor on NodeMCU using Arduino IDE.

1. Introduction:

An LM35 is a 3 pin temperature sensor; Operated on 4 to 20 volt. It gives output in voltage according to the temperature. 10 mili volts per degree Celsius is the output format of this sensor.

This tutorial is for NodeMCU on Arduino IDE. Please note that the same tutorial can be performed on LUA as well.

1.2 Hardware Required:

S.No.ItemQuantity
1 NodeMCU 1
2 Breadboard 1
3 LM35 Temperature Sensor 1
4 Jumper wire male to male 3

2. Building Circuit

Schematic Diagram:

Circuit Layout:

3. Programming:

Once the circuit part is done, NodeMCU is needed to be programmed. Here is the code to run this circuit on NodeMCU.

You may download this code (Arduino Sketch) from here.

const int LM_35 = A0;  
int input_val = 0;
float temp = 0;         

void setup() {
   Serial.begin(9600); 
}

void loop() {  
   input_val = analogRead(LM_35);
   temp = (5.0 * input_val * 100.0) / 1024; 
   Serial.print("Temperature is : " );                       
   Serial.println(temp);
   delay(1000);       
}

4. Output

It will show room temperature on the serial monitor. Try to change temperature around the LM35 sensor and the variation will be displayed on the serial monitor.

5. Troubleshooting

See the connections if room temperature is not being shown on serial monitor.

If you have any query please write us at support@roboindia.com

Thanks and Regards
Content Development Team 
Robo India
https://roboindia.com

Leave a Reply