16×2 LCD Display with
Text Output using Arduino Uno
Learn to wire, code, and display real-time text on an LCD — a must-have skill for every Arduino project.
Run Free Simulation on WokwiWhat is a 16×2 LCD Display?
LCD stands for Liquid Crystal Display. The "16×2" means 16 characters per row across 2 rows — giving you 32 characters total on screen at once.
Key Facts
Displays up to 32 characters simultaneously
Industry-standard LCD driver IC used in most Arduino LCD modules
4-bit mode saves Arduino pins — we use 4 data wires instead of 8
Components Required
No physical parts? No problem! Use the free Wokwi simulation — all components are virtual and ready to go.
Step-by-Step Wiring Guide
Connect LCD VSS → Arduino GND (black wire) and VDD → Arduino 5V (red wire).
Connect the 10kΩ potentiometer: outer pins to 5V and GND, middle wiper pin to LCD V0. Twist the pot to adjust contrast until characters appear clearly.
Wire RS → Pin 12 (blue), RW → GND (write-only mode), and E → Pin 11 (yellow).
Connect only D4–D7 (skip D0–D3): D4 → Pin 5, D5 → Pin 4, D6 → Pin 3, D7 → Pin 2.
Wire A (LED+) → 5V via 220Ω resistor (red) and K (LED−) → GND (black). The 220Ω resistor limits current to protect the backlight.
Pin Connection Table
Wokwi diagram.json
Paste this into the diagram.json tab in Wokwi. It auto-places the Arduino Uno and 16×2 LCD, and wires all 12 connections for you — including power, contrast (V0 → GND for fixed maximum contrast in simulation), control pins, data pins, and backlight.
wokwi.com → New Project → Arduino Uno2. Click the
diagram.json tab3. Select all existing text and replace with the JSON below
4. The LCD will appear pre-wired and ready to run!
{
"version": 1,
"author": "Wokwi LCD Demo",
"editor": "wokwi",
"parts": [
{
"type": "wokwi-arduino-uno",
"id": "uno",
"top": 183,
"left": -192.6,
"attrs": {}
},
{
"type": "wokwi-lcd1602",
"id": "lcd1",
"top": -150.17,
"left": -118.4,
"attrs": {}
}
],
"connections": [
// Power
[ "lcd1:VSS", "uno:GND.1", "black", [ "v0" ] ],
[ "lcd1:VDD", "uno:5V", "red", [ "v0" ] ],
// Contrast (V0 to GND = max contrast for simulation)
[ "lcd1:V0", "uno:GND.1", "black", [ "v0" ] ],
// Control pins
[ "lcd1:RS", "uno:12", "blue", [ "v0" ] ],
[ "lcd1:RW", "uno:GND.1", "black", [ "v0" ] ],
[ "lcd1:E", "uno:11", "yellow", [ "v0" ] ],
// Data pins (4-bit mode — D4 to D7 only)
[ "lcd1:D4", "uno:5", "orange", [ "v0" ] ],
[ "lcd1:D5", "uno:4", "purple", [ "v0" ] ],
[ "lcd1:D6", "uno:3", "gray", [ "v0" ] ],
[ "lcd1:D7", "uno:2", "white", [ "v0" ] ],
// Backlight LED
[ "lcd1:A", "uno:5V", "red", [ "v0" ] ],
[ "lcd1:K", "uno:GND.2", "black", [ "v0" ] ]
],
"dependencies": {}
}
📋 What Each Connection Does
| Connection | Purpose |
|---|---|
| lcd1:VSS → GND | LCD ground — every IC needs a ground reference |
| lcd1:VDD → 5V | Powers the LCD's logic circuits |
| lcd1:V0 → GND | Contrast control — GND gives max contrast in Wokwi (use a pot on real hardware) |
| lcd1:RS → Pin 12 | Register Select — tells LCD if data is a command or character |
| lcd1:RW → GND | Read/Write — tied LOW = write-only mode (saves a pin) |
| lcd1:E → Pin 11 | Enable — Arduino pulses this to latch each byte of data |
| lcd1:D4–D7 → Pins 5–2 | 4-bit data bus — sends display characters and commands in two nibbles |
| lcd1:A → 5V | Backlight LED anode — lights up the display |
| lcd1:K → GND | Backlight LED cathode |
Arduino Code
Copy the code below and paste it into your Arduino IDE or Wokwi's sketch.ino tab. The LiquidCrystal library is built-in — no installation needed.
/* * 16x2 LCD Display - Text Output * MakeMindz Summer Class | makemindz.com * Simulation: https://wokwi.com/projects/459549577107604481 */ #include <LiquidCrystal.h> // Initialize LCD: LiquidCrystal(rs, en, d4, d5, d6, d7) LiquidCrystal lcd(12, 11, 5, 4, 3, 2); void setup() { // Set LCD dimensions: 16 columns, 2 rows lcd.begin(16, 2); // Print on Row 1 (top row, starts at column 0) lcd.print("Hello, World!"); // Move cursor to Row 2, Column 0 lcd.setCursor(0, 1); lcd.print("Arduino LCD"); } void loop() { // Update timer on Row 2 every second lcd.setCursor(0, 1); lcd.print("Time: "); lcd.print(millis() / 1000); lcd.print("s "); // Extra spaces clear leftover digits delay(1000); }
How the Code Works
Creates the LCD object mapping Arduino pins to RS, E, D4, D5, D6, D7. Must match your wiring exactly.
Tells the library the LCD is 16 columns wide and 2 rows tall. Always call this first in setup().
Positions where the next character appears. Column 0, row 0 is the top-left corner. Row 1 is the second line.
Writes text, numbers, or variables to the LCD from the current cursor position.
Returns elapsed milliseconds ÷ 1000 = seconds. Creates a live-updating seconds counter without blocking the loop.
Expected Output
After uploading the code, your LCD should show:
The timer on row 2 counts up every second — just like your real Arduino will!
🧪 Try It in Your Browser — Free!
No Arduino or components needed. Run the full simulation instantly on Wokwi and watch the LCD display text in real time.
Open Wokwi SimulationReal-World Applications
Frequently Asked Questions
int temp = readTemperature(); — then display it with lcd.print(temp);. Numbers, floats, and strings all work with lcd.print().LiquidCrystal lcd(12, 11, 5, 4, 3, 2) match your physical wiring.LiquidCrystal_I2C library. Check the MakeMindz I2C LCD tutorial as the next step after this lesson!lcd.print() to display anything you want.🎉 Conclusion
You've learned how to interface a 16×2 LCD with Arduino Uno in 4-bit mode, apply the diagram.json for instant Wokwi wiring, write text to both rows, position the cursor, and display a live seconds counter using millis().
This foundational skill powers hundreds of real projects — from temperature displays to robot status screens. Paste the diagram.json, run the simulation, then build it on your breadboard!
Comments
Post a Comment