Use I2C to Control LCD Module with Arduino

(The original Chinese version of this article is written by Hsiao-Dong Huang and published on MakerPRO)

As the maker movement has increasingly grown, we’d like to share the way to use Arduino and begin with controlling the LCD module. Yes, we’d like to start from LCD module instead of installation since makers can find lots of related information from the Internet. So we’ll have less basic introduction here.

Let’s get started on it!


After reading the article, you will learn:

After reading this article and manipulating, you will have the basic understanding of I2C bus and LCD, and learn the way to connect modules with Arduino, use basic program to control your LCD module, and think about the applications. The advanced control techniques will be explained in the future articles.


Before reading the article, you need to know:

Here are the things you should know before reading the article:
– You need to know how to install Arduino IDE, compile and upload the codes to your development board.
– You need to know what Blink sample code is
– You need to know the basic structure of Arduino programming language ( void setup() & void loop() )
– You are able to install the 3rd party database.


What is I2C Bus?

I2C Bus enables 2 devices to communicate with each other in a stable, high-speed, bidirectional way and with the least I/O pins. I2C Bus utilizes 2 lines to communicate, Serial Data Line (SDA) and Serial Clock Line (SCL), so that the protocol I2C uses is also called “bidirectional” protocol.

What’s more special is I2C Bus allows multiple devices to share the common communication lines. Thus, I2C Bus could control the communication function.

Here we use Arduino as the main board to control; pin A4 and A5 on the board are SDA and SCL pins respectively. To use I2C function, you would need to use Wire Library, which is the built-in library of Arduino IDE.


LCD Module Spec and Pins

LCD is the abbreviation of liquid-crystal display; it’s a commonly-used display device and utilized everywhere in our daily life, from watches, calculators, TV to bulletin board.

Front end of the LCD Module
Front end of the LCD Module

This LCD module is the basic one and the most commonly-used character display; The voltage is 5V. The voltage level Arduino I/O Port uses is 5V so that we choose the LCD module. Besides, the LCD module can display 16 characters per line and there are 2 such lines. Also, the module uses I2C protocol. Thus, there are 4 pins on the module, including Vcc, GND, SDA, and SCL.

Back end of the LCD Module
Back end of the LCD Module


Wiring Diagram of LCD Module

It is also easy to connect the wires. Firstly, you need to connect pin Vcc of the module to Arduino pin 5V, connect pin GND to Arduino pin GND, and connect pin SDA to Arduino pin A4. Lastly, connect pin SCL to Arduino pin A5 to complete the wiring.

LCD Module Wiring
LCD Module Wiring



LCD Module Programming Sample

Before introducing the sample, we’d like you to download the 3rd party libraries of I2C_LCD first. You can download the files here, decompress, and install. In this sample, the version we use is NewliquidCrystal_1.3.4. The followings are the codes we use for this sample.

//Import Wire and LiquidCrystal_I2C Libraries

// Set the pins on the I2C chip used for LCD connections:
// addr, en,rw,rs,d4,d5,d6,d7,bl,blpol
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

void setup() {
// initialize LCD, 16 characters in a line, there are 2 lines, turn on backlight by default
lcd.begin(16, 2);

// blink 3 times
for(int i = 0; i < 3; i++) {
lcd.backlight(); // turn on backlight
lcd.noBacklight(); // turn off backlight

// output the initialization text
lcd.setCursor(0, 0); // set the cursor on the first character in the first line
lcd.setCursor(0, 1); // set the cursor on the first character in the second line
lcd.print("Hello, Maker!");
lcd.clear(); //clear the display
void loop() {
lcd.setCursor(0, 0); // set the cursor on the first character in the first line
lcd.setCursor(0, 1); // set the cursor on the first character in the second line

The process of the codes is to import Wire and LiquidCrystal_I2C libraries as Arduino starts.

Then, at the setting of initialization, LCD backlight will be controlled to blink 3 times. The first line will display “ICshop&MakerPRO” for one second, and the second line will display “Hello, Maker!” for 8 seconds. Then all the display will be cleared.

Lastly, in the main loop, the first line displays “ICshop&MakerPRO” and the second line displays the boot time.



Hope all of you successfully complete the I2C_1602_LCD module display with the description mentioned above. If you failed, please check the wiring or you bought a defective device.

So next, you could think of if you can use the module to make a clock or environment sensors. You might have tons of ideas now! Why don’t you connect a LCD module in your next project?

Sign up to become TechDesign member and get the first-hand supply chain news.

Leave a Reply

Your email address will not be published. Required fields are marked *