PCF8574 LCD Display Driver
Overview
An LCD display driver using the PCF8574 I/O Expander module. It uses an I2C interface.

Compatible Modules
- LCD1602
- LCD1604
- LCD2002
- LCD2004
Specifications
- 5V operation typical, but also operates at 3.3V.
- Backlight enable jumper
- Contrast control potentiometer
- 0x27 I2C default address. Solder jumper selectable from 0x20 – 0x27
- 100kHz I2C clock speed
Supported GPIO
- Raspberry Pi 0~4
- Raspberry Pi 5
- BeagleBone Black/Green
- Jetson Nano
- FT232H, FT2232H, FT4232H
- MCP2221
I2C Address
The I2C address can be changed by modifying the A0, A1, A2 jumpers. (May vary by module manufacturer)

A0 | A1 | A2 | I2C Address |
---|---|---|---|
Low | Low | Low | 0x20 |
Low | Low | High | 0x21 |
Low | High | Low | 0x22 |
Low | High | High | 0x23 |
High | Low | Low | 0x24 |
High | Low | High | 0x25 |
High | High | Low | 0x26 |
High | High | High | 0x27 |
Commands
[INIT]
Enters initial configuration settings.
Item | Type | Description |
---|---|---|
Columns * | WRITE | Enter the number of columns in the display. |
Rows * | WRITE | Enter the number of rows in the display. |

[SET_CURSOR]
Moves the cursor to the specified position.
Item | Type | Description |
---|---|---|
Column | WRITE | Enter the column position. (Leftmost position is 0) |
Row | WRITE | Enter the row position. (Top position is 0) |
[PRINT]
Displays text on the display.
Item | Type | Description |
---|---|---|
Text | WRITE | Enter the text to display at the current cursor position. |
[CLEAR]
Clears all content displayed on the display and moves the cursor to HOME (top-left).
[HOME]
Moves the cursor to HOME (top-left).
[DISPLAY_ON]
Turns on the display.
[DISPLAY_OFF]
Turns off the display.
[CURSOR_ON]
Shows the cursor.
[CURSOR_OFF]
Hides the cursor.
[BLINK_ON]
Makes the cursor blink.
[BLINK_OFF]
Stops the cursor from blinking.
[SCROLL_LEFT]
Moves the displayed text one position to the left. Executing this command at regular intervals creates a left-scrolling effect.
[SCROLL_RIGHT]
Moves the displayed text one position to the right. Executing this command at regular intervals creates a right-scrolling effect.
[LEFT_TO_RIGHT]
Displays text from left to right relative to the current cursor position.
[RIGHT_TO_LEFT]
Displays text from right to left relative to the current cursor position.
[AUTO_SCROLL_ON]
Automatically scrolls left by the length of the text whenever text is displayed.
[AUTO_SCROLL_OFF]
Turns off automatic scrolling.
[BACKLIGHT_ON]
Turns on the backlight.
[BACKLIGHT_OFF]
Turns off the backlight.
[CREATE_CHAR]
Creates custom characters and loads them into positions 0-7 of the display’s internal storage (CGRAM). Up to 8 custom characters can be loaded.
Item | Type | Description |
---|---|---|
CGRAM Position | WRITE | Enter the CGRAM position to store the custom character. (0~7) |
Custom Character * | WRITE | Enter the custom character as a byte array. |
[WRITE_CHAR]
Displays a custom character at the current cursor position.
Item | Type | Description |
---|---|---|
CGRAM Position | WRITE | Enter the CGRAM position to display at the current cursor position. (0~7) |
Example
Objective
Display the current date on the first line and current time on the second line.
Parts
Part | Quantity |
---|---|
Raspberry Pi 4 * | 1 |
LCD Module | 1 |
Wiring
Connect each component to the corresponding connection as listed in each row below.
LCD Module | GPIO |
---|---|
VCC | 5V |
GND | GND |
SCL | 3 (I2C1 SCL) |
SDA | 2 (I2C1 SDA) |

Project Link