LCD Display I2C Adapter for Arduino With PCF8574A





Introduction: LCD Display I2C Adapter for Arduino With PCF8574A

Using LCD display with arduino needs many I/O lines of your microcontroller. Never again with the I2C adapter !!!

In this tutorial I've used a PCF8574A shift register I2C interfaced. The advantages are: it's cheap and on the web is available a library written for our purposes.

Step 1: What Will You Need

Skills necessary for this tutorial are:

- basic knoweldege in electronic prototyping, including soldering

- basic programming knoweldege

The materials for this instructable are:

- 1x PCF8574A (or PCF8574)

- 1x LCD display HD44780

- straight female headers

- 1x 16 pin IC socket

- 1x BC548B npn transistor

- 1x 4.7K potentiometer

- 1x stripboard 5x7cm

Step 2: Schematic


using I2C communication protocol implies giving an address to your device. The components suitables for our project are:

PCF8574 -> address 0x20

PCF8574A - > address 0x38

I'm using the second, so you'll retrive 0x38 in the software.

These address work if PCF's address pins are shorted to ground. If you need to use another address please refer to datasheet.

Step 3: Build It !

So let's do it ! I've built it on a stripboard, but a perfoboard works fine too.

The result shud apear like the photo. Messy. Very messy.

Test it using a tester in short circuit mode (same as diode test, the tester beeps when current can flow) and the cover the back with dutch tape.

Step 4: Connections

Connect vcc to +5V, GND to ground, SDA and SCL to arduino pins (I'm using arduino uno, so A4 and A5).

If you are using other arduinos, such as Mega, find out I2C pins on this page

Step 5: Software

Download and add in your IDE the library LiquidCrystal_I2C.h from

restart the IDE and upload this test code



//create an object called lcd, with address 0x38, wich is a display with 4 lines and 20 chars per line

LiquidCrystal_I2C lcd(0x38,20,4);

void setup()




lcd.print("20x4 LCD I2C adapter");


void loop()





SMALL ISSUE: I've used a npn transistor for backlight, the library is written for a pnp transistor. This means that the command lcd.setBaclight(LOW) turns the backlight on and lcd.setBacklight(HIGH) switchs the backlight off.

It's not a big issue, and it's easy to change in header file of library. Do it if you can.

Step 6: Done !

Congratulations, you're done !

Now you can interface your display via I2C with 127 other devices using only 2 wires

Hope you liked it


2 People Made This Project!


  • Make it Move Contest

    Make it Move Contest
  • Oil Contest

    Oil Contest
  • Woodworking Contest

    Woodworking Contest

We have a be nice policy.
Please be positive and constructive.




Hi there,

does this lib work for 16x2 lcd? I have a pcf 8574 AT with a hex address 0x38. But when i print on lcd it doesnt budge beyond first letter.


in your simulation Proteus, you use PCF8574T. i have NXP PCF8574A and not find it on libraries Proteus. have you idea please

2 replies

The only thing that matters is the address. For PCF8574A should still be 0x38, but check the datasheet

i find the solution - thks - my prob is solved with the same file version 7 on vers. 8 of proteus.

I am getting error, that is using PCF 8574 with LCD ,
Error 1:wire.h is not in library
Error 2:serial connection is detected

Nice job, thank you so much man !

Fix to single character problem (doesn't print more than one character as it happens with newer arduino IDE's):

Open up the LiquidCrystal_I2C.cpp in a text editor

Go to the line 229

You should find a block of code like this:

inline size_t LiquidCrystal_I2C::write(uint8_t value) {
send(value, Rs);
return 0;

Edit the line "return 0;" by replacing 0 with 1

The new code may look this this:

inline size_t LiquidCrystal_I2C::write(uint8_t value) {
send(value, Rs);
return 1;

Compile and voila!

Yes i had not visual text... i thought about the driver/address right away

See the image i added. Im sure more people will have this problem.

Adresses PNG.png

If you have a PCF8574AT IC2, Adress is 0x3F, for those who have a problem with not seeing anything. To find your number look at the black CHIP of the IC2.

PCF8574 -> address 0x20

PCF8574A - > address 0x38

PCF8574AT -> address 0x3F

Just change this code if you have the PCF8574AT

#define I2C_ADDR 0x3F

3 replies

Well, since I had another model I don't know, but what you're saying makes sense. Anyway, these infos can be retrived on the datasheet

Yes i had no screen.. but i had this before... it was a small Hygrometer project for a friend i did. But i had no visual text. So i thought about the Driver right away.. and i was right. I got this image with all addresses

Yes i had no screen.. but i had this before... it was a small Hygrometer project for a friend i did. But i had no visual text. So i thought about the Driver right away.. and i was right. I got this image with all addresses


Thanks for the explanations, although I've done everything as you said, my lcd doesn't print anything, I managed to get a '0' in a corner after a while though. Also, if I leave the 'lcd.print' line in the voidloop, I get a blinking screen.

Any ideas ?

2 replies

Can you please post the sketch you downloaded into the arduino?

Anyway, since you managed to obtain a zero written on the display means that the address of the chip is correct.
lcd.print in loop cause blinking because is in loop, which means that in every loop cycle Arduino cancel the row and rewrite it (causing blinking)

Hi, Thanks for your answer, I managed to solve the problem in the end, but I don't really know how.

Hello Gene,

sincerly I have no idea of how the library works. You can do three things:

1) contact the author of the library asking for help
2) try to modify the library on your own (is the pro's way, do you know what are you doing ?)
3) change the physical connections to match mine

if I were you, i would try the second, but depends from your programming skills. TIP: I've not seen inside the library, but PCF8574 is a shift register, if you swap MSB (most significant bit) and LSB (less significant bit) probably you're done.
Try looking for MSBFIRST or LSBFIRST in the code

If your pinout is different because you bought a commecial module as adafruit's, try to contact the producer

I have an LCD with a PCF8574. But the 8 bit port is reversed: p0=RS, p1=RW, p2=E; p4=d4, p5=d5, p6=d6, p7=d7.

How do I make the change in software to make it work?

sure I know ! U can buy for some dollars in China via ebay ... But I prefer build mine !


nice tutorial, but just in case you did not know adafruit sells them for $10 each .