LM35 Interfacing with NodeMCU
Introduction
LM35 is a temperature sensor which can measure temperature in the range of -55°C to 150°C.
It is a 3-terminal device that provides analog voltage proportional to the temperature. Higher the temperature, higher is the output voltage.
The output analog voltage can be converted to digital form using ADC so that a microcontroller can process it.
For more information about LM35 and how to use it, refer the topic LM35 Temperature Sensor in the sensors and modules section.
NodeMCU ADC can be used to measure analog voltage from LM35 and so temperature which is in proportion to the analog voltage.
Interfacing Diagram
Example
Here, LM35 output is given to analog pin A0 of NodeMCU. This analog voltage is converted to its digital form and processed to get the temperature reading.
We can write codes for NodeMCU DevKit in either Lua Script or C/C++ language. We are using ESPlorer IDE for writing code in Lua scripts and Arduino IDE for writing code in C/C++.
Lua Script for LM35
ESPlorer Serial Output Window
ESPlorer Serial monitor output window for LM35 temperature measure
Arduino Sketch for LM35
Arduino Serial Output Window
Arduino Serial monitor output window for LM35 temperature measure