Arduino – Programming the LCD 1602 with I2C Interface

Arduino – Programming the LCD 1602 with I2C Interface

Return To Arduino Projects


1602 LCD with I2C Interface
1602 LCD with I2C Interface

Identify your I2C Port Addresses

Before attempting to program and I2C device with the Nano or UNO, use this I2C device scanner to find or confirm you I2C device HEX address

LCD 1602 I2C and the UNO/nano – Wiring Connections

LCD 1602 I2C Pin UNO Header
GND             - GND
VCC             - 5V
SDA             - A4
SCL             - A5
1602 LCD with I2C Interface
1602 LCD with I2C Interface – Rear
1602 LCD with I2C Interface
1602 LCD with I2C Interface – Front

LCD 1602 I2C Address

To select the 1602 LCD for your project use:

LiquidCrystal_I2C lcd(0x27,16,2);

This is the hardware address (0x27) and the size of the LCD, Positions (16) and Lines (2)

If you need to verify the hardware address of the 1602 LCD follow this link:

Scan and Identify your Arduino I2C Port Addresses

That utility will list all I2C devices, and their hardware addresses

Sketch for Writing information to the 1602 LCD I2C

#include <LiquidCrystal_I2C.h> //library for LCD

LiquidCrystal_I2C lcd(0x27,16,2);

void setup()
{
Serial.begin(9600);
lcd.init(); //initialize driver
lcd.begin(16,2); //16 by 2 character display
lcd.backlight(); //turn on backlight
Serial.println("setup complete");
}

void loop()
{
delay(1000); //wait a sec
lcd.clear(); //clear display
lcd.setCursor(0,0); //position 0 line 0
lcd.print("Hello World");
Serial.print("Hello World");// print to serial monitor
lcd.setCursor(0,1); // position 0 line 1
lcd.print("Goodbye World");// print to serial monitor

// rotate display lines to show sketch working
delay(5000); //wait a sec
lcd.clear(); //clear display
lcd.setCursor(0,1); //position 0 line 1
lcd.print("Hello World");
Serial.print("Hello World");// print to serial monitor
lcd.setCursor(0,0); // position 0 line 0
lcd.print("Goodbye World");// print to serial monitor

Arduino – Programming the LCD 1602 with I2C Interface

Return To Arduino Projects


Loading

Leave a Reply