Skip to content Skip to sidebar Skip to footer

Liquidcrystal Display LCD Arduino 20x4 Tutorial

LCD I2C 20x4 Arduino

Liquidcrystal Display LCD Arduino 20x4 Tutorial – This LCD is very popular after the 16×2 LCD. One of the most current uses is on 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. 

A value of 20×4 means that this LCD consists of 20 20 characters and 4 rows. 

This 20×04 LCD uses Arduino to communicate with Arduino in 2 ways. The first is 8-bit parallel communication and the second is I2C serial communication.

In this tutorial we will learn how to display HAMBO ELECTRONIK TEST 20×04 LCD using Arduino.


Libary liquidcrystal_i2c

First download the LiquidCrysta_I2Cl library, then we will display the words "HAMBO ELEKTRONIK" on the first line and on the third line, we will display the words TEST LCD 20×4. 

 
After friends download, open Arduino IDE
  • Click Sketch > Include Library > Add .ZIP Library
  • Enter the LiquidCrystal_I2C library that have 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.

Arduino       LCD 20×4
5V       >       VCC
GND     >       GND
A4        >       SDA
A5        >       SCL
 

 

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. 

The trick is to program the Arduino with the program below, then open the serial monitor. The I2C address will appear from the LCD.


Program:

#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, I get the result that the ID address of this LCD is 0x3F. This address is what we will enter into the program so that it can display the writing of the 20×4 LCD . Upload the program below to Ardunino, friends.


Program:

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x3F, 20, 4);

void setup()
{
lcd.init();
lcd.init();
lcd.backlight();
lcd.setCursor(2, 0);
lcd.print("HAMBO ELEKTRONIK");
lcd.setCursor(3, 2);
lcd.print("TES LCD 20x04");
}

void loop()
{
}

Result is:

Good luck and I hope this article is useful. Want to share? Please use the share button below.

Post a Comment for "Liquidcrystal Display LCD Arduino 20x4 Tutorial"