Javadoc link

hd

pca


worky

 

The HD44780 is the primary chip for a 16 character x 2  or 20 x 4 line LCD display.

 

These small displays can be found cheap online and are easy to use with a device with an I2C bus master.

You will find this on the Raspberry Pi and the Arduino Micro Controllers.

 

The display uses 7 inputs on the board to interface with the controller, but to make it I2C compatible, a PCF8574 is required.

This also gives us the ability to use the list output on the PCF8574 to control the LED backlight.

 

To help us use this dispaly, Moz4r created a service giving us a simple way to drive it from out code.

Pre-requits for this service is a device with an I2C Master and the PCF8574 service.

 

Example code (from branch develop):
#file : Hd44780.py (github)
#################################################################
# Example Code                                                  #
#################################################################
 
#################################################################
# First start your I2C Bus Master Device                        #
#################################################################
# If your using the Arduino Nano, comment out this line and
# uncomment the ArDuino Nano lines
raspi = runtime.start("raspi","RasPi")
#################################################################
# Start the Arduino Nano connected using /dev/ttyUSB0           #
#################################################################
#arduinoNano = runtime.start("arduinoNano","Arduino")
#arduinoNano.setBoardNano()
#arduinoNano.connect("/dev/ttyUSB0")
 
#################################################################
# Next start the PCF8574 service                                #
#################################################################
pcf = runtime.start("pcf","Pcf8574")
# Then attach it to the I2C Bus Master
# When attaching, we specify the Bus Master Device,
# the I2C Bus Number
# and the I2C address
pcf.setBus("1")
pcf.setAddress("0x27")
pcf.attach(raspi)
 
#pcf.attach(arduinoNano,"0","0x27")
 
#################################################################
# Next start the Hd44780 service                                #
#################################################################
lcd = runtime.start("lcd","Hd44780")
 
# Once the service has been started, we need to attach it to
# the PCF service
lcd.attach(pcf)
 
# this will initalise the display.
# not needed now unless you want to manually reset
# lcd.reset() 
 
# when we want to clear the screen call this
lcd.clear()
 
# You can turn the backlight on or off.
# True will turn it on, False will turn it off.
lcd.setBackLight(True)
 
# Filally to send text to the display
lcd.display("Hello World", 0)
Example configuration (from branch develop):
#file : Hd44780.py (github)
!!org.myrobotlab.service.config.Hd44780Config
backlight: true
controller: null
delay: null
listeners: null
peers: null
type: Hd44780