LCD Character Display Module
Category:
Subcategory:
Signal Type:
n/a
IDeATe Component Number:
4001
Displays rows of text
LCD Character Display Module
What it is

The LCD character display module is a backlit screen that shows letters, numbers, and characters on rows and columns.

When to use it

When you need to provide visual textual or numerical output.

How it works

An Liquid Crystal Display (LCD) is made up of layers of different materials. There are many different LCD technologies: some work without a light source (like on a wrist watch), some can show colors (a computer screen), and some use little squares to make up different characters (this screen). This particular type of LCD uses STN (Super Twisted Nematic) LCD technology.

This type of LCD consists of many layers. Light is emitted from layer 6 (see image below), the backlight. The waves of light then pass through the horizontal polarizing filter (layer 5). This filter allows for only horizontal waves of light to pass through it. Layers 2 and 4 are electrodes that pass electricity through the liquid crystal layer (layer 3). When an electric signal flows across the liquid crystal layer, the liquid crystals align with the electrodes and rotate the waves of light from horizontal to vertical. Finally, a vertical polarizing filter (layer 1) allows for only light rotated by the liquid crystal layer to pass through. The shapes of the electrodes on layer 2 determine the patterns displayed by the LCD.

LCD Display Diagram
Image from author Ed g2s via Wikimedia Commons

You can see this same polarizing effect with a pair of polarized sunglasses and any LCD screen (i.e. a computer or phone). As you rotate the sunglasses toward 90 degrees, you will find that the screen fades out until it is entirely dark. This is because the screen only emits waves of light vertically, and the sunglasses only allow through vertical waves of light. When the sunglasses are rotated 90 degrees, the now horizontal filter does not allow vertical waves to pass through.

How to use it

The LCD character display has a lot of pins to signal what to display and when to display it. To make this coordination easier, the LiquidCrystal library may be used.

There are two modes for the LCD: 4-bit and 8-bit. Most letters and numbers can be displayed using the 4-bit mode. This means that the LCD won't use as many pins on the Arduino, leaving room for more components.

Note that this display takes about half a second to finish updating its screen, so text becomes difficult to read if it is changed or scrolled too quickly.

Getting started

This code requires the LiquidCrystal library. You can install it in the Arduino IDE by going to Sketch > Include Library > Manage Libraries and searching for "LiquidCrystal." This library handles all of the coordination of the many LCD pins.

LCD Schematic
For this example, the LCD is in 4-bit mode, so it only uses 4 of the data pins. The potentiometer adjusts the contrast.
/*
 * This program sets up a 16x2 LCD display in 4-bit
 * mode on RS_PIN, E_PIN, D4_PIN, D5_PIN, D6_PIN,
 * and D7_PIN.
 *
 * Initially by David A. Mellis from https://github.com/arduino-libraries/LiquidCrystal/blob/f1f2f18b0180ede74b265f680e1d02fa71bca7bb/examples/HelloWorld/HelloWorld.ino
 * Modified 2021-05-02 by Perry Naseck
 */

#include <LiquidCrystal.h>

const int RS_PIN = 12; // Digital pin for the LCD's RS pin
const int E_PIN = 11;  // Digital pin for the LCD's E pin
const int D4_PIN = 5;  // Digital pin for the LCD's D4 pin
const int D5_PIN = 4;  // Digital pin for the LCD's D5 pin
const int D6_PIN = 3;  // Digital pin for the LCD's D6 pin
const int D7_PIN = 2;  // Digital pin for the LCD's D7 pin

// Create the LCD instance using those pins
LiquidCrystal lcd(RS_PIN, E_PIN, D4_PIN, D5_PIN, D6_PIN, D7_PIN);

void setup() {
  // Set up the LCD's number of columns and rows
  lcd.begin(16, 2);

  // Print a message to the LCD.
  lcd.print("hello, world!");
}

void loop() {
  // Set the cursor to column 0, line 1. This sets where the next
  // print() command will start writing.
  // (note: line 1 is the second row, since counting begins with 0)
  lcd.setCursor(0, 1);

  // Print the number of seconds since reset
  lcd.print(millis() / 1000);
}
Resources
Related Components