I2C interface for LCD

lcd_i2CThe PFC8574 and the PFC8574A are  I2C port expanders that can be uses to connect a parallel LCD to the I2C pins of the Arduino (or other microcontroller)

The PCF8574 has addresses ranging from 0x20 to 0x27 (up to eight PCF8574 devices may be used on the same I2C bus). It’s address  is 0100aaay with ‘ aaa’ being the address bits and ‘y’ being the Read(1)/Write(0) bit.
The PCF8574A has addresses ranging from 0x38 to0x3F (up to eight PCF8574A devices may be used on the same I2Cbus). 0x38=0011 1000 (all tied to ground)  and 0x3F=0011 1111 (all tied to ‘HIGH’) hand
Addressing takes place with 3 address pins that can be taken high or low and that form the bottom 3 bits of a 7 bit address register (the 8th bit, the least significant bit is the R/W bit).
PCF8574: 0100A2A1AScreenshot from 2014-01-14 15:57:350  0100000 =0x20; 0100111=0x27
PCF8574A: 0111A2A1A0 0111000 =0x38; 0111111= 0x3F
The /INT pin is an open drain output that can be used to trigger events.

Library that can be used is the newLCD library by Malpartida: https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads

Can define two lcd’s

LiquidCrystal_I2C lcd1(0x20,16,2); // set the first LCD address to 0x20
LiquidCrystal_I2C lcd2(0x21,16,2); // set the second LCD address to 0x21

Initialize them in the setup-section:

lcd1.init(); // initialize the 1st lcd
lcd2.init(); // initialize the 2nd lcd

And send text:

lcd1.print("1st Hello!");
lcd2.print("2nd Hello!");

That’s all.

Though it is always fun to build something yourself. In this case it might not be worth it: consider this ready built board from DealExtreme.com. for only 1.80 euro you will have the complete board, inclusing headers that will solder right into most LCD’s. The PCF8574P as chip alone, will cost you an average of 2.10 euro


One thought on “I2C interface for LCD”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: