Introduction: Digital Thermometer Using NodeMCU and LM35
Make your own Digital Thermometer and monitor temperature over internet from anywhere.This instructable is a basic one to start tinkering with IoT. We will be interfacing temperature sensor LM35 with NodeMCU 1.0(ESP-12E).
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. NodeMCU ADC can be used to measure the analog voltage from LM35 and hence calculate the temperature which is in proportion to the analog voltage.
Step 1: Components Required
- LM35 Temperature Sensor
- NodeMCU 1.0(ESP 12-E Module)
- Connecting Wires
- Arduino IDE
Step 2: Make Connections
- Make connections as shown in the circuit diagram.
- Connect the Vcc pin of LM35 to 3V pin of NodeMCU.
- Connect the Analog pin of LM35 to A0 of NodeMCU.
- Connect the GND pin of LM35 to GND of NodeMCU.
Step 3: Conversion of Analog Value to Digital Value
- The Analog to Digital Converter (ADC) converts analog values into a digital approximation based on the formula:
ADC Value = sample * 1024 / reference voltage
- To convert analog values to Celsius we have 3.3 V on our board and we know that output voltage of LM35 varies by 10 mV to every degree Celsius rise/fall.
temp_celsius = ((analogRead(A0) * 330.0)/1024.0);
- To convert Celsius to Fahrenheit
temp_fahrenheit = (temp_celsius * 1.8)+32.0;
Step 4: Interfacing LM35 and NodeMCU
- Open Arduino IDE.
- Go to Tools -> Boards -> NodeMCU 1.0 (ESP 12-E Module).
- Copy the code. (The Code has been attached below).
- Compile it.
- Upload it to NodeMCU.
Step 5: Monitoring Temperature
- The temperature can be monitored by opening the serial monitor.
- It can monitored over net by copy pasting the IP Address shown on the serial monitor,here it is 192.168.43.163