Interfacing ESP32 with I²C LCD Display
Share
Article by :- Samyak Badkul, Ashwini Ku. Paroha, Anchal Mishra
Introduction
Have you ever wanted your ESP32 to talk back — to actually display messages, sensor readings, or system status instead of just blinking an LED or sending data over serial?
That’s where the I²C LCD Display comes in — a simple, inexpensive, and powerful way to give your ESP32 projects a visual interface.
In this complete step-by-step guide, you’ll learn how to connect, program, and display data on a 16x2 LCD display using I²C communication with the ESP32 microcontroller.
Whether you’re working on IoT, robotics, or embedded projects — this tutorial will make your projects look smarter and more interactive.
In this Blog, you’ll learn how to interface a 16x2 I2C LCD display with ESP32, understand how I2C works, and display custom text using Arduino IDE.

What is an I²C LCD Display?
A 16x2 LCD can display 16 characters per line on 2 lines. Normally, it requires 8 data pins + 3 control pins, which can consume too many GPIOs.
To simplify connections, an I²C backpack module (PCF8574) is used. It converts the LCD’s parallel interface into a two-wire I²C interface, so we only need:
· SDA (Serial Data Line)
· SCL (Serial Clock Line)

Components Required :
|
Component |
Quantity |
Description |
|||
|
|
1 |
|
|||
|
|
1 |
|
|||
|
|
|
|
|||
|
|
1 |
|
|||
|
|
1 |
To upload code |
Connections :
|
|
|
|
|||
|
VCC |
|
Power |
|||
|
GND |
GND |
Ground |
|||
|
SDA |
21 |
|
|||
|
|
22 |
Clock line |

Schematic :
Installing Required Libraries :
To communicate with the I2C LCD, install the following library in Arduino IDE:
There are several libraries that work with the I2C LCD. We’re using this library by Marco Schwartz. Follow the next steps to install the library:
- Click here to download the LiquidCrystal_I2C library– https://codeload.github.com/johnrickman/LiquidCrystal_I2C/zip/refs/heads/master . You should have a .zip folder in your Downloads
- Unzip the .zip folder and you should get LiquidCrystal_I2C-master folder
- Rename your folder from LiquidCrystal_I2C-master to LiquidCrystal_I2C
- Move the LiquidCrystal_I2C folder to your Arduino IDE installation libraries folder
- Finally, re-open your Arduino IDE

Code’s :
● Finding Your I²C Address –
|
#include <Wire.h> void setup() { Wire.begin(21, 22); Serial.begin(9600); Serial.println("\nI2C Scanner"); } void loop() { for (byte i = 1; i< 127; i++) { Wire.beginTransmission(i); if (Wire.endTransmission() == 0) { Serial.print("I2C device found at 0x"); Serial.println(i, HEX); } } delay(2000); } |
Check your Serial Monitor. You’ll see something like:
|
“Found I2C device at address 0x27” |

Displaying Text on the LCD –
|
#include <Wire.h> #include <LiquidCrystal_I2C.h>
// I2C address 0x27 (use I2C scanner to confirm if needed) LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() { Wire.begin(21, 22); // SDA = 21, SCL = 22 (ESP32 default) lcd.init(); // Initialize the LCD lcd.backlight(); // Turn on the backlight
// Step 1: Display first message lcd.clear(); lcd.setCursor(0, 0); lcd.print("Welcome to"); lcd.setCursor(0, 1); lcd.print("Voltros.in"); delay(3000); // Wait 3 seconds
}
void loop() { // Optional: you can repeat or leave blank }
|

Wrapping Up :
In summary, in this tutorial we’ve shown you how to use an I2C LCD display with the ESP32/ESP8266 with Arduino IDE: how to display static text, scrolling text and custom characters. This tutorial also works with the Arduino board, you just need to change the pin assignment to use the Arduino I2C pins.
Watch Video tutorial - https://youtu.be/CwE4XbPczTs