LCD I2C 20×4 Arduino
How to use LCD 20×4 Arduino I2C? – LCD 20×4 displays that use a monochrome display. These types of displays are often used in electronic devices such as clocks, thermostats, and appliances. They consist of a grid of 20 columns and 4 rows of pixels, which can be used to display text and simple graphics.
The display is monochrome, meaning that it can only display one color, typically white, green, or blue. The display is controlled by a microcontroller or computer, which sends data to the display over a set of wires or a serial connection. The display is usually backlit, which makes it easier to read in low-light conditions. One of the most current uses is Prusa 3D Printers.
The use of the 20×4 LCD is very easy with the help of the Arduino library, both for displaying text and characters. In this tutorial, we will learn how to display www.chippiko.com 20×04 LCD using Arduino.
Library liquidcrystal_i2c
First, click the download button to get the LiquidCrysta_I2Cl file:
After the download is complete, open Arduino IDE:
- Click Sketch > Include Library > Add .ZIP Library
- Choose the LiquidCrystal_I2C library that has been downloaded
- Click File > Example
- If the LiquidCrystal_I2C list appears, it means that the library has entered the Arduino IDE
Wiring
Before Arduino is programmed, make the circuit first as shown in the image below.
LCD:
VCC
GND
SDA
SCLArduino:
5V
GND
A4
A5
Scan I2C Address
After you have assembled like the picture above, we must know the I2C address of the LCD. To be able to find out the address, we scan first. Please upload this code to your Arduino boards:
#include <Wire.h>
void setup() {
Serial.begin (9600);
while (!Serial)
{
}
Serial.println ();
Serial.println ("Search I2C Address ...");
byte count = 0;
Wire.begin();
for (byte i = 8; i <120; i++)
{
Wire.beginTransmission (i);
if (Wire.endTransmission () == 0)
{
Serial.println ("get it");
Serial.print ("Address is: ");
Serial.print ("0x");
Serial.println (i, HEX);
count++;
delay (1);
}
}
Serial.println ("Done.");
Serial.print ("Found ");
Serial.print (count, DEC);
Serial.println (" Device.");
}
void loop() {}
Displaying Text on LCD
From the program above, in my case, I get the result that the ID address of this LCD is 0x3F. Another address for this LCD is 0x27. Upload the LCD 20×4 i2c code below to your boards.
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x3F, 20, 4); //another address commonly is 0x27
void setup()
{
lcd.init();
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print(" Hello World!");
lcd.setCursor(0, 2);
lcd.print(" www.chippiko.com");
}
void loop()
{
}
if the upload is successful, you will see the result as shown in the following image
Good luck and I hope this article is useful. Want to share? Please use the share button below. Other tutorials about Arduino Display:
- Arduino Compass MPU9250 Magnetometer & OLED
- Letter Typing Effect LCD I2C 20×4 Arduino
- Effect LCD I2C 20×4 Fly-In Out Arduino
- LCD 16×2 Arduino Simulation using SimulIDE
- Arduino Digital Spirit Level Using MPU9250 & OLED
- Tutorial MPU9250 Arduino Show Data to OLED U8g2 Library
- Knop OLED SSD1306 Arduino SimulIDE u8g2
- ATtiny2313 OLED 128×64 Wiring & Code
- Voltmeter ATtiny OLED Arduino (30V Max)