I2C LCD Display

Sooner or later an LCD display will be needed. The problem with the typical LCD is that it takes most of the I/O pins on the Arduino just to talk to it. The way around that problem is to use an I2C display. I2C only uses two lines, A4 and A5. If you can get away with only four analog inputs, you can use an I2C LCD.

What is I2C

I2C is a communication method developed by Philips to allow "Inter Integrated Circuit" communication on a two-wire bus. It has been a standard for many years, and is a popular way to talk to an LCD.

The I2C bus is not native to the Arduino nor to the LCD. The Arduino has a software library which turns one of the internal serial devices into an I2C port. The LCD needs a board, called a "backpack", which turns the I2C data into parallel data for the LCD. Both the LCD and backpack are readily available and very inexpensive.

Start by making a four-wire cable following this fairly common color code. The reason for the color code is to prevent hooking up the cable wrong and destroying the LCD. It will become second nature to hook up the LCD correctly just by memorizing which color goes where.

Before we can go any further we have to install the I2C library code. You can get a really good I2C library and install it, but you have to remove the existing LCD libraries. Arduino comes with the Adafruit LCD library installed. It can be removed by deleting or moving the "LiquidCrystal" library folder. On Windows, the LiquidCrystal folder is in the

C:\Program Files (x86)\Arduino\libraries\

folder. On a Mac the library folder is


Download the new library and then go to "Sketch->Include Library->Add .ZIP Library". Click that and tell it where the zip file you downloaded can be found. It will install the new LiquidCrystal library in your sketch path, in a "libraries" folder. Once you have done that, you can test the backpack and LCD.

The backpack must be installed on the LCD. Mount the backpack and make sure it is insulated from the LCD board. Solder the backpack to the LCD, attach the cable and test it with the following program.

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

// Most of the backpacks like the one shown are at 0x27 or at 0x3f.
#define I2C_ADDR     0x27 // <--Change to match your display

LiquidCrystal_I2C lcd(I2C_ADDR,2,1,0,4,5,6,7,3,POSITIVE);

int n = 0;

void setup ( )
  lcd.begin ( 16, 2 ); // <--Change to match your display
  lcd.print(", ARDUINO");

void loop ()
  lcd.setCursor (0,1);

You should see "Hello, ARDUINO" on the first line, and an incrementing number of the second line - regardless of the display size you use.


There are different ways to connect an LCD to a PCF8574 (the chip on the backpack) and no particular standard. If you have trouble getting the display to respond at all, run this I2C Scanner to get the address. If it responds, but acts weird, try different intialization parameters:

LiquidCrystal_I2C lcd(I2C_ADDR,2,1,0,4,5,6,7,3,POSITIVE);

LiquidCrystal_I2C lcd(I2C_ADDR,4,5,6,0,1,2,3,7,NEGATIVE);

LiquidCrystal_I2C lcd(I2C_ADDR,6,5,4,0,1,2,3,7,NEGATIVE);

The LCD backpack shown is the most commonly available at this time. Others are available, and we'll update the page as we find them.

Of the two shown above, the top one is by far the most available, but the bottom one is showing up now, too. The top one uses the first set of initialization parameters above, and the bottom one uses the second set of parameters.

The cable for the bottom LCD backpack looks like this, following the same color code convention.

Arduino Board Logo


Arduino-Board is the go-to source for information on many available Arduino and Arduino-like boards, tutorials and projects.

Help and Support


Stay updated

Sign up if you would like to receive our once monthly newsletter.