Displays · Lesson
10 min read
16×2 LCD over I²C
Show text with only two signal wires.
What You Will Learn
- Wire an I²C LCD
- Position the cursor
- Avoid leftover characters
Character LCDs need many wires, but an I²C 'backpack' reduces them to four: VCC, GND, SDA (data) and SCL (clock). On the Uno, SDA is A4 and SCL is A5; on the ESP32, GPIO21 and GPIO22.
Arduino C++
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0); // column 0, row 0
lcd.print("Hello, Labs!");
}Text stays until overwritten. Print a few spaces after changing numbers ("27 C ") so old digits don't remain.
LCD thermometerarduino-uno
Most backpacks use address 0x27; some use 0x3F. An I²C scanner sketch finds the right one on real hardware.
Check Your Understanding
Test what you learned in this lesson