In this getting started with LCD module tutorial we are going to learn about two different way of interfacing an LCD module with popular development boards like Arduino Nano, Arduino Uno, Arduino Mega, Arduino Leonardo.
- LCD module 16 x 2
- Arduino UNO
- Arduino Nano
- Arduino Leonardo
- Arduino Mega
- Arduino IDE
- LiquidCrystal Library – Will available in Arduino IDE by default – For the first method
- LiquidCrystal I2C Library – Download – For the second method
- Wire Library – Will available in Arduino IDE by default
A little bit about LCD modules…
LCD modules are coming in different colors and sizes with a different number of displayable characters. the most commonly used one is LCD1602 which can display 16 characters in each line, that is a total of 32 characters. Some other sizes are,
- LCD1604 – 16 char / 4 line
- LCD2004 – 20 char / 4 line
- LCD1602 – 16 char / 2 line
- LCD1601 – 16 char / 1 line etc…
|1||VSS (0v)||Ground Potential|
|2||VDD (5v)||Positive Voltage|
|3||V0 (Contrast)||Contrast adjustment; 0v: Max contrast; 5v: Min contrast|
|4||RS||Register Select; 0: Instruction Register 1: Data Register|
|5||RW||Read Write Select pin 0: Write mode; 1: Read mode;|
|6||E||A Enable Pin To enable the LCD Module|
|7||D0-D7||LCD Data Bus line. They are responsible for the parallel data transfer.|
|15||LED+ (A)||Back Light Source LED Anode|
|16||LCD- (K)||Back Light Source LED Cathode|
In the first method, we are interfacing the LCD1602 with Arduino using the data pins of the LCD module. The same code and circuit will work for all Arduino and compatible boards. Connect the circuit as shown in the below diagram.
- First, connect the ground of Arduino to the VSS of the LCD.
- Then connect the V0 of the LCD to the ground for full contrast
- Then connect RW to the ground for selecting write mode
- Then connect K, which is the ground of backlight LED also to the ground.
- Then connect the 5V of Arduino to the VDD of the LCD module.
- Then connect the digital pin 12 of Arduino to the RS of LCD module.
- Then connect the digital pin 11 of Arduino to the E of LCD module.
- Then connect the digital pin 5 of Arduino to the D4 of LCD module.
- Then connect the digital pin 4 of Arduino to the D5 of LCD module.
- Then connect the digital pin 3 of Arduino to the D6 of LCD module.
- Then connect the digital pin 2 of Arduino to the D7 of LCD module.
- And finally, connect the 3.3V of Arduino to the A of LCD which is the anode of backlight LED.
In the second method, we are using a module which converts the 16 pins of the LCD module to just 4 pins I2C communication interface (including power & ground). Connect the circut as shown in the below diagram.