Description
I2C LCD Controller module for displaying data on LCD by using only 2 micro-controller pins.
Getting started with the I2C LCD Controller Module for 1602 or 2004
In this tutorial, you will see how to connect i2c LCD display (Liquid Crystal Display) to Arduino using the i2c module. Before starting this article we will see what is i2c. I2C (I-square-C i.e IIC) means inter-integrated communication protocol. This is usually used to communicate between one master and multiple slaves. One of the best things about using I2C is we can reduce the connections (wiring). If you use normal LCD display, you need a total number of connections are 12. If you use I2C LCD display, you need only just 4 connection. By seeing the example you may know the advantage of I2C protocol. I2C protocol is also known as 2 line protocol.
Hardware required
Connecting the Hardware
1602/2004 LCD Module has a 16pin
VSS VDD V0 RS R / W E interface D0 D1 D2 D3 D4 D5 D6 D7 BLA BLK
The following are LCD Wiring Standard 1602/2004 LCD without i2C Backpack using 6pin i / 0 and Vcc Gnd (total 8pin)
Of course it is very wasteful on our Digital Pin on Arduino, to overcome this problem we need an I2C LCD that works like the Shift Register so that the interface pins can be less.
I2c LCD Backpack Module has 16pin Output that can be connected with LCD pins 1602/2004 directly (permanently soldered) and has 4pin inputs (VCC, GND, SDA, SCL) .
Following LCD 1602/2004 Wiring that already uses i2c Module to Arduino: ( ignore the potentiometer )
LCD with i2C —> Arduino Uno
GND <-> GND
VCC <-> 5V
SDA <-> SDA (A4) // Data
SCL <-> SCL (A5) // Clock
For Arduino Mega2560, Due, Leonardo / pro micro SDA & SCL pin positions are different from Arduino Uno,
Mega2560 20 (SDA), 21 (SCL)
Leonardo 2 (SDA), 3 (SCL)
Due 20 (SDA), 21 (SCL) )
Programming I2C LCD Module with Arduino
download the i2C LCD Module library here
uploading the code
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,20,4); // set the LCD address to 0x27 for a 16 chars and 2 line display
void setup()
{
lcd.init(); // initialize the lcd
lcd.init();
// Print a message to the LCD.
lcd.backlight();
lcd.setCursor(3,0);
lcd.print(“Hello, world!”);
lcd.setCursor(2,1);
lcd.print(“FARANUX LTD!”);
lcd.setCursor(0,2);
lcd.print(“Arduino LCM IIC 2004”);
lcd.setCursor(2,3);
lcd.print(“Power by FARANUX!”);
}
void loop()
{
}
NOTE: If you get stray ‘223’ in program the problem is with your “ and ” characters .Replace them with ordinary quotes “ . And you should be fine.