Arduino 16x2 LCD Hello World: Wiring, Code and Simulator

To build this Arduino 16x2 LCD Hello World project you need an Arduino Uno and a 16x2 LCD. A character LCD in 4-bit mode via the LiquidCrystal library, with a live seconds counter. Make the 11 connections in the wiring table, upload the Arduino C++ code, and read the message on the LCD, and watch the uptime count up on the second row.

Open this circuit in the free Arduino Uno simulator

Parts list

QtyPartWhat it does
1Arduino Unothe microcontroller board
116x2 LCDCharacter LCD (HD44780). Wiring "full": RS, E and D4–D7 to pins (LiquidCrystal). Wiring "i2c": SDA to A4, SCL to A5 (LiquidCrystal_I2C, address 0x27).

Wiring

#FromTo
1Arduino Uno pin 1216x2 LCD RS
2Arduino Uno pin 1116x2 LCD E
3Arduino Uno pin 516x2 LCD D4
4Arduino Uno pin 416x2 LCD D5
5Arduino Uno pin 316x2 LCD D6
6Arduino Uno pin 216x2 LCD D7
7Arduino Uno GND16x2 LCD RW
8Arduino Uno GND16x2 LCD VSS
9Arduino Uno GND16x2 LCD K
10Arduino Uno 5V16x2 LCD VDD
11Arduino Uno 5V16x2 LCD A

Step by step

  1. Open the simulator. Open the BitForBytes Embedded Lab in your browser and start from the Arduino Uno. No install or account is needed.
  2. Add the parts. Add a 16x2 LCD from the parts palette.
  3. Wire 1. Connect Arduino Uno pin 12 to 16x2 LCD RS.
  4. Wire 2. Connect Arduino Uno pin 11 to 16x2 LCD E.
  5. Wire 3. Connect Arduino Uno pin 5 to 16x2 LCD D4.
  6. Wire 4. Connect Arduino Uno pin 4 to 16x2 LCD D5.
  7. Wire 5. Connect Arduino Uno pin 3 to 16x2 LCD D6.
  8. Wire 6. Connect Arduino Uno pin 2 to 16x2 LCD D7.
  9. Wire 7. Connect Arduino Uno GND to 16x2 LCD RW.
  10. Wire 8. Connect Arduino Uno GND to 16x2 LCD VSS.
  11. Wire 9. Connect Arduino Uno GND to 16x2 LCD K.
  12. Wire 10. Connect Arduino Uno 5V to 16x2 LCD VDD.
  13. Wire 11. Connect Arduino Uno 5V to 16x2 LCD A.
  14. Paste the Arduino C++ code. Paste the Arduino C++ code below into the code editor.
  15. Run it. Press Run. Read the message on the LCD, and watch the uptime count up on the second row.

Arduino C++ code

// LCD hello: print on a 16x2 character LCD with the LiquidCrystal library.
// Wiring: RS=12, E=11, D4=5, D5=4, D6=3, D7=2 (4-bit mode).
#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

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

void loop() {
  lcd.setCursor(0, 1);
  lcd.print("Uptime: ");
  lcd.print(millis() / 1000);
  lcd.print(" s   ");
  delay(250);
}

What to try

Read the message on the LCD, and watch the uptime count up on the second row.

Frequently asked questions

How do I wire the 16x2 LCD Hello World project on an Arduino Uno?

Make 11 connections: Arduino Uno pin 12 to 16x2 LCD RS; Arduino Uno pin 11 to 16x2 LCD E; Arduino Uno pin 5 to 16x2 LCD D4; Arduino Uno pin 4 to 16x2 LCD D5; Arduino Uno pin 3 to 16x2 LCD D6; Arduino Uno pin 2 to 16x2 LCD D7; Arduino Uno GND to 16x2 LCD RW; Arduino Uno GND to 16x2 LCD VSS; Arduino Uno GND to 16x2 LCD K; Arduino Uno 5V to 16x2 LCD VDD; Arduino Uno 5V to 16x2 LCD A.

What parts do I need for this Arduino project?

An Arduino Uno and a 16x2 LCD.

Can I simulate this Arduino project online for free?

Yes. The BitForBytes Embedded Lab runs this exact circuit and Arduino C++ code in your browser for free, with no install and no hardware. The sketch is compiled with the real Arduino toolchain and runs on an emulated ATmega328P.

What does the code do?

A character LCD in 4-bit mode via the LiquidCrystal library, with a live seconds counter.

More Arduino Uno projects