ESP8266 - LM35 Temperature Sensor LCD
This tutorial instructs you how to use ESP8266 to acquire the temperature from an LM35 sensor and display it on a 16x2 LCD I2C.
Hardware Preparation
1 | × | ESP8266 NodeMCU | |
1 | × | Micro USB Cable | |
1 | × | LCD I2C | |
1 | × | LM35 Temperature Sensor | |
1 | × | Breadboard | |
1 | × | Jumper Wires | |
1 | × | (Optional) 5V Power Adapter for ESP8266 | |
1 | × | (Optional) Screw Terminal Expansion Board for ESP8266 |
Or you can buy the following sensor kits:
1 | × | DIYables Sensor Kit (30 sensors/displays) | |
1 | × | DIYables Sensor Kit (18 sensors/displays) |
Additionally, some of these links are for products from our own brand, DIYables.
Overview of LM35 Temperature Sensor and LCD I2C
If you are not familiar with the LM35 Temperature Sensor and LCD I2C (including pinout, functionality, programming, etc.), you can find out more in the following tutorials:
- ESP8266 - LCD I2C tutorial
- ESP8266 - LM35 Temperature Sensor tutorial
Wiring Diagram
This image is created using Fritzing. Click to enlarge image
See more in ESP8266's pinout and how to supply power to the ESP8266 and other components.
ESP8266 Code - LM35 Temperature Sensor - LCD I2C
Detailed Instructions
To get started with ESP8266 on Arduino IDE, follow these steps:
- Check out the how to setup environment for ESP8266 on Arduino IDE tutorial if this is your first time using ESP8266.
- Wire the components as shown in the diagram.
- Connect the ESP8266 board to your computer using a USB cable.
- Open Arduino IDE on your computer.
- Choose the correct ESP8266 board, such as (e.g. NodeMCU 1.0 (ESP-12E Module)), and its respective COM port.
- Click to the Libraries icon on the left bar of the Arduino ID
- Search for “LiquidCrystal I2C” and locate the LiquidCrystal_I2C library by Frank de Brabander.
- Click the Install button to install the LiquidCrystal_I2C library.
- Copy the code and open it in the Arduino IDE.
- Click the Upload button to send it to the ESP8266.
- Place the sensor in hot and cold water or hold it in your hand.
- Check the LCD and Serial Monitor for the outcome.
※ NOTE THAT:
The address of the LCD may differ depending on the manufacturer. In our code, we used 0x27, which is the address specified by DIYables.