How to Display Text on 16x2 LCD with Raspberry Pi Pico in Wokwi - Complete Step-by-Step Guide

16x2 LCD Display with Raspberry Pi Pico on Wokwi | MakeMindz
🖥 Part of the 20 Raspberry Pi Pico Projects series — View all on MakeMindz →
Project 5 · Beginner
🖥 Display Project · 4-bit Parallel Mode

How to Display Text on a 16×2 LCD with Raspberry Pi Pico on Wokwi

✅ Beginner 📅 February 2026 ⏱ 12 min read 🛠 HD44780 · LiquidCrystal

Interface a 16×2 character LCD (HD44780) with Raspberry Pi Pico using 4-bit parallel mode — no hardware needed, entirely in Wokwi. Includes full diagram.json, complete wiring tables, Arduino C++ code with the LiquidCrystal library, and a live simulation link.

Launch Live Simulation on Wokwi

What This Project Demonstrates

The HD44780-compatible 16×2 LCD is one of the most widely used displays in embedded systems — found in coffee machines, industrial panels, and DIY electronics. This tutorial drives it from a Raspberry Pi Pico using 4-bit parallel mode, reducing required GPIO pins from 11 down to just 6.

📡LCD parallel interface
📟Raspberry Pi Pico GPIO
📦LiquidCrystal library
🖥Wokwi simulation
✏️Text & cursor control
🔆Backlight & contrast

Understanding the 16×2 LCD Display

The 16×2 LCD has 2 rows and 16 character columns — 32 total character positions. It uses the HD44780 controller, which is natively supported by Arduino's built-in LiquidCrystal library. The display has 16 pins.

LCD Output Preview
H e l l o   W o r l d !      
    >   P i   P i c o   <  

Row 1: "Hello World!" at position (col 0, row 0) · Row 2: "> Pi Pico <" at position (col 2, row 1)

All 16 LCD Pins Explained

PinSymbolFunctionDescription
1VSSGroundPower ground (0V)
2VDDPower+3.3V or +5V supply
3V0 / VEEContrastContrast voltage via potentiometer
4RSRegister SelectLOW = command, HIGH = data
5RWRead / WriteLOW = write — always ground for write-only use
6EEnableRising edge triggers read/write
7–10D0–D3Data (low nibble)Not used in 4-bit mode
11D4Data bit 44-bit bus, bit 0
12D5Data bit 54-bit bus, bit 1
13D6Data bit 64-bit bus, bit 2
14D7Data bit 74-bit bus, bit 3
15A / LED+Backlight +Backlight anode (via 220Ω resistor)
16K / LED−Backlight −Backlight cathode (GND)

4-bit vs 8-bit Mode

8-bit Mode

Uses all 8 data pins (D0–D7). Faster transfers but needs 11 GPIO pins total — not practical on most projects.

4-bit Mode Used Here

Uses only D4–D7, sending data in two nibbles. Saves 4 GPIO pins with negligible speed difference.


Step-by-Step Wokwi Setup

  1. 1

    Create a New Raspberry Pi Pico Project

    Open wokwi.com, click "New Project" and select "Raspberry Pi Pico". This tutorial uses the Arduino/C++ environment, which is activated automatically via the env: arduino-community attribute in the diagram.json below.

  2. 2

    Add the 16×2 LCD Display

    Click the blue "+" button, search for "LCD 16x2" or "LCD1602", and place it above the Pico. The LCD in Wokwi is pre-configured with the HD44780 controller — no additional setup needed.

  3. 3

    Add a 220Ω Resistor for the Backlight

    Click "+", search for "Resistor", add it, and set its value to 220 in the attributes panel. This protects the LED backlight from excess current.

    💡

    If you skip the potentiometer, connect LCD Pin 3 (V0) directly to GND for maximum contrast. In the diagram.json below, Wokwi handles contrast automatically.

  4. 4

    Wire Power, Ground and RW

    LCD PinNamePico PinWire Color
    1VSS — GNDGND.1Black
    2VDD — PowerVSYSRed
    5RW — Read/WriteGND.1Black
    15A / LED+220Ω → VSYSPink
    16K / LED−GND.1Black
    ⚠️

    Always ground RW. Leaving it floating causes erratic LCD behavior. Since we only write to the display, permanently grounding RW is the correct approach.

  5. 5

    Wire the Control Pins (RS and E)

    LCD PinSymbolPico GPIOWire ColorPurpose
    4RSGP12BlueRegister Select — data vs command
    6EGP11PurpleEnable — clocks data into LCD
  6. 6

    Wire the 4-bit Data Bus (D4–D7 only)

    D0–D3 are left unconnected in 4-bit mode.

    LCD PinSymbolPico GPIOWire Color
    11D4GP10Green
    12D5GP9Brown
    13D6GP8Gold
    14D7GP7Gray

    LiquidCrystal constructor order: LiquidCrystal lcd(12, 11, 10, 9, 8, 7) maps to RS, E, D4, D5, D6, D7. The order must exactly match your GPIO connections.

  7. 7

    GPIO Pin Summary

    All 6 GPIO connections at a glance:

    GP12RS
    GP11E (Enable)
    GP10D4
    GP9D5
    GP8D6
    GP7D7
  8. 8

    Run the Simulation

    Paste the code below into the Wokwi code editor, then press ▶ Play. The LCD will show "Hello World!" on row 1 and "> Pi Pico <" offset on row 2 — immediately.


diagram.json — Complete Circuit

Paste this into the diagram.json tab in Wokwi to instantly load the full wired circuit — Pico rotated 90°, LCD1602, and 220Ω backlight resistor, all pre-connected.

JSON — diagram.json
{
  "version": 1,
  "author": "Uri Shaked",
  "editor": "wokwi",
  "parts": [
    {
      "type": "wokwi-pi-pico",
      "id": "pico",
      "top": 123.67,
      "left": 135.97,
      "rotate": 90,
      "hide": false,
      "attrs": { "env": "arduino-community" }
    },
    {
      "type": "wokwi-lcd1602",
      "id": "lcd",
      "top": -17.85,
      "left": 22.03,
      "rotate": 0,
      "hide": false,
      "attrs": {}
    },
    {
      "type": "wokwi-resistor",
      "id": "r1",
      "top": 114.8,
      "left": 226.31,
      "rotate": 0,
      "hide": false,
      "attrs": { "value": "220" }
    }
  ],
  "connections": [
    // ── Power & ground ──────────────────────
    [ "pico:GND.1", "lcd:VSS", "black",
        [ "v-51", "*", "h0", "v18" ] ],
    [ "pico:GND.1", "lcd:K",   "black",
        [ "v-51", "*", "h0", "v18" ] ],
    [ "pico:GND.1", "lcd:RW",  "black",
        [ "v-51", "*", "h0", "v18" ] ],
    [ "pico:VSYS",  "lcd:VDD", "red",
        [ "v16", "h-16" ] ],
    // ── Backlight via 220Ω resistor ──────────
    [ "pico:VSYS",  "r1:2",    "red",   [ "v16", "h0" ] ],
    [ "r1:1",       "lcd:A",   "pink",  [] ],
    // ── Control signals ──────────────────────
    [ "pico:GP12",  "lcd:RS",  "blue",
        [ "v-16", "*", "h0", "v20" ] ],
    [ "pico:GP11",  "lcd:E",   "purple",
        [ "v-20", "*", "h0", "v20" ] ],
    // ── 4-bit data bus ───────────────────────
    [ "pico:GP10",  "lcd:D4", "green",
        [ "v-24", "*", "h0", "v20" ] ],
    [ "pico:GP9",   "lcd:D5", "brown",
        [ "v-28", "*", "h0", "v20" ] ],
    [ "pico:GP8",   "lcd:D6", "gold",
        [ "v-32", "*", "h0", "v20" ] ],
    [ "pico:GP7",   "lcd:D7", "gray",
        [ "v-36", "*", "h0", "v20" ] ]
  ]
}

How to use: In Wokwi, click the diagram.json tab, select all text, and paste. The complete circuit loads instantly — no manual wiring needed.


Arduino C++ — LCD Display Program

Uses Arduino's built-in LiquidCrystal library — no extra installation required. Constructor: LiquidCrystal(RS, E, D4, D5, D6, D7).

Arduino C++ — sketch.ino
// 16x2 LCD Display with Raspberry Pi Pico
// MakeMindz.com — Project 5 of 20
// 4-bit parallel mode via LiquidCrystal library

#include <LiquidCrystal.h>

// Pins: RS=GP12, E=GP11, D4=GP10, D5=GP9, D6=GP8, D7=GP7
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);

void setup() {
  lcd.begin(16, 2);          // 16 columns, 2 rows

  // Row 1 — cursor starts at (col 0, row 0) by default
  lcd.print("Hello World!");

  // Row 2 — setCursor(column, row): 0-indexed
  lcd.setCursor(2, 1);       // column 2, row 1
  lcd.print("> Pi Pico <");
}

void loop() {
  delay(1);  // Improves Wokwi simulation speed
}
📌

setCursor(col, row): Columns are 0–15, rows are 0–1. setCursor(2, 1) places the cursor at the 3rd character of the 2nd row. Use this to precisely position any text.

🚀

Extend it: Add lcd.scrollDisplayLeft() inside loop() with a 300ms delay for a scrolling ticker effect!


All 20 Raspberry Pi Pico Projects

This tutorial is part of a complete series. Work through them progressively — beginner to advanced.

Comments

try for free