Overview

In this tutorial you are going learn how to connect a Liquid Crystal Display (LCD) to an Arduino Uno and make it display stuff. LCDs come in handy if you need to display info on a screen. They are cheap and common. Connecting an LCD to an Arduino is pretty straightforward and there is example code which comes with the Arduino IDE which we are going to modify and use.

Details

There are different kinds of LCDs but for this tutorial we are going to use  LCD displays that are compatible with the Hitachi HD44780 driver. There are many of them out there, and you can usually tell them by the 16-pin interface. We are going to be using the Liquid Crystal Library for Arduino.

Here are the parts we are going to be using.

  • Hitachi HD44780 driver compatible LCD
  • Arduino Uno
  • 50kOhm Potentiometer
  • Some jumper wires
  • A breadboard
16x2-Character-LCD

LCD 16×2 Pinouts

The LCD has 16 terminals or pins which are labelled as you can see in the picture.

The table below shows the pinouts for the LCD, their names and their functions

[table caption=”LCD Pinouts and Functions”]
Pin No.,Pin Name,Function
1,Vss,Power Supply (GND). Connects to negative terminal of power supply
2,Vdd,Power Supply (+5v). Connects to positive terminal of power supply
3,Vo,Contrast Adjust. Used to adjust contrast of LCD. Connects to the wiper (middle pin) of the potentiometer
4,RS,Register Select. Selects command register when low; and data register when high
5,R/W,Read/Write. Connected to low to read from register and vice versa.
6,E,Enable pin.Sends data to data pins when a high to low pulse is given
7,DB0,Data Bus Line.
8,DB1,Data Bus Line.
9,DB2,Data Bus Line.
10,DB3,Data Bus Line.
11,DB4,Data Bus Line.
12,DB5,Data Bus Line.
13,DB6,Data Bus Line.
14,DB7,Data Bus Line.
15,A,Power Supply for LED backlight. (+) Connects to positive terminal of power supply
16,K,Power Supply for LED backlight. (-) Connects to negative terminal of power supply

[/table]

The states of the data bus lines (D0 to D7) which can either be 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.

The LCD can be used in either 4 bit or 8 bit mode. The 4 bit mode usage is more common with Arduino since it is enough to do almost everything you want, hence usually, data pins D0 to D3 are not usually used when working with Arduino.

Schematic

Below is a Fritzing image of how to connect the LCD to an Arduino.

LCD_Base_bb_Fritz

Fritzing image of circuit. Image Courtesy Arduino Official Website

Arduino Code

Here is how the complete assembly looks like.

lcdcircuit

Side view showing programmed, working LCD

 

lcdcircuit2

Top view showing programmed, working LCD

lcdcircuit3

Output of Arduino Code

Resources

Download the LCD datasheet here

I also created a tutorial on how to simulate LCD in Proteus. You can check it out here.

 

 

%d bloggers like this: