Skip to content

MicroPython library for commanding HD44780 LCD controller over I2C bus via PCF8574 GPIO expander

License

Notifications You must be signed in to change notification settings

derek-will/LCD-I2C

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LCD-I2C

This repository contains a MicroPython library for commanding a HD44780 Liquid Crystal Display (LCD) controller via a PCF8574T GPIO expander. A PCF8574 GPIO expander can be accessed via a I2C bus. This repository includes the library and some example code. The library was developed and tested using a Raspberry Pi Pico.

Using this library you can utilize any of the HD44780 LCD controller instructions indicated below.

Feature Chart

HD44780 Instruction Supported?
Clear Display ✔️
Return Home ✔️
Entry Mode Set ✔️
Display On/Off Control ✔️
Cursor or Display Shift ✔️
Function Set ✔️
Set CGRAM Address ✔️
Set DDRAM Address ✔️
Read Busy Flag & Address ✔️
Write Data to CG/DDRAM ✔️
Read Data from CG/DDRAM ✔️
Initializing By Instruction ✔️

In addition, turning the LCD backlight on and off is supported.

Example Project Layout

Pico connected to LCD over I2C bus via GPIO expander

Example Code Snippet

import machine
from PCF8574TonHD44780 import PCF8574TonHD44780

sda = machine.Pin(0)
scl = machine.Pin(1)
i2c = machine.I2C(0, sda=sda, scl=scl, freq=400000)

lcd = PCF8574TonHD44780(i2c, 0x27, True)
lcd.initialize_lcd()

lcd.display_off()
lcd.clear_display()
lcd.cursor_on(False)
lcd.reset_cursor_pos()
lcd.set_entry_mode(True, False)

lcd.set_cursor_pos(4, 1)
lcd.write_str('Hi World!')

Additional Information:

About

MicroPython library for commanding HD44780 LCD controller over I2C bus via PCF8574 GPIO expander

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages