LCD Screen with I2C Driver
LCD Screen with I2C Driver
Overview:
Projects with Arduino often begin requiring more pins than the UNO has. This is especially true if you are using an LCD screen that takes up at least 4 or more digital I/O pins. One way to solve this problem is to drive the LCD with I2C. I2C is a way to transport lots of information between two devices over a short distance with only 2 wires.
Visit this link to learn more about I2C. https://learn.sparkfun.com/tutorials/i2cisit
Parts:
1 – Arduino Uno
1 – LCD Screen
1 – LCD1602 I2C module
Assorted Wires
Wiring:
/*
*Install the “LiquidCrystal_I2C” by choosing “Sketch” -> “Include Libraries” -> “Manage Libraries” Then search for “LiquidCrystal_I2C” and select install.*

** Notice, your I2C device has a specific address associated with it. If yours is labelled 0x27, you are fine. If yours is labelled 0x3F, you need to change the 0x27 in “LiquidCrystal_I2C lcd(0x27,16,2);” to 0x3F.**
Code:
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2); // set the LCD address to 0x27 for a 16 chars and 2 line display
void setup()
{
lcd.init(); // initialize the lcd
// Print a message to the LCD.
lcd.backlight();
lcd.print("Hello, world!");
}
void loop()
{
}
Useful Library Functions:
init()
Initializes the display.
clear()
Clears the screen and puts the cursor at 0,0
print(value)
Print a value decimal, or string, uses inherited print command so things like print(i, DEC) or print(i, BIN) work
home()
Home the cursor to 0,0 and leave displayed characters
setCursor(row,col)
Where Row 0-MAXLINEs, and Col 0-MAXCOLUMNS
cursor()
Turn the block cursor on
noCursor()
Turn the block cursor off
blink()
Turn on the blinking underline cursor
noBlink()
Turn off the blinking underline cursor
backlight()
Turns the backlight on
noBacklight()
Turns the backlight off.
Last updated
Was this helpful?