Lesson 22 LCD Display
Lesson 22 LCD Display
Overview
In this lesson, you will learn how to wire up and use an alphanumeric LCD display.
The display has an LED backlight and can display two rows with up to 16 characters on
each row. You can see the rectangles for each character on the display and the pixels that
make up each character. The display is just white on blue and is intended for showing text.
In this lesson, we will run the Arduino example program for the LCD library, but in the next
lesson, we will get our display to show the temperature, using sensors.
Component Required:
Component Introduction
LCD1602
RS: A register select pin that controls where in the LCD’s memory you are writing data to.
You can select either the data register, which holds what goes on the screen, or an
instruction register, which is where the LCD’s controller looks for instructions on what to
do next.
R/W: A Read/Write pin that selects reading mode or writing mode
E: An enabling pin that, when supplied with low-level energy, causes the LDC module to
Connection
Schematic
Wiring diagram
The LCD display needs six Arduino pins, all set to be digital outputs. It also needs 5V and
GND connections.
There are a number of connections to be made. Lining up the display with the top of the
breadboard helps to identify its pins without too much counting, especially if the
breadboard has its rows numbered with row 1 as the top row of the board. Do not forget,
the long yellow lead that links the slider of the pot to pin 3 of the display.
You may find that your display is supplied without header pins attached to it. If so, follow
Code
After wiring, please open the program in the code folder- Lesson 22 LCD Display and click
UPLOAD to upload the program. See Lesson 3 for details about program uploading if
there are any errors.
Before you can run this, make sure that you have installed the < LiquidCrystal > library or
Upload the code to your Arduino board and you should see the message 'hello, world'
#include <LiquidCrystal.h>
This tells Arduino that we wish to use the Liquid Crystal library.
Next we have the line that we had to modify. This defines which pins of the Arduino are to
After uploading this code, make sure the backlight is lit up, and adjust the potentiometer
all the way around until you see the text message In the 'setup' function, we have two
commands:
lcd.begin(16, 2);
lcd.print("Hello, RexQualis!");
The first tells the Liquid Crystal library how many columns and rows the display has.
The second line displays the message that we see on the first line of the screen.
lcd.setCursor(0, 1);
lcd.print(millis()/1000);
The first sets the cursor position (where the next text will appear) to column 0 & row 1.
Example picture