Setting up a 16×2 Liquid Crystal Display to show Hello World

This post describes how to use a 16×2 Liquid Crystal Display unit as included in the Arduino Starter Kit to display the text “Hello World”.

Overview of the 16×2 Liquid Crystal Display Module

In this review I am using the 16×2 Liquid Crystal Display module from the Arduino Starter Kit. This LCD has 16 character panels per row, and two rows.

Using the Arduino we can control this and write any supported letters to the display. This is one of the simplest ways of displaying information from an Arduino.

This is the most common type of LCD display, with a standard protocol and 16 pin output. Likely whatever brand LCD display you have, if it has 16 pins and a similar pin output it will be supported by the Arduino.

A nice feature of this LCD module is that you can easily configure the contrast. I am going to add a potentiometer to manually tweak the contrast levels. However you can use a standard resistor instead of using a potentiometer. This may involve some trial and improvement to find the value which gives you the desired contrast.

Wiring it up to the Arduino

To wire the LCD module up to the Arduino we need to use 6 digital pins. The below diagram shows the full wiring for the LCD module.

The following pins of the module need to be connected as below, these are listed from left to right:

  • Pin 1 – GND
  • Pin 2 – 5V
  • Pin 3 – Output pin of 10k Potentiometer
  • Pin 4 – Arduino Pin 12
  • Pin 5 – GND
  • Pin 6 – Arduino Pin 11
  • Pin 7 – Not connected
  • Pin 8 – Not connected
  • Pin 9 – Not connected
  • Pin 10 – Not connected
  • Pin 11 – Arduino Pin 5
  • Pin 12 – Arduino Pin 4
  • Pin 13 – Arduino Pin 3
  • Pin 14 – Arduino Pin 2
  • Pin 15 – 220 Ohm resistor connected to 5V
  • Pin 16 – GND

The 10k potentiometer is used to set the brightness of the screen.

Programming the LCD to display Hello World

The basic Hello World program sets up the LCD by defining the pins attached to the Arduino.

#include <LiquidCrystal.h>;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
    lcd.begin(16, 2);
    lcd.print("Hello World!");
}

void loop() {
    //Do nothing
}

Once the lcd variable is created we initialize it with 16 characters on two lines and then print Hello World.

Review of the 16×2 Liquid Crystal Display Module

Overall the 16×2 LCD module is very useful to display information. A large number of modules that support the protocol and the ease of use make it very simple to configure.

The one downside is that it requires 6 pins on the Arduino to operate which may cause issues. This is something to bear in mind if you are looking at Arduino like clones which may have less pins.

In a later tutorial I will show how you can make it display data from a computer and sensor values.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.