Introduction: Liquid Crystal Display for Arduino Uno
The Liquid Crystal Display (LCD) is a flat display used to output text and othe ASCII symbols to the user. The LCD screen built specifically for the Arduino usually come in as a 16x2 display. That is, the character limit is 16 in width and 2 characters in height. i.e 16 columns and 2 rows of letters, numbers, or symbols.
These devices work in the same way an LCD screen like TV (before the days of the LED TVs), in that they use two sheets of polarizing material with a liquid crystal solution between them, hence the name Liquid Crystal Display. When electricity passes liquid causes the crystals move such that light cannot pass through certain areas of the screen.
This project teaches the fundamentals of interfacing an LCD Screen to an Arduino Uno. This knowledge can be further applied to various applications wherein the user requires a visual response to certain input data processed by the microcontroller, in this case an Arduino Uno.
Step 1: Tools and Materials
- Arduino Uno
- LCD Screen
- 16 pieces of jumper wires
- Potentiometer
- Breadboard
Step 2: Wiring the LCD Screen to the Arduino
Wiring the LCD is easiest when it is wired in order of the pins of the LCD screen.
- Connect pin 1 of the LCD screen to the common ground on the breadboard.
- Connect pin 2 of the LCD screen to the red power rial on the breadboard.
- Pin 3 is used for contrast adjustment and will be connected last.
- Connect the LCD's pin 4 to the Arduino's digital pin 12.
- Connect LCD's pin 5 to it's pin 1.
- Connect the LCD's pin 6 to the Arduino's digital pin 11.
- Pins 7, 8, and 9 are to connected to anything
- Connect the LCD's pins 10, 11, 12, and 13 to the Arduino's pins 5, 4, 3, and 2, respectively.
- Connect pin 14 to the red power rail on the breadboard.
- Connect pin 15 to the common ground on the breadboard.
You are now done the hardest part of the build!
Step 3: Adding a Potentiometer for Contrast Control
The LCD screen allows for the use of a variable input signal, in this case a knob potentiometer, to change the contrast settings of an LCD Screen. This is necessary since the default factory configuration is usually very dark, thus rendering the text virtually invisible to the naked eye.
- Connect one of the outer pins to the common ground rail in the breadboard.
- Connect the other outer pin to the red power rail in the breadboard.
- Connect the potentiometer to pin 3 of the LCD screen.
Then connect the Arduino's power to the breadboard to power up al the electronics.
- Connect the 5V pin from the Arduino to the red power rail on the breadboard.
- Connect the GND pin from the Arduino to the black common ground rail on the breadboard.
Step 4: Coding
// Load the LiquidCrystal library, which will give us
// commands to interface to the LCD:
#include
// Initialize the library with the pins we're using.
LiquidCrystal lcd(12,11,5,4,3,2);
void setup() { // begin lcd of this particular size lcd.begin(16, 2);
// Data sent to the display will stay there until it's // overwritten or power is removed. lcd.clear();
// Now we'll display a message on the LCD!
lcd.print("Hello World"); }
void loop() {
lcd.print("Resistance is Futile"); //wait a bit before taking another reading delay(1000);
}
Step 5: LCD Display Demonstration
At first, the screen may appear to be blank, void of any text. However, it is possible that the screen is actually turned on, and it is the contrast setting that makes the text hard to see. By adjusting the potentiometer, the screen contrast of the LCD display changes. Tune it to a setting which allows you to see the display with ease.
Change the message displayed by moving the cursor and inputting any text you wish! Have fun!