ESP32 - LCD
This tutorial instructs you how to use ESP32 with LCD I2C. In detail, we will learn:
- How to display text on LCD I2C using ESP32 board.
- How to display special characters on the LCD I2C using ESP32 board.
Hardware Used In This Tutorial
1 | × | ESP-WROOM-32 Dev Module | |
1 | × | USB Cable Type-C | |
1 | × | LCD I2C | |
1 | × | Breadboard | |
1 | × | Jumper Wires | |
1 | × | (Optional) DC Power Jack | |
1 | × | (Recommended) ESP32 Screw Terminal Adapter |
Or you can buy the following sensor kit:
1 | × | DIYables Sensor Kit 30 types, 69 units |
Introduction to LCD I2C 16x2
LCD I2C Pinout
LCD I2C has 4 pins:
- VCC pin: the power supply for the LCD, needs to be connected to VCC (5V).
- GND pin: connect this pin to GND (0V).
- SCL pin: I2C clock signal pin
- SDA pin: I2C data signal pin

LCD 16x2 Coordinates
LCD I2C 16x2 has 2 rows and 16 columns indexed from 0.

Wiring Diagram between LCD I2C and ESP32
The wiring diagram with power supply from USB cable

This image is created using Fritzing. Click to enlarge image
If you're unfamiliar with how to supply power to the ESP32 and other components, you can find guidance in the following tutorial: How to Power ESP32.
The wiring diagram with power supply from 5v adapter

This image is created using Fritzing. Click to enlarge image
How To Program LCD I2C using ESP32
- Include the LiquidCrystal_I2C library:
- Declare a LiquidCrystal_I2C object:
- Initialize the LCD.
- Move cursor to the desired position (column_index, row_index)
- Print a message to the LCD.
※ NOTE THAT:
The LCD I2C address can be different from each manufacturer. In the code, we used address of 0x27 that is specified by DIYables manufacturer
ESP32 Code
Quick Instructions
- If this is the first time you use ESP32, see how to setup environment for ESP32 on Arduino IDE.
- On Arduino IDE, Navigate to Tools Manage Libraries

- Type “LiquidCrystal I2C” on the search box, then look for the LiquidCrystal_I2C library by Frank de Brabander
- Click Install button to install LiquidCrystal_I2C library.

- Copy the above code and paste it to Arduino IDE.
- Compile and upload code to ESP32 board by clicking Upload button on Arduino IDE
- See the result on LCD
- Try modifying text and position
Video Tutorial
Making video is a time-consuming work. If the video tutorial is necessary for your learning, please let us know by subscribing to our YouTube channel , If the demand for video is high, we will make the video tutorial.
Do More with LCD
Custom Character
If you want to display special characters or symbols (e.g. emoticon), see how to display the special characters on LCD.
Troubleshooting on LCD I2C
If LCD does not display anything, please see LCD does not work!- Checklist