LCD interfacing with Arduino Tutorial

16×2 LCD display

LCD displays are a common part of most of the embedded system projects, as it is the simplest readout method to display user instruction, text or output values etc..

This article explains the basics of AJHD162A LCD 16×2 display and its interface with the Arduino UNO R3.

A JHD162A LCD 16×2  display is a 16 pin interface module consists of 16 columns x 2 rows with

CHAR. DOTS:5 x 8  (5 columns x 8 rows)arduino 16x2 lcd interfacing

The pins and functions of the JHD162A LCD  16×2 module display are described as below.

PinNO  Name  Function
1 VSS Ground
2 VCC +5V DC
3 VEE Contrast adjust
4 RS Register select
5 R/W Read or write
6 E Enable
7 DB0 Data bit
8 DB1 Data bit
9 DB2 Data bit
10 DB3 Data bit
11 DB4 Data bit
12 DB5 Data bit
13 DB6 Data bit
14 DB7 Data bit
15 LED+ Backlight LED+
16 LED – Backlight LED-

JHD162A pin description

Pin1 (Vss): Connected to the Ground terminal of the supply

Pin2 (Vcc): An input supply of DC voltage +5V is connected to this pin.

Pin3 (VEE): Contrast adjust: The contrast adjust pin is connected to the wiper terminal of the potentiometer, the end terminals are connected to +5V and ground. The contrast of the LCD display can be adjusted by varying the voltage at the VEE pin. A grounded VEE pin also works fine.

Pin4 (Register Select): The LCD JHD162A module has two registers such as data register and command register.

Either the data register or command register will be selected at a time. An active high state of the RS pin select the Data register and a low state selects the command register.

when the Data Register has selected the input at the data pins will be considered as data and will be displayed on the screen of LCD matrix. And if the command register selected, the data will be selected as instructions to control the matrix module.

Pin5 (R/W): This pin is used for to select read and write modes.

A logic HIGH state of R/W pin selects read mode, i.e. read from the register and logic LOW at R/W pin selects write mode, i.e. write to the register.

Pin6 (E): It is to enable the LCD module. A HIGH to a LOW signal at enabling pin enables writing to the registers 8 data pins (D0 -D7).

Pin7 (DB0) – Pin14 (DB7): DB0 to DB7 are 8 data bit pins. The commands and data are sent through these pins. The states of these data pins (high or low) are the bits that you’re writing to a register when you write, or the values you’re reading when you read. State low at these pins represents a bit ‘0’ and high as bit ‘1’.

Pin15 (LED+) & Pin16 (LED-): Are the anode and cathode of the LED backlight. Connect Pin15 LED+ to a 5V supply and Pin16 LED- to ground.

Arduino LCD Connection

For Arduino interface, the LCD pins are connected as follows to the Arduino UNO R3 board.

Arduino LCD 16x2 Display interfaceLCD Enable (pin6) pin to digital pin 11LCD RS (pin4) pin to digital pin 12

The LCD module is interfaced with the Arduino in the 4-bit mode. Thus only the Data pins DB4 to DB7 of the LCD are connected and the remaining data bit pins DB0 to DB3 are left disconnected.

The connection of LCD data pins DB4 to DB7 with the corresponding pins of Arduino is listed below.

 LCD (pin11) D4 pin to digital pin 5

 LCD (pin12) D5 pin to digital pin 4

 LCD (pin13) D6 pin to digital pin 3

 LCD (pin14) D7 pin to digital pin 2

Vss (Pin1)   Connected to the Ground.

 Vcc (Pin2) An input supply of DC voltage +5V is connected to this pin.

VEE (pin3) connected to terminal 2 of the potentiometer, terminal 1  is connected to +5V and terminal 3 to ground.

 LCD R/W (pin5) pin is connected to ground to select write mode

 LED+(pin15)   is connected to a +5V supply and LED- (pin16)  is connected to ground.

Arduino LCD display Sample code

#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int i=0;
void setup() {
  lcd.begin(16, 2);

void loop() {

Try above sample code which moves the text “Mechatrofice” to and fro on the 16×2 LCD display.

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)

You may also like...

Leave a Reply

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