

The LCD 16x2 attached I2C is a 16-column by 2-row character display module that uses I2C (Inter-Integrated Circuit) communication for simplified interfacing. This module is widely used in electronics projects to display text, numbers, and symbols. The I2C interface significantly reduces the number of pins required to connect the display to a microcontroller, making it ideal for projects with limited GPIO availability.








The LCD 16x2 with I2C interface has a 4-pin header for connection:
| Pin | Name | Description |
|---|---|---|
| 1 | VCC | Power supply (5V DC) |
| 2 | GND | Ground |
| 3 | SDA | Serial Data Line for I2C communication |
| 4 | SCL | Serial Clock Line for I2C communication |
Connect the Pins:
VCC pin to the 5V pin of your microcontroller.GND pin to the ground (GND) of your microcontroller.SDA pin to the I2C data line (e.g., A4 on Arduino UNO).SCL pin to the I2C clock line (e.g., A5 on Arduino UNO).Install Required Libraries:
LiquidCrystal_I2C library for Arduino. Install it via the Arduino IDE Library Manager:LiquidCrystal_I2C and install the library by Frank de Brabander.Write and Upload Code:
#include <Wire.h> // Include the Wire library for I2C communication
#include <LiquidCrystal_I2C.h> // Include the LiquidCrystal_I2C library
// Initialize the LCD with I2C address 0x27 and 16x2 dimensions
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
lcd.begin(); // Initialize the LCD
lcd.backlight(); // Turn on the backlight
lcd.setCursor(0, 0); // Set cursor to the first column, first row
lcd.print("Hello, World!"); // Print text on the first row
lcd.setCursor(0, 1); // Set cursor to the first column, second row
lcd.print("I2C LCD Test"); // Print text on the second row
}
void loop() {
// No actions in the loop for this example
}
lcd.backlight() and lcd.noBacklight() functions to control the backlight programmatically.Display Not Turning On:
Text Not Displaying:
Flickering or Unstable Display:
Unknown I2C Address:
#include <Wire.h>
void setup() {
Wire.begin();
Serial.begin(9600);
Serial.println("Scanning for I2C devices...");
for (byte address = 1; address < 127; address++) {
Wire.beginTransmission(address);
if (Wire.endTransmission() == 0) {
Serial.print("I2C device found at address 0x");
Serial.println(address, HEX);
}
}
}
void loop() {
// No actions in the loop
}
Can I use this module with 3.3V microcontrollers?
How do I display custom characters?
createChar() function in the LiquidCrystal_I2C library to define and display custom characters.What is the maximum cable length for I2C?
By following this documentation, you can effectively integrate and use the LCD 16x2 attached I2C in your projects.