ArduinoBeginner

How to Use an I2C LCD Display with Arduino

Learn how to connect a 16x2 LCD display to your Arduino using only 2 wires with an I2C module.

15 March 20269 min read

Introduction

Standard 16x2 LCDs require many pins. By using an I2C adapter, you can control the entire display with just two data wires (SDA and SCL).

Components Required

  • Arduino Uno
  • 16x2 LCD with I2C Adapter
  • Jumper wires

Wiring

LCD (I2C)Arduino
GNDGND
VCC5V
SDAA4
SCLA5

Install Library

Search for LiquidCrystal I2C by Frank de Brabander in the Arduino Library Manager.

The Code

#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("Hello, ScienIoT!");
}

void loop() {
  lcd.setCursor(0, 1);
  lcd.print("Uptime: ");
  lcd.print(millis() / 1000);
  lcd.print("s");
  delay(1000);
}

Tips

  • If the screen is blank, adjust the blue potentiometer on the back of the I2C module to set the contrast.
  • The default I2C address is usually 0x27 or 0x3F.
Tags:ArduinoLCDI2CDisplay