LCD or Liquid Crystal Display is a display media based on liquid crystals as the main viewer object. LCDs are widely used for various purposes such as calculators, televisions, or computer screens. The LCD used in this tutorial is LCD 2004. This kind of LCD has 4 rows and 20 columns. To be more clear about the column and row look at the picture below
To display characters on LCD 20×4 connected to the I2C module, it is important to adjust the columns and rows so that the characters can be displayed according to the program. To set the column and row display on the LCD, the instruction “lcd.setCursor() ;” is used. For example, if we command “lcd.setCursor(3,1);” then the characters will be displayed in column 3 row 1. If you wanna print the characters you must use “lcd.print()” instruction, for example, if you command “lcd.print(“test”);” then the LCD will display the word “test” For more details, let’s do this simple experiment but first we need to prepare:
Tools and Materials
20×4 LCD with I2C module installed.
Jumper cables as needed. Then make a circuit like in the picture below with the pin configuration: • VCC connected to 5v Arduino Uno. • GND is connected to GND Arduino Uno. • SCL is connected to Arduino pin A5. • SDA is connected to Arduino pin A4.
First, you need to install a library to handle communication with LCD. For this moment we will use LiquidCrystal_I2C.h.h library. You can download it at this link. Next, open your Arduino IDE (can be downloaded at Arduino.cc), and copy the program listing as follows: