1602 LCD – Learn how to use with Arduino

Want to learn how to use a 1602 LCD with Arduino so you can use it in future projects? In this post we’ll go over how to use the 1602 LCD both the conventional way and with I2C. The 1602 LCD can be used to display a simple message, display a sensor value (i.e. temperature), or even display data pulled from the internet (i.e. weather info).

1602 LCD Module Pins

1602 LCD module pins

Click to enlarge

GND – Connects to Arduino’s GND.
VDD – Connects to Arduino’s 5V pin.
V0 – LCD contrast control.
RS – Register select (command/data).
RW – Read / Write selection.
E – Used to enable/disable LCD.
Data Pins (D0 – D7) – Pins used to send data to LCD.
Back Light Control (A/K) – Pins to control the backlight of the LCD.

1602 LCD Connection to Arduino UNO

Conventional Method

1602 LCD breadboard diagram (conventional method)

Click to enlarge

I2C Method

1602 LCD breadboard diagram (I2C method)

Click to enlarge

As you can see, this method uses many of the available IO pins on the Arduino UNO, but does not use the I2C pins (SCL/SDA).

This method is cleaner and frees up your IO pins, but does require use of the I2C pins (SCL/SDA).

LCD Contrast Control

In order to get a desirable contrast on the LCD, you will need to adjust the voltage going to the LCD’s V0 pin. To do this you will need to adjust the potentiometer setting (conventional method) or use a small screwdriver to change the setting on the built-in trimpot (I2C method).

Conventional method
1602 LCD contrast control
I2C method

Required Libraries

Conventional Method

The conventional method makes use of the LiquidCrystal library, which is included by default in Arduino IDE (so no need to download or install anything).

I2C Method

The I2C method requires installing the LiquidCrystal_I2C library, which can be found in this Link.

Download & Install the LiquidCrystal_I2C Library

Download the LiquidCrystal_I2C library located on the link above. Once the zip file for the library has been downloaded, you need to import it within the Arduino IDE. For this, go to the top menu, then click Sketch, Include Library, Add .Zip Library… Then, find the zip file in the folder in which it was downloaded, select the zip file and click open to import into Arduino IDE.

Click to enlarge

Click to enlarge

Arduino Code – Conventional Method

Comments on Arduino Code:

Line 3 – Include the LiquidCrystal library
Line 4 – Specify the IO pins connected to RS, E, and Data Pins (D4-D7)
Line 7 – Begin the LCD under the void setup section
Line 11 – Place the cursor at the beginning of the first line in the LCD (i.e. Line 0)
Line 12 – Print the designated characters starting the at cursor location
Line 13 – Place the cursor at the beginning of the second line in the LCD (i.e. Line 1)
Line 14 – Print designated text

Arduino Code – I2C Method

Possible Issue:

Line 4 of the Arduino code shown above assumes the I2C address is 0x27. If running the code with this address leads to no text showing on your LCD, chances are that your LCD I2C module is setup to have a different address. One way to get around this is to run a separate code to determine the address. The code below can be used to determine the address (source: https://playground.arduino.cc/Main/I2cScanner).

Click below to expand the I2C Address Finder code (if you need it).

Comments on Arduino Code:

Line 3 – Include the LiquidCrystal_I2C library
Line 4 – Specify the address and number of columns and rows
The rest of the code is the same as the one on the conventional method

Example Results

1602 LCD example results
Conventional method
1602 LCD example results
I2C method

Example uses of 1602 LCD

Date & Time display with DS3231See post

1602 LCD example results (with RTC)

Click to enlarge

Temperature & Humidity display with DHT11See post

1602 LCD example results (with temperature sensor).

Click to enlarge

Components used in this example

*As an Amazon & Ebay Associate I earn from qualifying purchases.

Arduino UNOhttps://amzn.to/3uYVAMC
1602 LCD (with I2C module)https://amzn.to/2P146LY
Electronic Component Kit
(includes potentiometer)
Breadboard (Elenco 9440)https://amzn.to/3x23dnq

Leave a Reply

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