How to wire an I2C LCD to an Arduino Uno
To wire an I2C LCD to an Arduino Uno, connect VCC to 5V, GND to GND, SDA to pin A4 and SCL to pin A5. The Arduino Uno is a 5 V board and the backpack runs from 5 V, so its pull-ups hold SDA and SCL at the board’s own level and nothing else is needed. The sketch below uses the LiquidCrystal_I2C (LiquidCrystal_I2C.h) library. It writes the board name on the first line and counts the seconds on the second.
- 5 V logic
- Library: LiquidCrystal_I2C.h
- 4 wires
I2C LCD to Arduino Uno wiring table
Every wire in the circuit above, with the part’s pin names and the board’s own labels. The wire colors are the ones the circuit uses; on a real bench any colors work.
| I2C LCD pin | Arduino Uno pin | Wire color | Why |
|---|---|---|---|
| VCC | 5V | red | The display and its backlight run from 5 V. |
| GND | GND | blue | Common ground. |
| SDA | pin A4 | violet | I2C data. |
| SCL | pin A5 | cyan | I2C clock. |
Power and logic levels for I2C LCD and Arduino Uno
Logic level
The Arduino Uno’s pins are 5 V logic. A 5 V part can drive them directly; a part whose signal pins are limited to 3.3 V needs a level shifter.
Supply
The I2C LCD takes 5 V from 5V. That is the Arduino Uno’s 5 V rail, so the part shares the current the board can supply.
This pair
On an Uno the I2C bus is A4 (SDA) and A5 (SCL). The SDA and SCL pins beside AREF are the same two wires, so either pair works. The backpack’s own pull-ups hold both lines at 5 V, which is the Arduino Uno’s own logic level, so nothing else is needed.
Pins to leave alone
Pins 0 and 1 are the USB serial port on a real Uno, so anything wired there fights the upload and the serial monitor. Pin 13 carries the onboard LED.
The working code for the Arduino Uno
Library: LiquidCrystal_I2C (LiquidCrystal_I2C.h). This is the sketch the circuit above runs.
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// A 16 x 2 display behind a PCF8574 backpack at 0x27.
// SDA pin A4, SCL pin A5.
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
Serial.begin(9600);
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("Arduino Uno");
Serial.println("LCD ready");
}
void loop() {
lcd.setCursor(0, 1);
lcd.print("Seconds: ");
lcd.print(millis() / 1000);
lcd.print(" "); // clears the tail of a shorter number
delay(250);
}
What you should see
The first line of the display reads Arduino Uno and the second line reads Seconds: followed by a number that goes up once a second. The serial monitor, at 9600 baud, prints LCD ready once, after the display has been set up.
A blank screen with the backlight on means the contrast is too low or the address is wrong. This circuit answers at 0x27, the address most backpacks ship with.
The serial monitor prints this, recorded from the circuit above running:
LCD readyCommon mistakes wiring an I2C LCD to an Arduino Uno
The wrong address
Backpacks with the PCF8574T chip answer at 0x27; those with the PCF8574AT answer at 0x3F. The screen lights but shows nothing when the address is wrong. Run an I2C scanner, or set the part’s address property in the editor to match yours.
Contrast turned all the way down
A row of solid blocks, or nothing at all with the backlight on, is usually the blue trimmer on the backpack. Turn it until the text appears. In the simulator the part has a contrast property for the same thing.
Clearing the screen in every loop
lcd.clear() takes about 2 milliseconds and blanks the panel, so calling it every pass makes the text flicker. Overwrite the line and pad it with spaces, as the sketch does.
Build your own I2C LCD project
Open this circuit in the editor, change the wiring or the code, and keep your version in a free account.