Skip to content

Connecting a LCD to an Arduino


A liquid crystal display (LCD) is an attractive way for easy communication between the user and hardware.
In this tutorial we will see how to connect a 16x2 LCD display on our arduino using only 6 pins.
As you may noticed always we start from the documentation offered for free of the various hardware manufacturers.
Here is the data-sheet of the LCD Module 1602 A1 .

As we can see from the documentation we can individuate 16 pins

LCD Pins

let's find out the pin assignment, always based on the given data-sheet.

LCD pin assignment

Let's comment the pins.

Pin 1 Vss is the ground (0V) of the power supply

Pin 2 Vdd is the +5V of the power supply

Pin 3 Vo is a voltage that controls the contrast of the LCD display. It takes values from 0-5V. Higher Vo means more brightness (less contrast) to the screen. Less Vo means less brightness (more contrast) to the screen.
In order to control the contrast we have to put a voltage divider. If you need to change the contrast then you have to add a potentiometer but if you only need a fixed contrast you can build a regular two resistor voltage divider demonstrated in this article.
After some experiments using R1=10K and R2=1K you can get a pretty nice stable contrast. If you want more brightness (less contrast) then you need a higher R2, if you want to get a more dark result (more contrast) then you should lower the R2 value at 470 Ohms or even lower.

Pin 4  The register select (RS) pin controls where in the LCD's memory you're writing data to.
The RS pin lets the micro-controller tell the LCD whether it wants to use the data register so it can display that data (as in, an ASCII
character) or whether it wants to use the instruction register so it can use a command byte (like, change position of the cursor).
This pin will be controlled directly from the arduino LiquidCrystal class.

Pin 5 The Read/Write (R/W) pin is used to set the direction. Whether we want to write to the display (common) or read from it (less common). Setting a high value we set it to read mode and by setting it to a low value we are setting this into writing mode.
So RW can be set to ground (low) since we're only writing to the display (which is the most common thing to do)

Pin 6 The Enable signal (E) is the pin that enables writing to the registers. In other words we use this pin to tell to the LCD when data is ready for reading. This pin is directly piloted by the arduino liquidcrystal class too.

The pins 7-14 also called D0-D7 are the pins that have the raw data that we send to the display.
We can select to talk to the LCD using 4 or 8 data pins.
We will use 4 datalines and not 8 so we will use only the pins DB4,DB5,DB6,DB7 and we leave unconnected the pins DB0,DB1,DB2,DB3.
By doing this we save 4 pins.

The pin 15 is the Backlight +5V (BLA)

The pin 16 is the Backlight 0V (BLK)

Notice that LCD that do not have a back light the pins 15-16 can be unconnected. On a LCD with a back-light, leaving these pins unconnected will not light up the background light but you should be able to see the printed screen.