The 1602 LCD display is a widely used alphanumeric display that consists of two lines, each capable of displaying 16 characters. Its versatility makes it suitable for various applications, including vending machines and train stations. While it is commonly included in Arduino kits, the instructions provided here can be applied to any LCD display that has a 16-pin interface compatible with the Hitachi HD44780 LCD controller.

To control the display, the LiquidCrystal Arduino library emulates the Hitachi HD44780 LCD controller. In this blog post, we will explore the simplest way to use the display by printing the famous “Hello, World!” message.

The LCD display has 16 input pins, which are as follows:

  • VSS: the negative connection
  • VDD: the positive connection
  • VO: adjusts the contrast (connected to a potentiometer in our project)
  • RS: connected to pin 7 of the Arduino
  • R/W: connected to ground (-) to set the LCD in “write mode”
  • E: connected to pin 8 of the Arduino
  • D0-D7: the data pins. In this example, we will only use D4, D5, D6, and D7
  • A and K: control the LED backlight. Connect A to the positive terminal via a 220Ω resistor, and K to the negative terminal.

To print the “Hello, World!” message, we can use the following Arduino code:

#include <LiquidCrystal.h>

LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

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

void loop() {

}

In this code, we first configure the lcd object by specifying the pin numbers for RS, R/W, E, D4, D5, D6, and D7. Then, we call the lcd.begin() method, passing the number of columns and rows of the LCD display.

By using the lcd.print() method, we can print a string on the display starting at position (0, 0). To move the cursor, we can use the lcd.setCursor() method, specifying the column and row indexes.

To build the circuit, follow the schematic shown below:

Circuit Schematic

And here’s an example of a real-world implementation:

Real-World Implementation

You can adjust the contrast of the display by trimming the potentiometer. Once you find your preferred setting, you can replace the potentiometer with a resistor to maintain the desired contrast.