arduino lcd i2c

How to use 20×4 LCD I2C with Arduino

Posted on

The 20×4 LCD or 2004 LCD with Arduino – This LCD is very popular after a 16×2 LCD. One of the most uses is on the Prusa 3D Printer. The use of a 20 × 4 LCD is very easy with the help of the Arduino library, both for displaying text and characters. Value of 20×4 LCD means that the LCD consists of 20 columns and 4 lines. In other words, a 20 × 4 LCD using Arduino can display 20 characters in a row. The example of the display is as shown above. But how to connect lcd to arduino?


LCD Library

The 20×4 LCD 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 the HAMBO ELECTRONIC TES LCD text in LCD 20×4 using Arduino. We will display the words “HAMBO ELECTRONIC” on the first line and on the third line, we display the writing TES 20 × 4 LCD. First please download 20×4 lcd arduino library the LiquidCrysta_I2Cl Library below:

Download LiquidCrystal_I2C Libary

  • After download library i2c, open the Arduino IDE
  • Click Sketch > Include Library > Add. ZIP Library
  • Add the LiquidCrystal_I2C library that you downloaded into Arduino IDE
  • Click File > Example
  • If the LiquidCrystal_I2C list appears, it means that the library has entered the Arduino IDE


LCD Schematic

Before Arduino in the program please make it schematic first as in the picture below.

LCD 20x4 Arduino Schematic

lcd arduino connection



Scan the I2C LCD address

After connecting the LCD and Arduino as shown above, we must know the I2C address of the LCD. To find out the address, we scan first. The trick is we program the Arduino with the program below, then open the serial monitor. The I2C address will appear in the Serial Monitor.

#include <Wire.h>

void setup() {
  Serial.begin (9600);
  while (!Serial) 
  Serial.println ();
  Serial.println ("Finding I2C Address ...");
  byte count = 0;
  for (byte i = 8; i <120; i++)
    Wire.beginTransmission (i);
    if (Wire.endTransmission () == 0)
      Serial.println ("Yey, Got it!");
      Serial.print ("Address is : ");
      Serial.print ("0x");
      Serial.println (i, HEX);
      delay (1);  
  Serial.println ("Done.");
  Serial.print ("Get it ");
  Serial.print (count, DEC);
  Serial.println (" Device");
void loop() {}


Read other articles  2.4 TFT LCD Shield Arduino Tutorial

Display the word on the LCD

From the above program, I get the my ID address of this LCD is 0x3F. This address that we will be entered into the program so that it can display the text 20 × 4 HAMBO ELECTRONIC TEST LCD. Upload the program below to your Ardunino.

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

LiquidCrystal_I2C lcd(0x3F, 20, 4); 

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

void loop()

If successful, you will see on the screen with a 20 × 4 HAMBO ELECTRONIC TEST LCD text as shown in the beginning of this article.
Happy learning, happy work .

Leave a Reply

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