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
lcd.print("20x4 LCD I2C adapter");
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!
We have a be nice policy.
Please be positive and constructive.