Introduction: How to Use I2C Serial LCD 20X4 (Yellow Backlight)
Description
Now, with only 3 pins from microcontroller, you can display message on this LCD. Compared to parallel LCD which required at least 6 pins of I/O, this LCD offer more cost effective solution. The LCD display is four lines by 20 characters and provides basic text wrapping so that your text looks right on the display.
Feature:
- 5V powered 4 x 20
- SPI communication
- Minimum 3 Pins interface to microcontroller
- Compatible with all types of microcontrollers
- Suitable for hobbyists and experts
- Back light and contrast control is available
- Size: 99mm x 60mm x 10mm
Step 1: MATERIAL PREPARATION
In this tutorial,the things you needed as below:
1. I2C Serial LCD 20X4 (Yellow Backlight)
2.4 Male-to-Female Jumper Wires
3.Arduino Uno Board and USB
Step 2: PIN DETAIL
You could see the pinout labeled at the back of the module. It has 4 pins that is VCC, GND,SDA and SCL.
Step 3: Pin Connection
Connect I2C Serial LCD Module to Arduino UNO as following :
- VCC to 5V
- GND to GND
- SDA to A4
- SCL to A5
Then, Connect your Arduino UNO Board to your computer via USB Cable.
Step 4: LIBRARY
For this tutorial,it is necessary to download and install the "LiquidCrystal_I2C" library.LiquidCrystal_I2C is a library of Arduino which enables serial LCD 20x4 connect with Arduino.To be able to interface the serial LCD with arduino, you will have to download this library and save it into your Arduino's libraries. Download the LiquidCrystal_I2C file below >Go to document >Save the file into your Arduino Uno Library folder. Refer the image above for your references.
Attachments
Step 5: SAMPLE SOURCE CODE
To get the result, please download the sample source code which is attached below and upload it into your Arduino. In this tutorial, the Arduino UNO is being used.
Attachments
Step 6: RESULT
The LCD will display the text.
11 Comments
2 years ago
Here is what I used to make it work for me.
-----------------------------------------------------------
#include "Wire.h" // For I2C
#include "LiquidCrystal_I2C.h" // Added library*
//Set the pins on the I2C chip used for LCD connections
LiquidCrystal_I2C lcd(0x27, 20, 4); // 0x27 is the default I2C bus address
void setup()
{
// Set off LCD module
lcd.begin (20,4); // 20 x 4 LCD module
// Turn on the blacklight and print a message.
lcd.setBacklightPin(3,POSITIVE); // BL, BL_POL
lcd.setBacklight(HIGH);
lcd.print("Hello, world!");
}
void loop()
{
}
2 years ago
5 years ago
I LOST three hours by looking up into your wrong code, tried everything adding libraries delete again add ..............
correct code:
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup()
{
// initialize the LCD
lcd.begin();
// Turn on the blacklight and print a message.
lcd.backlight();
lcd.print("Hello, world!");
}
void loop()
{
// Do nothing here...
}
Reply 3 years ago
code is good, worked for me and your code is with lots of errors
5 years ago
Doesn't work, just blinks once
Reply 3 years ago
I had a same issue. Spent quite time and at the end I had to adjust intensity pot on the back and it worked. Address 0x27 is for PCF8574T chip and 0x3F for PCF8574.
Reply 5 years ago
Make sure you put ure address in code it looks like this 0x3F(is mine)ure may be 0x27 or something else but look in "serial " window
4 years ago on Introduction
Thanx for the instructable, for the noob it would have been helpful mentioning the I2C_Hex_Scanner code. Fear not, I finally read upon it somewhere.
Question 5 years ago on Step 5
Hi, thanks for the tutorial, but the arduino program can't upload the code to the arduino. It says that the LiquidCrystal.h library cannot be found
5 years ago
This is a nice clean instructable, and I appreciate that i was able to get a functioning (i.e. duplicate) project very quickly. One question I have, however, is that there appears to be a great many <LiquidCrystal_I2C.h> libraries out there...maybe it's only one, but my struggle is finding thorough documentation for the library. Do you have any advice? In other words, how do I take this to the next level and make this basic sketch work for my purpose?
6 years ago
Another LCD l2C tutorial! Hurray!