Preview build — page text is a draft awaiting human review. Code badges come from real compiles. The flasher is real but not yet hardware-tested; the Playground is still a preview.

20×4 LCD + I2C backpack

20×4 character LCD with a PCF8574 I2C backpack: pin order, 0x27 vs 0x3F, contrast trimmer, 5 V supply and level shifting for ESP32 and Pico.

I2C

Community draft — report a mistake

CategoryDisplay
InterfaceI2C
Voltage5 V
Typical price₹350

3.3 V or 5 V? The LCD needs 5 V for proper contrast, and the backpack pulls SDA/SCL up to 5 V. On ESP32 or Pico, put a BSS138 level shifter between the board and the backpack instead of wiring SDA/SCL straight to 3.3 V pins.

The 20×4 LCD is the big brother of the 16×2: four lines of twenty characters on the same HD44780 controller, which leaves room for a menu, four sensor readings or a status screen. With a PCF8574 I2C backpack it still needs only four wires.

Initialise it with LiquidCrystal_I2C lcd(0x27, 20, 4). The address depends on the backpack chip — run the I2C scanner if unsure.

It draws more backlight current than a 16×2, so power it from a proper 5 V rail, not a 3.3 V pin.

Pinout

PinWhat it does
GNDGround
VCC5 V supply (backlight draws about 30–60 mA)
SDAI2C data — pulled up to VCC on the backpack
SCLI2C clock — pulled up to VCC on the backpack

I2C address:0x270x3F

Library

LiquidCrystal I2C by Frank de Brabander
Arduino IDE → Library Manager → search the name above. Each guide lists the exact version we compile against.

Use it with

Common errors

Backlight on, but only blocks or nothing

Turn the contrast trimmer on the backpack. It is almost always wrong out of the box.

Text from line 1 continues on line 3

That’s how the HD44780 memory is laid out on 20×4 displays. Use lcd.setCursor(col, row) before each line instead of printing past 20 characters.

Scanner finds nothing

Check the GND/VCC/SDA/SCL order and run the I2C scanner. PCF8574T backpacks answer at 0x27, PCF8574AT at 0x3F.

↑↓ to move · Enter to open