Controlling an Lcd Display (HD44780) via I2C Bus

Controlling an Lcd Display (HD44780) via I2C Bus. Learn in this tutorial how to connect your Lcd Display with Arduino using only 2 pins, to make this you will need an PCF8574A Expander. The PCF8574 extender is available in two versions, the PCF8574 and the PCF8574A. The only difference between the two is the I2C base address. The base address for the PCF8574 is 0x20 and the base address for the PCF8574A is 0x38.

hd44780_pcf8574A

Wiring

To wire your LCD screen to your Arduino via PCF8574A, connect the following pins:

  • Lcd Pin 1 (Vss) –> Arduino Ground
  • Lcd Pin 2 (Vdd) –> Arduino +5V
  • Lcd Pin 3 (Vo) –> Middle Pin of Potentiometer 10K
  • Lcd Pin 4 (Rs) –> Pcf8574 Pin 11
  • Lcd Pin 5 (Rw) –> Pcf8574 Pin 10
  • Lcd Pin 6 (E) –> Pcf8574 Pin 9
  • Lcd Pin 7-10 –> N/C
  • Lcd Pin 11 (D4) –> Pcf8574 Pin 4
  • Lcd Pin 12 (D5) –> Pcf8574 Pin 5
  • Lcd Pin 13 (D6) –> Pcf8574 Pin 6
  • Lcd Pin 14 (D7) –> Pcf8574 Pin 7
  • Lcd Pin 15 (A) –> Arduino +3.3V
  • Lcd Pin 16 (K) –> Arduino Ground
  • Don’t forget to connect and the other 2 pins of potentiometer to Ground and +5V.

To wire your PCF8574A Expander to your Arduino, connect the following pins:

  • Pin 1 (A0) –> Arduino Ground
  • Pin 2 (A1) –> Arduino Ground
  • Pin 3 (A2) –> Arduino Ground
  • Pin 4 (P0) –> Lcd Pin 11
  • Pin 5 (P1) –> Lcd Pin 12
  • Pin 6 (P2) –> Lcd Pin 13
  • Pin 7 (P3) –> Lcd Pin 14
  • Pin 8 (Vss) –> Arduino Ground
  • Pin 9 (P4) –> Lcd Pin 6
  • Pin 10 (P5) –> Lcd Pin 5
  • Pin 11 (P6) –> Lcd Pin 4
  • Pin 12-13 –> N/C
  • Pin 14 (Scl) –> Arduino Pin A5
  • Pin 15 (Sda) –> Arduino Pin A4
  • Pin 16 (Vdd) –> Arduino +5V

Recommended Software

  • none

Instructions and Code

Posted in Arduino Tutorials Tagged with: , , , , , ,
6 comments on “Controlling an Lcd Display (HD44780) via I2C Bus
  1. orestis says:

    Hey,I have a problem with that.I have an LCD display with a LCM1602 IIC V1 on it but when i upload the code( any code) I can adjust the contrast but the only thing I get is ( only in one line) these little squers.Please help.
    What is wrong?

  2. apollonios says:

    I got an error when I try to compile this example:

    lcd_I2C_example.cpp.o: In function `__static_initialization_and_destruction_0':
    d:\Downloads\arduino-1.5.2-windows\arduino-1.5.2/lcd_I2C_example.ino:4: undefined reference to `LiquidCrystal_I2C::LiquidCrystal_I2C(unsigned char, unsigned char, unsigned char)'
    lcd_I2C_example.cpp.o: In function `setup':
    d:\Downloads\arduino-1.5.2-windows\arduino-1.5.2/lcd_I2C_example.ino:8: undefined reference to `LiquidCrystal_I2C::init()'
    d:\Downloads\arduino-1.5.2-windows\arduino-1.5.2/lcd_I2C_example.ino:10: undefined reference to `LiquidCrystal_I2C::backlight()'

    I use LiquidCrystal_I2C.h 3.246 bytes and another 8.233 bytes, with the same results (this error)
    can anybody help me?

    thanks
    ing Prodromos Sabaidis, Thessaloniki, Greece

  3. Athanasios Loi says:

    I tried with this library: http://learning.grobotronics.com/download/arduino-libraries/LiquidCrystal_I2C_Library.zip
    on Arduino IDE version 1.5.5 and it worked fine.

  4. thanasisloi7 says:

    Be sure that you use expander PCF8574A else if you are using another version of PCF for example 8574T you must change the address to 0x20.
    Also check the contrast from your trimmer!

Leave a Reply

Your email address will not be published. Required fields are marked *

*