ESP32 S3 - LCD

This tutorial shows you how to use an LCD I2C display with your ESP32 S3 board. You will learn to display text, special characters, and create interactive projects using this popular LCD module with the powerful ESP32 S3.

What you'll build:

  1. A working LCD I2C display connected to your ESP32 S3
  2. A sketch that alternates between two custom messages on screen
  3. A foundation for cursor positioning and text printing
  4. A launchpad for real-world LCD-based projects
ESP32 S3 - LCD

Hardware Preparation

1×ESP32 S3 WROOM N16R8
1×USB Cable Type-A to Type-C (for USB-A PC)
1×USB Cable Type-C to Type-C (for USB-C PC)
1×LCD I2C 16x2
1×Alternatively, LCD I2C 20x4
1×Breadboard
1×Jumper Wires
1×Optionally, DC Power Jack

Or you can buy the following kits:

1×DIYables Sensor Kit (18 sensors/displays)
Disclosure: Some of the links provided in this section are Amazon affiliate links. We may receive a commission for any purchases made through these links at no additional cost to you.
Additionally, some of these links are for products from our own brand, DIYables .

Buy Note: Alternatively, you can assemble the LCD I2C display using LCD 1602 Display and PCF8574 I2C Adapter Module.

Overview of LCD I2C 16x2

LCD I2C is a liquid crystal display module that uses the I2C communication protocol to simplify wiring and save GPIO pins on your ESP32 S3. The I2C interface reduces the connection from more than a dozen parallel wires down to just four, making it ideal for projects where pin count matters. An onboard PCF8574 I/O expander handles the translation between I2C commands and the LCD's native parallel interface, so your code remains clean and straightforward.

Key Specifications

The LCD I2C 16x2 offers a 16-column by 2-row character display with a built-in backlight for better visibility in low-light environments. It operates at a 5V power supply and communicates at the standard I2C address of 0x27 or 0x3F depending on the manufacturer. Contrast can be fine-tuned via a small potentiometer on the back of the module, and up to eight user-defined custom characters are supported alongside the standard ASCII set.

LCD I2C Pinout

The LCD I2C module exposes four pins for a straightforward connection to any I2C-capable microcontroller:

  1. VCC: Power supply pin — connect to 5V
  2. GND: Ground pin — connect to GND (0V)
  3. SCL: I2C clock signal pin for communication
  4. SDA: I2C data signal pin for communication
LCD I2C Pinout

LCD 16x2 Coordinates

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

The display uses a simple column-row coordinate system where columns run from 0 to 15 (left to right) and rows run from 0 to 1 (top to bottom). The top-left corner is position (0, 0) and the bottom-right corner is position (15, 1). Use setCursor(column, row) in your sketch to place the cursor at any position before printing text.

ESP32 S3 LCD I2C Coordinate

Wiring Diagram between LCD I2C and ESP32 S3

Connect your LCD I2C display to the ESP32 S3 using the board's I2C pins as shown below. The LCD requires 5V to operate, so you have two power options depending on how you are powering your ESP32 S3.

Safety Notes

Always make sure the power supply to the LCD is stable at 5V before powering up the circuit. When using USB power, the VBUS pin provides 5V directly from the USB host, which is usually sufficient, but some USB ports may not supply enough current — if the display flickers or shows garbled text, switch to an external 5V supply connected to the Vin pin and shared GND. Never connect the LCD's VCC pin to 3.3V as this will prevent the backlight and display from working correctly.

Wiring diagram when powering via USB:

The wiring diagram between ESP32 S3 LCD I2C

This image is created using Fritzing. Click to enlarge image

LCD I2C Pin ESP32 S3 Pin
VCC VBUS (5V)
GND GND
SCL GPIO9 (I2C Clock)
SDA GPIO8 (I2C Data)

Wiring diagram when powering via Vin pin:

The wiring diagram between ESP32 S3 LCD I2C 5V power source

This image is created using Fritzing. Click to enlarge image

LCD I2C Pin ESP32 S3 Pin
VCC External 5V Power Source
GND GND (shared with ESP32)
SCL GPIO9 (I2C Clock)
SDA GPIO8 (I2C Data)

※ NOTE THAT:

When powering the ESP32 S3 through the USB port, it is possible to power the LCD display using the VBUS pin of the ESP32 S3, eliminating the need for an external power source. However, it is important to note that this approach may not work as the power provided by the VBUS pin might be insufficient for the proper functioning of the LCD display.

How To Program LCD I2C using ESP32 S3

Programming the LCD I2C with the ESP32 S3 is straightforward thanks to the DIYables LCD I2C library, which wraps all low-level I2C communication into a clean API. The library provides methods for initializing the display, controlling the backlight, positioning the cursor, and printing text or custom characters. The steps below walk through each building block you need before assembling the full sketch.

Include the DIYables LCD I2C library:

#include <DIYables_LCD_I2C.h>

Declare a DIYables_LCD_I2C object:

DIYables_LCD_I2C lcd_i2c(0x27, 16, 2); // I2C address 0x27, 16 column and 2 rows

Initialize the LCD in setup():

lcd_i2c.init(); lcd_i2c.backlight();

Move cursor to desired position:

lcd_i2c.setCursor(column_index, row_index);

Print text to the LCD:

lcd_i2c.print("Hello ESP32!");

Clear the display:

lcd_i2c.clear();

※ 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. If your LCD doesn't work, try address 0x3F instead.

ESP32 S3 Code

The following code demonstrates a complete working example that alternates between two messages on the LCD I2C 16x2 display. It initializes the display with the backlight enabled, prints the first pair of messages for two seconds, then clears the screen and prints a second pair of messages for another two seconds before repeating the cycle. This pattern is a solid foundation for any project that needs to cycle through status screens or display dynamic data.

#include <DIYables_LCD_I2C.h> DIYables_LCD_I2C lcd_i2c(0x27, 16, 2); // I2C address 0x27, 16 column and 2 rows void setup() { lcd_i2c.init(); // Initialize the LCD I2C display lcd_i2c.backlight(); } void loop() { lcd_i2c.clear(); // clear display lcd_i2c.setCursor(0, 0); // move cursor to (0, 0) lcd_i2c.print("Hello"); // print message at (0, 0) lcd_i2c.setCursor(2, 1); // move cursor to (2, 1) lcd_i2c.print("newbiely.com"); // print message at (2, 1) delay(2000); // display the above for two seconds lcd_i2c.clear(); // clear display lcd_i2c.setCursor(3, 0); // move cursor to (3, 0) lcd_i2c.print("DIYables"); // print message at (3, 0) lcd_i2c.setCursor(0, 1); // move cursor to (0, 1) lcd_i2c.print("www.diyables.io"); // print message at (0, 1) delay(2000); // display the above for two seconds }

Detailed Instructions

  1. New to ESP32 S3? Complete our Getting Started with ESP32 S3 guide first.
  2. Open Library Manager: Click on the Library Manager icon on the left navigation bar of Arduino IDE.
  3. Search for library: Type "DIYables LCD I2C" in the search box.
  4. Install library: Look for the DIYables_LCD_I2C library by DIYables and click the Install button.
  • Search for DIYables LCD I2C created by DIYables.io and click the Install button.
Newbiely | Arduino IDE 2.3.8
──
File
Edit
Sketch
Tools
Help
ESP32S3 Dev Module
Library Manager
Type:
All
Topic:
All
DIYables LCD I2C by DIYables.io
This library is designed for HD44780-based I2C LCD displays. It provides LiquidCrystal-compatible API plus helper functions (text alignment, progress bars, predefined custom characters). Supports multiple I2C buses (Wire, Wire1, Wire2) for advanced boards like Arduino Giga, Due, and ESP32. Compatible with all Arduino-based platforms including Arduino Uno, Mega, Nano, ESP32, ESP8266, STM32, and Raspberry Pi Pico. More info
1.0.0
INSTALL
Newbiely.ino
···
1 void setup() {
Output
Serial Monitor
Ln 1, Col 1
ESP32S3 Dev Module on COM15
1
  1. Copy the code: Copy the code above and paste it into Arduino IDE.
  2. Connect your board: Plug your ESP32 S3 into your computer via USB Type-C cable.
  3. Select board and port: Choose the correct board and COM port in Arduino IDE.
  4. Upload the code: Click the Upload button to compile and upload the code to your ESP32 S3.
  5. View the results: Watch the text alternate between the two messages on your LCD screen.
  6. Experiment: Try modifying the text, cursor positions, and delay times to customize your display.
  7. Pro Tip: If the text is invisible or faint, adjust the small potentiometer on the back of the LCD module to increase contrast until the characters are clearly visible.

Do More with LCD

Custom Character

Want to display emoticons, degree symbols, or other special characters on your LCD I2C display? The LCD I2C 16x2 supports up to eight custom characters, each defined as a 5x8 pixel bitmap stored in a byte array. Custom characters are great for icons such as a temperature degree symbol, heart icon, battery level bar, or simple progress indicator. See how to display special characters on LCD for detailed instructions and ready-to-use bitmap arrays.

Application Ideas for ESP32 S3 LCD I2C Projects

The combination of the ESP32 S3's processing power and wireless connectivity with the simplicity of an LCD I2C display opens the door to a wide range of practical projects.

  1. Temperature monitor: Display real-time temperature and humidity readings from a DHT or BME sensor on the LCD screen.
  2. Real-time clock: Show current date and time fetched from an NTP server over WiFi with automatic timezone handling.
  3. Countdown timer: Build a kitchen or tutorial timer with start, pause, and reset controls via push buttons.
  4. Menu system: Create a multi-level menu for configuring project settings using button navigation and LCD feedback.
  5. WiFi status display: Show SSID, IP address, and signal strength so you always know the network connection state.
  6. Scrolling message board: Scroll long messages or announcements across the 16-column display in a loop.
  7. Smart home panel: Display the status of multiple smart home devices or sensor readings on a single compact screen.

Troubleshooting on LCD I2C

If your LCD I2C doesn't display anything, check these common issues:

  • Blank screen: Check if backlight is enabled with lcd_i2c.backlight()
  • No text visible: Adjust the contrast potentiometer on the back of LCD module
  • Nothing displays: Try I2C address 0x3F instead of 0x27 in code
  • Wiring issues: Verify SCL and SDA connections to correct GPIO pins
  • Power problems: Ensure LCD is receiving 5V (use external power if USB insufficient)
  • Library errors: Confirm DIYables_LCD_I2C library is properly installed

For a complete troubleshooting checklist, see LCD does not work! - Checklist

Video Tutorial

Watch the step-by-step video walkthrough for this ESP32 S3 project below.

Challenge Yourself

Once you have the basic LCD working, these challenges will push your skills further with progressively more complex tasks.

  1. Beginner: Create a counter that increments from 0 to 99 on the top row and resets automatically, updating once per second.
  2. Beginner: Display your name scrolling smoothly across the screen from right to left using a loop and setCursor.
  3. Intermediate: Add a DHT11 sensor and display live temperature and humidity readings on separate rows, refreshing every two seconds.
  4. Intermediate: Build a two-option menu system controlled by two push buttons, highlighting the selected option on the LCD.
  5. Advanced: Connect to WiFi and display the current time fetched from an NTP server, with automatic daylight saving adjustment.
  6. Advanced: Design a set of five custom bitmap characters and create an animated sequence that plays on the LCD in a loop.

※ OUR MESSAGES

  • As freelancers, We are AVAILABLE for HIRE. See how to outsource your project to us
  • Please feel free to share the link of this tutorial. However, Please do not use our content on any other websites. We invested a lot of effort and time to create the content, please respect our work!