Previously, we shown how to setup 1602A LCD Display with Arduino. The units of 1602A LCD I received, is really of good quality. You noticed in that guide we had use huge number of wires occupying many pins of Arduino. That is not good, specially for when Arduino running with ATtiny – if one display occupies so many pins then many projects becomes difficult to make real. We can use a module/IC for I2C, which will decrease the number of pins required to connect to Arduino. In another guide, we discussed about I2C protocol. Here is How to On 1602A LCD Display I2C Serial Interface For Using With Arduino With Just Few Wires.
1602A LCD Display I2C Serial Interface (Arduino)
This tutorial uses a module which uses the PCF8574T IC chip. PCF8574 I2C chip converts I2C serial data to parallel data for the LCD display. We suggest not to solder the module with 1602A LCD Display but solder them with male headers like this photograph (jumpers came out for photography) :
In this way, you can use that PCF8574T IC module with your future or present other LCDs. These I2C modules should work fine with 4-row displays. Also, it keeps the way open to use the LCD in the way we interfaced in older guide – we can change the protocol easily.
---
You must connect the pins on the module to the correct connections on the display. Although it is simple, it may go completely reverse. Now, we only need to connect :
Connect the I2C Module to the Arduino. This is really simple and here are the connections:
SCL of module to A5 of Arduino
SDA of module to A4 of Arduino
VCC of module to +5V of Arduino
GND of module to GND of Arduino
You can adjust the small blue colored potentiometer on module for correct brightness. This is an example code :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #include <Wire.h> #include <LCD.h> #include <LiquidCrystal_I2C.h> LiquidCrystal_I2Clcd(0x27,2,1,0,4,5,6,7); void setup() { lcd.setBacklightPin(3,POSITIVE); lcd.setBacklight(HIGH); lcd.begin(16, 2); lcd.clear(); } void loop() { lcd.setCursor(0,0); lcd.print("jima.in"); lcd.setCursor(0,1); lcd.print("I2C Protocol"); delay(1000); } |
Notice this line :
1 | LiquidCrystal_I2Clcd(0x27,2,1,0,4,5,6,7); |
0x27
is the I2C bus address for an unmodified module. If your display does not work with the above code, you can change 0x27
address to 0x3F
or 0x26
. Some I2C module for 16×2 (1602A) LCD can have pathetic printing to indicate number of pin.