Skip to content
Home > Components > Displays > LCD 16x2 (I2C)

LCD 16x2 (I2C)

A classic 16-column by 2-row alphanumeric LCD, simplified with an I2C backpack to require only four wires.

Component Preview

LCD 16x2 I2CI2C 16x2 LCD

This is a standard HD44780-compatible 16x2 LCD that has a PCF8574 I2C adapter pre-soldered to its back. Instead of needing 6 to 10 digital pins to drive the screen, it only requires the I2C bus (SDA/SCL).

DisplaysI2CText

Overview

By converting parallel data to serial I2C data, the backpack module dramatically reduces wiring clutter. It operates at 5V and relies on standard I2C communication to receive characters and commands from the Arduino.

Pin Reference

PinTypeDescription
GNDpowerGround. Connect to Arduino GND.
VCCpowerPower (5V). Connect to Arduino 5V.
SDAbidiI2C Data. Connect to Arduino A4 (or SDA).
SCLbidiI2C Clock. Connect to Arduino A5 (or SCL).

Configurable Attributes

AttributeTypeDefaultDescription
i2cAddressstring0x27The I2C address of the backpack. Common addresses are 0x27 or 0x3F.
colorstringblueThe backlight color in the simulator (e.g., blue or green).

Working Principle

The PCF8574 chip on the backpack receives I2C commands from the microcontroller and expands them into parallel 8-bit outputs that drive the LCD pins. The LiquidCrystal_I2C library handles all of this translation automatically.

Wiring Diagram

Wiring Diagram

Example Arduino Code

Install the LiquidCrystal I2C library via the Library Manager before running this sketch.

cpp
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);

void setup() {
  // Initialize the LCD
  lcd.init();
  
  // Turn on the backlight
  lcd.backlight();
  
  // Print a message
  lcd.setCursor(0, 0);
  lcd.print("OpenHW Studio!");
}

void loop() {
  unsigned long timeInSeconds = millis() / 1000;
  
  // Set cursor to the second row, first column
  lcd.setCursor(0, 1);
  lcd.print("Timer: ");
  lcd.print(timeInSeconds);
  lcd.print(" s   ");
  
  delay(500);
}

Simulation Notes

  • The default I2C address in the simulator is 0x27. If your code uses 0x3F and the screen remains blank, check the component properties and update the address.

Released under the MIT License.