ESP32: How to Interface LCD With ESP32 Microcontroller Development Board

TechMartian 'profile picture'
55K3423

Intro: ESP32: How to Interface LCD With ESP32 Microcontroller Development Board

Hello World!

In this Instructables we will be learning how to interface a 16x2 LCD with the ESP32 Microcontroller Board. There are currently no tutorials online on how to interface it, so I decided to share with you my experience and knowledge on how to connect this together!

The LCD display is one of the most versatile electronic component in the maker market so it is wise to learn how to interface it so as to apply his knowledge to many other applications that you will discover as a maker.

Let's get started!

STEP 1: BoM

* ESP32 Microcontroller Development Board

* 16x2 LCD

* A Lot of Jumper Wires

* Potentiometer

STEP 2: Connections

Follow the table below for a concise and comprehensive guide on how to connect all the pins of the LCD screen to both the potentiometer and the ESP32 micro controller development board

LCD PinPotentiometer Pin ESP32 Pin 1 and 16 1 GND2 and 1533.3V32 - Signal pin 4225
GND6237unused8unused9unused10unused115121813191421

STEP 3: Code

#include <LiquidCrystal.h>
LiquidCrystal lcd(22,23,5,18,19,21);
void setup()
{
    lcd.begin(16, 2);
    lcd.clear();
    lcd.print("How to Interface");

    // go to row 1 column 0, note that this is indexed at 0
    lcd.setCursor(0,1); 
    lcd.print ("LCD with ESP32");
}
void loop(){}

STEP 4: Contrast Control

Turn the knob of the potentiometer to change the contrast of the LCD. When you first upload the program onto the ESP32 board you may find that you're not seeing anything on the display, this is likely because the contrast is not set properly.

Turn the knob until you can see the display clearly.

14 Comments

This worked for me

Main components:
ESP32-WROOM-32D
1602A LCD Display
Potentiometer (best = 10k to 20k)
200-220 Ohm Resistor
=======================================
ESP32 Pins used

Power
5V
GND

Data
ESP32 GPIO15
ESP32 GPIO16
ESP32 GPIO17
ESP32 GPIO18
MISO - ESP32 GPIO19
MOSI - ESP32 GPIO23
=======================================
LCD Pin Connections

PIN01 -> GND
PIN02 -> 5V
PIN03 -> Signal pin of Potentiometer (usually the middle pin)
PIN04 -> ESP32 GPIO19
PIN05 -> GND
PIN06 -> ESP32 GPIO23
PIN07 -> NOT USED
PIN08 -> NOT USED
PIN09 -> NOT USED
PIN10 -> NOT USED
PIN11 -> ESP32 GPIO18
PIN12 -> ESP32 GPIO17
PIN13 -> ESP32 GPIO16
PIN14 -> ESP32 GPIO15
PIN15 -> Use 200 Ohm Resistor to 5V
PIN16 -> GND

=======================================
Potentiometer

PIN01 -> 5V
PIN02 -> LCD PIN03
PIN03 -> GND

REMEMBER IN THE ABOVE SITUATION THE RIGHT LIBRARY SETUP IN ARDUINO IS:
const int rs = 19, en = 23, d4 = 18, d5 = 17, d6 = 16, d7 = 15;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

THE ABOVE SITUATION IS GOOD WITHOUT ANY LEVEL ADAPTER (5,0 to 3,3 volts) BECAUSE IS WRITE-ONLY ( from ESP32 to LCD 1602A)
Thank you for taking the trouble to post this guide. It worked perfectly for me first time. A bonus that the library you've used only takes 4 data (plus 2 control) ports.
Muchas gracias, al parecer los pines no corresponden con las columnas Pin LCD - Pin de potenciómetro- Pin ESP32
This worked for me

Main components:
ESP32-WROOM-32D
1602A LCD Display
Potentiometer
200 Ohm Resistor
=======================================
ESP32 Pins used

Power
5V
GND

Data
ESP32 GPIO15
ESP32 GPIO16
ESP32 GPIO17
ESP32 GPIO18
MISO - ESP32 GPIO19
MOSI - ESP32 GPIO23
=======================================
LCD Pin Connections

PIN01 -> GND
PIN02 -> 5V
PIN03 -> Signal pin of Potentiometer (usually the middle pin)
PIN04 -> ESP32 GPIO19
PIN05 -> GND
PIN06 -> ESP32 GPIO23
PIN07 -> NOT USED
PIN08 -> NOT USED
PIN09 -> NOT USED
PIN10 -> NOT USED
PIN11 -> ESP32 GPIO18
PIN12 -> ESP32 GPIO17
PIN13 -> ESP32 GPIO16
PIN14 -> ESP32 GPIO15
PIN15 -> Use 200 Ohm Resistor to 5V
PIN16 -> GND

=======================================
Potentiometer

PIN01 -> 5V
PIN02 -> LCD PIN03
PIN03 -> GND
Yeah thanks for the correction. I didn't realized the formatting of the table got messed up after I uploaded it. Everything for the LCD side got shifted to the potentiometer ....
Many thanks bloodyrackham for doing these corrections. I am using the same LCD and the same microcontroller as you and this is the first time I have seen reliable & sensible information on what pins go where.
did you use level shifter ? cause the screen is 5v and the esp is 3.3v
What a shame, this would have been a great instructable except for the fact it is impossible to follow - look at the pin table, which is the only real information in this instructable and it is all over the shop - I mean what potentiometer has 13 pins? LOL.

If any one works it out please let us all in on the "trick".
I changed pin 2 to 5v and started to work
Not working !!!

I have a ESP32 DevKit 1 and I connected to LCD 1602A,
I even connected to 5V to pin 2 GND to Pin 1 of the LCD screen, and the Potentiometer connected to 5v, GND and the middle to Pin 3 of LCD.

The connections RS, EN and pin 11,12,13 and 14 were connected to. Still not working.
Hi and thank you for the guide. I got a bit confused with "2-signal" for lcd pin 3. I supposed the it would go to potentiometer and from there to esp32 gnd. Am I missing something? Thank you

Hello,

Do you use a LCD1604 5v ? I don"t see any comment about the issue 5v/3.3v. ESP32 works with 3.3v but common LCD1604 works with 5v. How do you manage that ??

Laurent.