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

This post describes how to use a 16×4 Liquid Crystal Display unit to display the text “Hello World”.

Overview of the 16×4 Liquid Crystal Display Module

In this review I am using a 16×4 Liquid Crystal Display module, this LCD has 16 character panels per row, and four 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.

The interface to this LCD display uses the most common 16 pin display interface. The only difference between this one is that instead of having the standard two rows, this module has four.

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, 4);
    lcd.print("hello, world!");
}

void loop() {
    //Do nothing else
}

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

Review of the 16×4 Liquid Crystal Display Module

Overall the 16×4 LCD module is very useful to display information. Since it is larger than the standard 16×2 LCD module this can be a quick expansion if you need a little more space. Since many of these modules support the same interface you can easily replace the module with similar LCD screens.

The one downside is that, like the 16×2 LCD screen, 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 fewer pins.

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

2 Comments

Leave a Reply

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