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
| Qty | Part | What it does |
|---|---|---|
| 1 | Arduino Uno | the microcontroller board |
| 1 | 16x2 LCD | Character 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
| # | From | To |
|---|---|---|
| 1 | Arduino Uno pin 12 | 16x2 LCD RS |
| 2 | Arduino Uno pin 11 | 16x2 LCD E |
| 3 | Arduino Uno pin 5 | 16x2 LCD D4 |
| 4 | Arduino Uno pin 4 | 16x2 LCD D5 |
| 5 | Arduino Uno pin 3 | 16x2 LCD D6 |
| 6 | Arduino Uno pin 2 | 16x2 LCD D7 |
| 7 | Arduino Uno GND | 16x2 LCD RW |
| 8 | Arduino Uno GND | 16x2 LCD VSS |
| 9 | Arduino Uno GND | 16x2 LCD K |
| 10 | Arduino Uno 5V | 16x2 LCD VDD |
| 11 | Arduino Uno 5V | 16x2 LCD A |
Step by step
- Open the simulator. Open the BitForBytes Embedded Lab in your browser and start from the Arduino Uno. No install or account is needed.
- Add the parts. Add a 16x2 LCD from the parts palette.
- Wire 1. Connect Arduino Uno pin 12 to 16x2 LCD RS.
- Wire 2. Connect Arduino Uno pin 11 to 16x2 LCD E.
- Wire 3. Connect Arduino Uno pin 5 to 16x2 LCD D4.
- Wire 4. Connect Arduino Uno pin 4 to 16x2 LCD D5.
- Wire 5. Connect Arduino Uno pin 3 to 16x2 LCD D6.
- Wire 6. Connect Arduino Uno pin 2 to 16x2 LCD D7.
- Wire 7. Connect Arduino Uno GND to 16x2 LCD RW.
- Wire 8. Connect Arduino Uno GND to 16x2 LCD VSS.
- Wire 9. Connect Arduino Uno GND to 16x2 LCD K.
- Wire 10. Connect Arduino Uno 5V to 16x2 LCD VDD.
- Wire 11. Connect Arduino Uno 5V to 16x2 LCD A.
- Paste the Arduino C++ code. Paste the Arduino C++ code below into the code editor.
- 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
- Arduino LED Blink: Wiring, Code and Simulator
- Arduino LDR Light Sensor: Wiring, Code and Simulator
- Arduino NTC Thermistor Thermometer: Wiring, Code and Simulator
- Arduino PWM to Analog RC Filter: Wiring, Code and Simulator
- Arduino Capacitance Meter: Wiring, Code and Simulator
- Arduino DC Motor PWM Speed Control with MOSFET: Wiring, Code and Simulator