What is the LCD1602 I2C?
The LCD1602 I2C is a 16×2 character display with a PCF8574 I2C backpack. It shows 16 characters on each of two rows, uses the classic HD44780 controller, and needs only four wires — VCC, GND, SDA and SCL — instead of the dozen connections a bare LCD requires.
That makes it one of the most popular first displays for Arduino, ESP32, Raspberry Pi and STM32 projects: sensor readouts, menus, counters, timers and status messages all fit comfortably, and the same library scales up to the 20×4 version. It is text-only (plus up to eight custom characters), so for icons, graphs or arbitrary pixels use a graphic display such as the SSD1306 OLED instead.
How the LCD1602 I2C works
Inside the display, the HD44780 controller expects commands and character data over a parallel bus: register select (RS), read/write (RW), enable (E) and four data lines (D4–D7) when run in 4-bit mode. The PCF8574 on the backpack is an I2C I/O expander wired to those lines, plus a transistor that switches the backlight.
When your sketch calls lcd.print(), the library splits each byte into two 4-bit halves, writes them to the PCF8574 over I2C and pulses the enable line so the HD44780 latches them. You never touch the parallel bus yourself, but it explains why the display is slower than a graphic one and why you should update only the characters that change instead of clearing the whole screen every loop.
The controller keeps the text in its own display memory, so characters stay on screen without any refreshing from your code.
I2C address: 0x27 or 0x3F?
The address depends on which chip is on the backpack. A PCF8574 defaults to 0x27, while a PCF8574A defaults to 0x3F. Both can be changed with the three solder pads labelled A0, A1 and A2: bridging a pad pulls that address bit low, giving 0x20–0x27 for the PCF8574 and 0x38–0x3F for the PCF8574A. That lets you run several displays on the same I2C bus.
If you are not sure which chip you have, upload the scanner below and use the address it prints in your sketch.
Contrast and backlight
The blue trimmer on the back of the backpack sets the contrast. If you see a row of solid blocks, or a lit backlight with no text at all, turn the trimmer slowly with a small screwdriver until the characters appear. This is the most common reason an LCD1602 "doesn't work" and has nothing to do with your code.
The backlight is switched with lcd.backlight() and lcd.noBacklight(). On most backpacks a small jumper next to the header disconnects the backlight entirely if you want to save power.
Custom characters
Each character cell is a 5×8 pixel grid, and the controller lets you define up to eight of your own (slots 0–7) — hearts, degree symbols, battery icons or progress-bar segments. Define them once in setup(), then draw them with lcd.write(byte(slot)).
What you can build
- Sensor dashboards: show temperature, humidity, pressure or distance readings from DHT22, BME280 or HC-SR04 sensors.
- Menus and settings screens: pair the display with push buttons or a rotary encoder.
- Clocks, timers and counters: combine with an RTC module or
millis()for a stopwatch or countdown. - Status panels: show Wi-Fi state, IP address or error codes on an ESP32 or Raspberry Pi project.
- Scrolling messages: use
lcd.scrollDisplayLeft()to show text longer than 16 characters.
Wiring and usage best practices
- Find the address first. Run the I2C scanner instead of assuming 0x27.
- Power from 5 V and share ground. The display is dim or blank on 3.3 V, and SDA/SCL need a common ground with the microcontroller.
- Match the constructor to your display.
LiquidCrystal_I2C lcd(0x27, 16, 2);for the LCD1602,(0x27, 20, 4)for the LCD2004. - Don't clear the screen every loop.
lcd.clear()is slow and makes the text flicker. Overwrite the characters that change and pad with spaces to erase old ones. - Keep I2C wires short and make sure the header is soldered or seated firmly; loose jumpers cause garbled characters.
- Power down before rewiring so a mis-plugged VCC or GND line cannot damage the backpack.
Frequently asked questions
Do I need a library? Yes. Use LiquidCrystal I2C on Arduino-compatible boards (Arduino IDE → Library Manager). On Raspberry Pi use RPLCD. The board-specific sections below show the exact install steps.
Can I run it at 3.3 V? Some modules work, but contrast and brightness are usually poor. A 5 V supply is the reliable choice; use a level shifter if your microcontroller's I2C pins are 3.3 V only.
Can I connect more than one LCD1602 to the same I2C bus? Yes, as long as each backpack has a different address. Bridge the A0–A2 solder pads on the backpacks to change their addresses.
What is the difference between the LCD1602 and the LCD2004? Same library, wiring and I2C backpack — the LCD2004 simply has 20 columns and 4 rows. Pass (0x27, 20, 4) to the constructor.
Can it display Hindi, Unicode or images? Not directly. The controller has a fixed character ROM, and you can define at most eight custom 5×8 glyphs. For other scripts or graphics, use an OLED or TFT display.
Why is the text stuck on the first line? Call lcd.setCursor(0, 1) to move to the second row; the cursor does not wrap automatically.
Build a clock: a DS3231 RTC shares the same I2C bus (address 0x68) and keeps time to about a minute a year, even when the board is unplugged.
Specifications
- Display
- 16 characters × 2 lines, each character a 5×8-dot cell
- Controller
- HD44780-compatible, driven in 4-bit mode by the backpack
- I2C backpack
- PCF8574 or PCF8574A 8-bit I/O expander
- Supply voltage
- 5 V DC. The PCF8574 itself accepts 2.5 to 6 V, but most displays are faint or blank on 3.3 V
- Supply current
- About 25 mA with the backlight on; less with it off. Varies by module
- I2C address
- 0x20 to 0x27 (PCF8574) or 0x38 to 0x3F (PCF8574A); 0x27 and 0x3F are the usual defaults
- Address selection
- Solder pads A0, A1 and A2 on the backpack
- I2C speed
- Up to 100 kHz (standard mode)
- Backlight
- On or off by jumper or software (PCF8574 pin P3); not dimmable without modification
- Contrast
- Set with the 10 kΩ blue trimmer on the backpack
- Custom characters
- Up to 8 user-defined 5×8 glyphs
- Character set
- Built-in ROM, either A00 (Japanese katakana) or A02 (European), depending on the module
- Line addresses
- Line 1 starts at DDRAM address 0x00, line 2 at 0x40
Pinout
| Pin | Name | Description |
|---|---|---|
| 1 | GND | Ground; connect to the microcontroller ground |
| 2 | VCC | Power, 5 V DC |
| 3 | SDA | I2C data (Arduino Uno A4, Mega 20, ESP32 GPIO21) |
| 4 | SCL | I2C clock (Arduino Uno A5, Mega 21, ESP32 GPIO22) |
Wiring & code
Setting up LCD1602 I2C with Arduino Uno
Library
LiquidCrystal I2C by Frank de Brabander
Arduino IDE → Tools → Manage Libraries → search "LiquidCrystal I2C" by Frank de Brabander → Install
This example connects the LCD1602 I2C to an Arduino Uno using its hardware I2C pins (A4 = SDA, A5 = SCL) and prints two lines of text. It uses the LiquidCrystal I2C library by Frank de Brabander, and the exact sketch below is loaded in the simulator, so you can see it run before you touch any hardware.
The Uno is a 5 V board, so the display's 5 V supply and I2C pull-ups match the Uno's logic level and no level shifter is needed.
Wiring
| Component pin | Arduino Uno pin | Note |
|---|---|---|
| VCC | 5V | The Uno's 5 V pin powers the display and the backpack. |
| GND | GND | Common ground with the Uno. |
| SDA | A4 | Uno's hardware I2C data pin (also broken out next to AREF on the R3). |
| SCL | A5 | Uno's hardware I2C clock pin (also broken out next to AREF on the R3). |
- 1With the Uno unplugged from USB, wire VCC to 5V, GND to GND, SDA to A4 and SCL to A5 as shown above.
- 2In the Arduino IDE open Tools → Manage Libraries, search for "LiquidCrystal I2C" by Frank de Brabander and click Install.
- 3Optional but recommended: upload the I2C scanner from the LCD1602 I2C overview to confirm whether your backpack is at 0x27 or 0x3F.
- 4Select Tools → Board → Arduino Uno and the correct port, paste the sketch below, set the address if yours is not 0x27, and click Upload.
- 5If the backlight is lit but no text appears, turn the contrast trimmer on the back of the backpack slowly until the characters show up.
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Common PCF8574 backpacks use 0x27; some use 0x3F.
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
Wire.begin();
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("Hello, World!");
lcd.setCursor(0, 1);
lcd.print("SolderHub Sim");
}
void loop() {
// The message stays on screen.
}How the sketch works
LiquidCrystal_I2C lcd(0x27, 16, 2);creates the display object with the I2C address, the number of columns and the number of rows.Wire.begin()starts the I2C bus on A4/A5, andlcd.init()initialises the HD44780 controller.lcd.backlight()turns the backlight on.lcd.setCursor(column, row)moves the cursor. Both numbers start at 0, so(0, 1)is the start of the second line.lcd.print()writes text starting at the cursor position.
Try this circuit in the SolderHub Simulator
Run this exact circuit in your browserReady-wired, code loadedConfirm simulator behavior against the real wiring and the sensor datasheet before connecting hardware.
Expected output
The display shows Hello, World! on the first row and SolderHub Sim on the second. Because the text is written once in setup() and stays in the controller's memory, loop() can stay empty. Change the strings to anything up to 16 characters per line.
Variation: live uptime counter
This version updates the second row once a second using millis() instead of delay(), so the sketch stays free to do other work. The trailing spaces after the "s" overwrite any leftover characters.
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
unsigned long lastUpdate = 0;
unsigned long seconds = 0;
void setup() {
Wire.begin();
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("Hello, SolderHub");
}
void loop() {
if (millis() - lastUpdate >= 1000) {
lastUpdate = millis();
lcd.setCursor(0, 1);
lcd.print("Uptime: ");
lcd.print(seconds++);
lcd.print("s ");
}
}Troubleshooting on Arduino Uno
- Backlight on but no text: turn the contrast trimmer on the back of the backpack before suspecting the code.
- Nothing happens at all: run the I2C scanner and use the address it reports (0x27 or 0x3F) in the constructor.
LiquidCrystal_I2C.h: No such file or directory: install the library from the Library Manager.- Leftover characters:
lcd.print()does not clear the line first. Pad with trailing spaces or overwrite the whole line. - Garbled text: check the SDA/SCL wires on A4/A5 and keep the jumper wires short.









