Interfacing 16×2 LCD Display To Arduino Uno
Interfacing 16×2 LCD Display To Arduino Uno
Arduino
Introduction
In this Article we will learn how to connect and use an LCD (Liquid Crystal
Display) with Arduino. LCD displays like these are very popular and broadly used in
many electronics projects because they are great for displaying simple information, like
sensors data, while being very affordable.
Circuit
The Arduino Uno has a microcontroller that can read data from various inputs like
sensors and also can compute it according to the program coded. Here we use Arduino
Uno, which has 14 digital input/output pins and six analog pins.
•Circuit for connecting an Arduino Uno with an LCD.
•LCD pin 1 (GND) is connected to the ground pin of the Arduino and to one end
of the 10k potentiometer
•Pin 2 (Vcc) connects with the 5V Vcc pin of Arduino.
•Connect the third pin of the LCD (Vee) with the middle pin of the 10k
potentiometer.
•You can connect the fourth pin (RS) with any of the digital pins on the Arduino.
However, make sure that you include this connection in the code accurately. The
Register select pin controls whether commands or data is being sent to the LCD.
When the pin is given a 0 (LOW), it accepts commands as input. When it is given
a 1 (HIGH), it takes data as input. We will see this implementation in the code.
•Connect pin 5 (R/W) with the ground pin of the Arduino. Since we are writing to
the LCD, we will select the Write mode by connecting it to a LOW value.
• LCD pin 6 (EN) connects with any of the digital pins on Arduino. This is the enable
pin, and it enables the next seven pins of the LCD (D0-D7) to send 8-bit data.
• LCD pin 7- pin 14 (DB0-DB7) connects with any of the digital pins of the Arduino.
However, remember to declare these as data pins in the code.
• Next, connect Pin 15 (LED+) with the 5V Vcc pin of Arduino. The function of this
pin is to control the backlight of the LCD screen.
• LCD pin 16 (LED-) should be connected with the ground pin of the Arduino.
Arduino Uno Pinout
Explanation
••Reset
ResetButton
Button– This will restart
– This any codeany
will restart that code
is loaded
thatto is
theloaded
Arduinoto
board.
the Arduino
•AREF
board.– Stands for “Analog Reference” and is used to set an external reference voltage.
•Ground Pin – There are a few ground pins on the Arduino and they all work the same.
•AREF – Stands for “Analog Reference” and is used to set an external
•Digital Input/Output – Pins 0-13 can be used for digital input or output.
•
reference voltage.
PWM – The pulse width modulation pins marked with the (~) symbol can simulate analog
•output.
Ground Pin – There are a few ground pins on the Arduino and they all
workConnection
•USB the same.– Used for powering up your Arduino and uploading sketches.
•TX/RX – LEDs to visualize data being transmitted and received from the board.
•
Digital Input/Output – Pins 0-13 can be used for digital input or output.
•ATmega328p – This is the microcontroller which stores the program and processes it.
•PWM – The pulse width modulation pins marked with the (~) symbol
can simulate analog output.
•USB Connection – Used for powering up your Arduino and uploading
sketches.
•Power LED Indicator – This LED indicates the board is connected to a power source.
•Voltage Regulator – This controls the amount of voltage going into the Arduino board.
•DC Power Barrel Jack – This is used for powering your Arduino with a power supply.
•3.3V Pin – This pin supplies 3.3 volts of power to your projects.
•5V Pin – This pin supplies 5 volts of power to your projects.
•Ground Pins – There are a few ground pins on the Arduino and they all work the same.
•Analog Pins – These pins can read the signal from an analog sensor and convert it to
digital.
Liquid Crystal Display (LCD)
Explanation
• LCD – Liquid Crystal Display.
• 16×2 LCD is an alphanumeric display that can show up to 32 characters on single screen. You
can display more characters by scrolling the texts one by one.
• It can be used with all Microcontroller boards like 8051, AVR, Arduino, PIC, and ARM
Microcontrollers.
• Most projects require an LCD display to communicate with the user in a better way. Some
projects may require displaying warnings, errors, Sensor values, State of the input and output
device, Selecting different modes of operations, Time and date display, Alert message and
many more. This will give the project a better view and its operation in a more visual way.
• A 16×2 LCD means it can display 16 characters per line and there are 2 such lines. In this
LCD each character is displayed in the 5×7 pixel matrix.
16×2 LCD Pinout
8-bit mode working of the 16×2 LCD
• It has 16 pins and the first one from left to right is the Ground pin. The second pin is
the VCC which we connect the 5 volts pin on the Arduino Board. Next is the Vo pin
on which we can attach a potentiometer for controlling the contrast of the display.
• Next, The RS pin or register select pin is used for selecting whether we will send
commands or data to the LCD. For example if the RS pin is set on low state or zero
volts, then we are sending commands to the LCD like: set the cursor to a specific
location, clear the display, turn off the display and so on. And when RS pin is set on
High state or 5 volts we are sending data or characters to the LCD.
• Next comes the R/W pin which selects the mode whether we will read or write to the
LCD. Here the write mode is obvious and it is used for writing or sending commands
and data to the LCD. The read mode is used by the LCD itself when executing the
program which we don’t have a need to discuss about it in this tutorial.
• Next is the E pin which enables the writing to the registers, or the next 8 data pins
from D0 to D7. So through this pins we are sending the 8 bits data when we are
writing to the registers.
Code
Conclusion
So, I have covered pretty much everything we need to know about using an LCD with
Arduino. These LCD Character displays are really handy for displaying information for
many electronics project. In the examples above I used 16×2 LCD, but the same
working principle applies for any other size of these character displays.
Thank You