Skip to content
DisplayMITv1.3.1

RPLCD

by Danilo Bargen

RPLCD is the Raspberry Pi equivalent of the Arduino LiquidCrystal_I2C library — it drives the same PCF8574-backed HD44780 character LCDs, just from Python over smbus2 instead of the Arduino I2C stack. The `CharLCD('PCF8574', address, cols=, rows=)` constructor mirrors the Arduino library's `(address, cols, rows)` pattern closely enough that porting code between the two boards is mostly a syntax change, not a redesign. One difference worth knowing: RPLCD's `cursor_pos` takes a `(row, col)` tuple, whereas the Arduino library's `setCursor(col, row)` takes the arguments in the opposite order — an easy mistake when moving code between the two.

Installation

pip (MicroPython / Raspberry Pi)

pip install RPLCD smbus2

Supported boards

Raspberry Pi

Examples

Print two lines of text

The baseline pattern behind the Raspberry Pi LCD1602/LCD2004 examples on this site.

from RPLCD.i2c import CharLCD

lcd = CharLCD('PCF8574', 0x27, cols=16, rows=2)
lcd.write_string("Hello, SolderHub")