Introduction
Adding a 16×2 LCD display with an I2C module to your Arduino project lets you show real-time sensor readings without a computer. The I2C backpack reduces wiring from 12 wires to just 4 — making it one of the easiest display setups available.
Components Needed
- Arduino Uno
- 16×2 LCD with I2C backpack module
- DHT11 temperature sensor (optional)
- Jumper wires
Wiring (I2C)
| I2C LCD Pin | Arduino Pin |
|---|---|
| VCC | 5V |
| GND | GND |
| SDA | A4 |
| SCL | A5 |
Install the Library
In Arduino IDE go to Sketch > Include Library > Manage Libraries. Search for LiquidCrystal I2C by Frank de Brabander and install it.
Project 1: Hello World
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
lcd.init(); lcd.backlight();
lcd.setCursor(0, 0); lcd.print("Circuit of Things");
lcd.setCursor(0, 1); lcd.print("Hello, Maker!");
}
void loop() {}
Project 2: Temperature Display with DHT11
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <DHT.h>
#define DHTPIN 2
#define DHTTYPE DHT11
LiquidCrystal_I2C lcd(0x27, 16, 2);
DHT dht(DHTPIN, DHTTYPE);
void setup() {
lcd.init(); lcd.backlight(); dht.begin();
}
void loop() {
float t = dht.readTemperature();
float h = dht.readHumidity();
lcd.clear();
lcd.setCursor(0,0); lcd.print("Temp: " + String(t,1) + " C");
lcd.setCursor(0,1); lcd.print("Hum: " + String(h,1) + " %");
delay(2000);
}
Troubleshooting
- Blank screen? Adjust the contrast potentiometer on the I2C backpack.
- Wrong I2C address? Most modules use 0x27 or 0x3F. Use an I2C scanner sketch to find yours.
Conclusion
The I2C LCD is a fantastic way to add a user-friendly display to any Arduino project with minimal wiring complexity.