Difficulty : Easy
Ever felt being limited when using a backlit LCD display unit that takes up too many data pins on your Arduino board? No worry, you can save up those pins for other uses by using an additional I2C backpack module for LCD1602 or LCD2004!
This tutorial will guide you on how to use a backlit LCD display unit with I2C backpack module and Arduino. Make sure the I2C backpack module is attached and soldered to the LCD1602 or LCD2004 display unit before proceeding.
This guideline also works with LCD2004 backlit LCD display unit, with minor changes in code.
- Arduino Uno (or any model)
- LCD1602 16×2 backlit LCD display screen
- LCD1602/2004 display I2C backpack module
- Female-to-male jumper wire x 4
|Arduino Uno||LCD1602 I2C display module|
|A4 or SDA||SDA|
|A5 or SCL||SCL|
1. Connect the wires between Arduino board and LCD1602 I2C display.
Arduino Uno is connected to the LCD1602/2004 I2C backpack and LCD1602 on breadboard
2. Connect Arduino board to computer.
3. Make sure the COM port for your Arduino board is visible in Device Manager > Port (COM & LPT)
4. Open Arduino IDE. Go to Sketch > Include Library > Manage libraries…
5. Wait for the updates, then search LiquidCrystal I2C by Frank de Brabander version 1.1.2 and install it. This will take several seconds depend on your computer specs.
Installation of LiquidCrystal I2C libraries in Arduino IDE (the editor has installed beforehand)
6. After you have installed the library, close the library manager and go to File > Examples. Scroll down to Examples from Custom Libraries and find LiquidCrystal I2C, then open the example HelloWorld.
7. Use the code below in your Arduino IDE
8. Make sure type of board and port is selected accordingly in Arduino IDE.
- Select board : Go to Tools > Board > Arduino ……
- Select port : Go to Tools > Port > COMx (confirm this with Device Manager)
9. Upload the program. You should see the LCD screen displays text by now.
10. Congratulations, you have successfully setup the LCD1602 I2C display module with Arduino.
Arduino is successfully transfer the texts to LCD1602 with I2C backpack and displayed the editor’s name.
If it does not work, consider
- Change the I2C address for the LCD instances from 0x27 to 0x3F in the code, then upload the program again.
- Adjust the trimpot position at the backpack module, you should see the display contrast is changing, adjust until texts are displayed clearly.
- SDA and SCL might be crossed, correct these pins and reset the Arduino by pressing the Reset button.
- I2C backpack module is PCF8574 based I/O expander that uses I2C serial communication protocol to control the data on extended IO pins. This module is designed for LCD1602 or LCD2004 display units, but you may use it for other purposes.
- Author : Henry Chau Yin Chung
- Date created : 15 October 2019