Interface 16×2 Alpha-numeric LCD with Arduino

What is a 16×2 Alpha-numeric LCD?

It is a programmable alpha-numeric liquid crystal display that has 16 columns and 2 rows. You can display a total of 32 alpha-numeric characters on this LCD. Further, each character is displayed in a 5×7 matrix. It has two modes of operation one is an 8-bit mode and the other is a 4-bit mode. In an 8-bit mode, the user uses all 8 data lines to send and receive data to and from the LCD, and in 4-bit mode, the user uses 4 data lines. The LCD also consists of a backlight that makes it easier to see displayed characters in the dark also.

Pin configuration of 16×2 LCD

16×2 Alpha-numeric LCD pin diagram

Pin uses

  • The GND pin is used to connect to the GND.
  • The VCC pin is used to connect to the VCC.
  • The contrast pin needs to be connected to a 10k ohm potentiometer to control the contrast of the LCD.
  • The RS(register select) pin is used to select register.
  • The R/W(read/write) pin is used to choose between reading and writing mode. If you are writing on the LCD, set this pin as LOW. If you are reading from the LCD, set this pin as HIGH.
  • The EN pin used to enable the LCD.
  • The D0-D7 are data lines for sending and receiving data to and from the LCD.
  • The last two pins are used to give power to the backlight.

Features of 16×2 LCD

  • The operating voltage is 4.7 to 5.3 volts.
  • The current consumption is 1mA without a backlight.
  • It consists of 16 columns and 2 rows.
  • There are two modes of using it that is an 8-bit and a 4-bit mode.

Components needed

  • Arduino UNO
  • 16×2 LCD
  • One 10k ohms potentiometer
  • Breadboard
  • Jumper wires

Pin connections of 16×2 LCD with Arduino UNO

  • Connect the GND pin of the LCD to the GND pin of the Arduino UNO.
  • Connect the VCC pin of the LCD to the 5v pin of the Arduino UNO.
  • Connect the Contrast pin to the middle pin of the potentiometer.
  • Connect one terminal of the potentiometer to the GND pin of the Arduino UNO.
  • Connect the other terminal of the potentiometer to the 5V.
  • Connect the RS pin of the LCD to the D2 pin of the Arduino UNO.
  • Connect the R/W pin of the LCD to the D3 pin of the Arduino UNO.
  • Connect the EN pin of the LCD to the D4 pin of the Arduino UNO.
  • Connect the D4 pin of the LCD to the D5 pin of the Arduino UNO.
  • Connect the D5 pin of the LCD to the D6 pin of the Arduino UNO.
  • Connect the D6 pin of the LCD to the D7 pin of the Arduino UNO.
  • Connect the D7 pin of the Arduino to the D8 pin of the Arduino UNO.
  • Connect the Backlight(+) pin to the 5 volts.
  • Connect the Backlight(-) pin to the GND.

Circuit diagram of 16×2 LCD with Arduino UNO

16×2 Alpha-numeric LCD circuit diagram

Arduino code for 16×2 LCD

#include "LiquidCrystal.h"
//Include library for LCD
const int rs = 2, en = 3, d4 = A0, d5 = A1 ,d6 = A2, d7 = A3;//Define all the pins of the LCD
LiquidCrystal myLcd(rs, en, d4, d5, d6, d7);
//Create an object of type LiquidCrystal to access all the functions of the library 
 
void setup() {
  myLcd.begin(16, 2);
//Initate LCD
}
 
void loop() {
  myLcd.setCursor(0,0);//Set cursor position to 0th column and 0th row
  myLcd.print("I love Arduino");//Print this on the first row of the LCD
  myLcd.setCursor(0, 1);
//Set cursor position to 0th column and 1th row
  myLcd.print("ElectroVigyan");
//Print this on the second row of the LCD
}

Leave a Reply