Character LCD, 20x4, with I2C backpack
The 20x4 on four wires, through the same PCF8574 backpack at 0x27.
- 4 pins
- 2 settings
- In 3 projects
- In 1 lesson
The Character LCD, 20x4, with I2C backpack in brief
What it is, and every setting the properties panel gives it.
The 20x4 I2C LCD is a four-row, twenty-column HD44780 display with the same PCF8574 backpack as the smaller 16x2, so it needs only GND, VCC, SDA and SCL: A4 and A5 on an Uno, GPIO 21 and 22 on an ESP32. The backpack carries its own pull-ups and answers at 0x27 by default; the address property takes 0x3F for a PCF8574A board, and a contrast property from 0 to 1, starting at 0.75, stands in for the blue trimmer on its back. The surprise this panel is known for comes straight from the controller’s memory map, and Mokxi models it the same way: the chip only has two lines of forty characters, shown as four rows of twenty, so the rows start at 0x00, 0x40, 0x14 and 0x54, and a string that runs off the end of row 0 carries on in row 2, not row 1. The other common mistake is constructing LiquidCrystal_I2C as 16, 2, which sends setCursor to the wrong address. Busy timing and the backlight bit behave as on the 16x2. The PCF8574’s input port and interrupt pin are not modeled.
- Family
- Displays
- Pins
- 4
- address
- 39
- contrast
- 0.75
4 pins
Named as the editor names them, so a wire lands where you expect it.
- GND
- VCC
- SDA
- SCL
How to use a 20x4 I2C LCD with an Arduino
Four wires, the same as the 16x2 backpack: SDA to A4, SCL to A5, VCC to 5 V and GND to GND. Construct LiquidCrystal_I2C with the address and the real size, 20 and 4, then call init() and backlight() before printing. Most backpacks answer at 0x27 and some at 0x3F.
Place every row with setCursor(). The library knows the row starts, 0x00, 0x40, 0x14 and 0x54, but one long print does not: it runs off the end of row 0 and carries on in row 2. The project beside this shows that on a bare 20x4 next to the backpack one.
LiquidCrystal_I2C compiles on every board here, on whichever pins Wire.begin() uses on that board: GPIO 21 and 22 on an ESP32.
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 20, 4);
void setup() {
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("Four rows of twenty");
lcd.setCursor(0, 3);
lcd.print("and this is row 3");
}
void loop() {}What is true about the Character LCD, 20x4, with I2C backpack, here
In its help article’s own words: what the simulation gets right, and where it stops.
Not modeled
The same as the 16x2: nothing is read back (the busy flag, the address counter and DDRAM all read nothing), there is no 5x10 font, and bias, temperature and viewing angle do not exist. On the backpack, the PCF8574's input port and its interrupt pin are not there either.
From 20x4 character LCD, in full.
See the Character LCD, 20x4, with I2C backpack in a project
3 built-in projects use it. Each opens in the editor, already wired.
Where it turns up in a lesson
One lesson places it in its own circuit.
The boards it is shown on
This board has a built-in project with the Character LCD, 20x4, with I2C backpack in it.
Arduino libraries for the Character LCD, 20x4, with I2C backpack
Built in, so the sketch compiles with nothing to install. Each page has the calls, the wiring and an example to run.
The rest of the bench
Every one of these is drawn and simulated the same way.
Wire up the Character LCD, 20x4, with I2C backpack
Open the editor and push it into the breadboard. It is free, and it runs on your own machine.