skip navigational linksPJRC
Shopping Cart Checkout Shipping Cost Download Website
Home MP3 Player 8051 Tools All Projects PJRC Store Site Map
You are here: Teensy Teensyduino Libraries LiquidCrystal

PJRC Store
Teensy 3.1, $19.80
Teensy 2.0, $16.00
Teensy++ 2.0, $24.00
USB Cable, $4.00
Main Page
Teensy 3.1
Getting Started
How-To Tips
Code Library

LiquidCrystal Library

LiquidCrystal lets you use small character type displays. Characters and a limited set of custom symbols can be used.

Download: LiquidCrystal (included in Arduino)
LiquidCrystalFast (Version 1.1)

LiquidCrystal & LiquidCrystalFast work with Teensy and Teensy++, and all Arduino boards.

Hardware Requirements

Display using fast 7 signal connection (LiquidCrystalFast)

Typical LCD Pinouts:
LCD PinFunction
1Ground (Vss)
2+5 Volts (Vdd)
3Contrast Adjust (Vee)
5R/W (or Ground)
6Enable (E)
7D0 (no used)
8D1 (no used)
9D2 (no used)
10D3 (no used)
15Backlight Power
16Backlight Power
Nearly all character type displays have a 14 pin interface. Often 2 extra pins are added for power to the backlight. Pins 1 and 2 must be connected to power. A 10K potentiometer is used for contrast adjustment, with the center pin connected to pin 3. The two outer pins of the potentiometer connect to +5 volts and ground.

Slow Connection

Only 6 signal are required, RS, Enable, D4, D5, D6 and D7. The R/W pin must be connected to ground. Pins D0, D1, D2 and D3 are left unconnected.

Fast Connection

LiquidCrystalFast can use the R/W pin for faster access. Either way can update the display faster than a human eye can detect, but if your project needs to do other work, less time updating the display may be worth using a seventh pin.

Large 4x40 Connection

LiquidCrystalFast can also access large 4x40 displays, which have two enable pins.

Display using slow 6 signal connection

Basic Usage

LiquidCrystal lcd(RS, Enable, D4, D5, D6, D7)

Create the LiquidCrystal object and specify the 6 pins where the LCD is connected. You can connect more than one display (each to its own pins) and create a separate LiquidCrystal objects for each.

lcd.begin(width, height);

Initialize the display and set the size.


Print a number or text. This works the same as Serial.print(), but prints to the LCD.

lcd.setCursor(x, y);

Move the cursor to position (x, y). These are zero-based coordinates.

LiquidCrystalFast lcd(RS, RW, Enable, D4, D5, D6, D7)

Create the LiquidCrystalFast object, using 7 pins.

LiquidCrystalFast lcd(RS, RW, Enable1, Enable2, D4, D5, D6, D7)

Create the LiquidCrystalFast object for large 40x4 display, using 8 pins.

Many other functions are available. See below for links to more details.

Example Program

This example can be loaded with File > Examples > LiquidCrystal > HelloWorld.
// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
  // set up the LCD's number of rows and columns: 
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("hello, world!");

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:

Using 5 Volt LCDs with 3.3 Volt Teensy

Most LCDs run on 5 volts, but are able to receive 3.3 volt signals from Teensy 3.0 or Teensy 2.0 modified for 3.3 volts.

The 6 signal (slow) connection only transmit to the LCD. All 6 lines can be connected directly.

The 7 signal (fast) connection using LiquidCrystalFast transmits on the 3 control signals, but both transmits and receives on the 4 data pins. Those 4 data pins should be connected using 1K resistors, as shown in this photo:

Connect D4-D7 with 1K resistors for 3.3V Teensy & LiquidCrystalFast


For more details, please refer to the official LiquidCrystal page.

LiquidCrystalFast was written by John Raines in 2010. The Arduino developers had planned to include it into Arduino 0019, but appear to have abandoned plans to use John's improvements.

Custom Character Creator by Druno Maia

LiquidCrystal can use 8 all data pins. However, careful benchmarking with found little speed advantage. With R/W used by LiquidCrystalFast (which does offer nearly a 4X speedup with most LCDs), 8 pins is actually slower due to the Arduino pin number conversion done to switch the extra 4 pins from input to output.

LiquidCrystal offers an option to use the R/W pin, but internally the code never makes use of that pin. If merely drives that pin low. If you want the R/W speedup, only LiquidCrystalFast actually makes use of the R/W pin.

Another new LCD library also aims to improve upon LiquidCrystal.