LCD1602 – Using a liquid crystal display LCD with Arduino via I2C


During the building of your projects for Arduino, you’ll often need to read the output data directly from a LCD display. In this article you will see how to mount a LCD display on your Arduino using the I2C communication. Finally you will see how to program it with a simple example showing how to display text on the display.

The LCD1602 – a I2C Liquid Crystal Displayer

The integration of an LCD display greatly facilitates the interactivity of the project you are developing, allowing the user to directly read some output parameters. These values can be either a simple text or numerical values read by the sensors, such as temperature or pressure, or even the number of cycles that the Arduino is performing.

However, these displays have a small problem. When they are connected to a microcontroller (such as Arduino for example), these displays require virtually many connection PINs occupying practically almost all available IO and leaving the multiprocessor few outputs for any other devices and sensors. This problem has been solved thanks to the communication on the I2C bus.

The LCD1602 display has an integrated microchip that manages this type of communication, and then all of the input and output information are limited to only two PINs (excluding power supply). I2C is a type of serial bus developed by Philips, which uses two bidirectional lines, called SDA (Serial Data Line) and SCL (Serial Clock Line). Both must be connected via pulled-up resistors. The usage voltages are standard as 5V and 3.3V.

The LCD1602 module consists of two parts. A classic standard LCD display HD44780 16×2 (16 characters on 2 lines). The backlight can be green or blue.

And a board, the LCM1602 which is mounted in the bottom of the display and manages the I2C communication, reducing all outputs to SDA and SCL, GND and VCC

The LCM1602 it can find on the market, whether sold individually or along with the LCD display, the LCD1602 (see here ) form. The whole module costs about 10 Euros. While the LCD display alone is around € 2-3 (see  here ).

Building the circuit

Before you write the code you have to build the circuit. To do this, connect the pins as follows:

Arduino UNO/ZEROLCD1602

From sketches of Fritzing, you can look at the connections to be done in a simpler way:

Writing the code

To use the I2C protocol with an LCD display and Arduino, there is a special library to be downloaded and included in the code. The name of this library is Liquid Crystal I2C. Download the library, a zip file (you can download it from here) and extract the contents in the libraries folder of the Arduino IDE. You can do directly from the Arduino IDE, select  Sketchinclude Library > Add .ZIP library from the menu.

Now, you will develop a simple Hello World program. This sketch will make a connection between Arduino and I2C LCD display and then print a text on two lines. The first line will display “I’m Arduino” and second the “Hello world!” message.

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

char row1[]="I'm Arduino";
char row2[]="Hello world!"; 
int t = 500;
// Library initialization with 16x2 size settings
LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27

void setup(){

void loop()
    for (int positionCounter1 = 0; positionCounter1 < 26; positionCounter1++){
    lcd.setCursor(15,1); // set the cursor to column 15, line 1
    for (int positionCounter = 0; positionCounter < 26; positionCounter++){

Leave a Reply