How to connect an LCD1602 to Arduino over I2C
Four wires, address 0x27 or 0x3F and contrast.
Wiring diagram
Open in the builderStep-by-step assembly
4 steps- 4 wires in order: ground, power, buses.Click a wire on the diagram or a table row to open its step.The ← → arrow keys flip through the steps.
- Step 1: GND of the display to GND of the board
- Step 2: VCC of the display to 5V of the board5 V. The display draws up to 40 mA, the pin supplies about 400 mA.
- Step 3: SDA of the display to A4 of the boardI2C address of the display: 0x27, alternative 0x3F.
- Step 4: SCL of the display to A5 of the board
- Done: 4 wires in place.Check against the connection table below.
Connections
| Step | From | To | Color |
|---|---|---|---|
| 1 | Arduino Uno GND | LCD1602 I2C GND | black |
| 2 | Arduino Uno 5V | LCD1602 I2C VCC | red |
| 3 | Arduino Uno A4 | LCD1602 I2C SDA | I2C, green |
| 4 | Arduino Uno A5 | LCD1602 I2C SCL | I2C, green |
Power and wiring check
- The schematic check, the same as in the builder, found no errors: pin voltages match, ground is common, buses are fully connected.
- LCD1602 I2C draws up to 40 mA (about 30 typically) from the 5V pin of Arduino Uno, the pin supplies about 400 mA: USB gives 500 mA, the board takes part of it.
Current of the whole circuit and how long it runs on a battery: power budget. Where to plug what: breadboard layout.
Example code
Arduino IDE, LiquidCrystal_I2C (Frank de Brabander) 1.1.2.
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// 0x27 on a PCF8574T backpack, 0x3F on a PCF8574AT
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("Hello, olerast");
}
void loop() {
lcd.setCursor(0, 1);
lcd.print(millis() / 1000);
}
Part pinouts
Next steps for this circuit
How it is connected
The PCF8574 adapter turns the 16 pins of an LCD1602 into four: GND, VCC, SDA and SCL. On an Arduino Uno the I2C bus is on A4 (SDA) and A5 (SCL), and the same lines are brought out to the SDA and SCL pins next to AREF. Power is 5 V: at 3.3 V the characters are barely visible.
The adapter has 4.7 kΩ pull-ups to VCC, so you don't need resistors on SDA and SCL. The backlight draws 20-30 mA, the whole module up to 40 mA, and the Uno's 5V pin gives about 400 mA when powered from USB.
Common mistakes
- After uploading the sketch the screen lights up but there is no text. Turn the blue trimmer on the adapter: it is the contrast, and from the factory it is often turned all the way to one end.
- The sketch uses address 0x27, but the adapter has a PCF8574AT at 0x3F. The screen stays blank with no error. The board tester or the I2C address table will show the address.
FAQ
- Can I connect an LCD1602 I2C to an ESP32?
- You can, but the adapter's pull-ups pull SDA and SCL up to 5 V, while the ESP32 pins are rated for 3.3 V. Use a level shifter, or desolder the pull-ups and fit 4.7 kΩ to 3.3 V. The builder flags such a circuit as an error.
- Why does the screen show only rectangles?
- Rectangles in the top row mean the screen is on but has received no commands. Check the address in the sketch, the SDA and SCL wires and the lcd.init() call in setup.