A 16x2 character LCD lets a project display real information — sensor readings, status messages, menus — instead of relying on the Serial Monitor. Using one with an I2C backpack module cuts the wiring down from the standard 16 pins to just 4.
Intermediate
⌛ 30 min
🔧 What You'll Need
- Arduino Uno
- 1x 16x2 LCD with I2C backpack
- Breadboard
- 4x jumper wires
Wiring the Circuit
Connect the LCD module's VCC to 5V, GND to GND, SDA to Arduino's A4, and SCL to Arduino's A5 (on an Uno — other boards may label these pins differently). That's the entire circuit; the I2C backpack handles the rest internally.
The Code
#include
#include
// Most backpacks use address 0x27 or 0x3F -- try the other if this doesn't work
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("Purple Tech");
lcd.setCursor(0, 1);
lcd.print("Arduino Tutorial");
}
void loop() {
// Static message for this tutorial -- combine with a sensor
// reading from an earlier tutorial to display live data instead.
}
lcd.init() and lcd.backlight() set up the display and turn on its backlight. setCursor(column, row) moves the "cursor" to a specific character position — columns 0-15, rows 0-1 on a 16x2 display — and lcd.print() writes text starting from that position, just like Serial.print() but to the screen instead of your computer.
💡 Tip: If nothing appears on the display, the I2C address is the most common culprit. Run an "I2C Scanner" sketch (widely available as a standard example) first to find your module's actual address before troubleshooting anything else.
Troubleshooting
- Backlight is on but no text shows: Almost always a wrong I2C address — run an I2C scanner sketch to confirm it.
- Compile error about LiquidCrystal_I2C.h: Install the "LiquidCrystal I2C" library through the Library Manager — it's not built into the IDE by default.
- Text is garbled or flickering: Usually a loose SDA/SCL connection — reseat both wires.
With a display in the mix, a project can finally show its own status without a computer attached — combine this with the DHT11 or HC-SR04 tutorials to build a standalone sensor readout. The final tutorial in this series does exactly that kind of combination.
Menu