LCD 128x64 ST7920 (serial mode) with ESP32

Supply 5 V Bus SPI
GNDVCCV0RSR/WEDB0DB1DB2DB3DB4DB5DB6DB7PSBNCRSTVOUTBLABLK

Pins and ESP32 wiring

PinRoleESP32 pinNotes
GNDGroundGND
VCCPowerVIN5 V: use VIN
V0Not wired to the ESP32—Contrast. Many boards have a trimmer on the back instead
RSSPI chip selectD5Serial mode: chip select (CS), active HIGH
R/WSPI MOSID23Serial mode: data in (SID). A level shifter to 5 V makes it reliable
ESPI clockD18Serial mode: clock (SCLK)
DB0Not wired to the ESP32—Parallel mode only
DB1Not wired to the ESP32—Parallel mode only
DB2Not wired to the ESP32—Parallel mode only
DB3Not wired to the ESP32—Parallel mode only
DB4Not wired to the ESP32—Parallel mode only
DB5Not wired to the ESP32—Parallel mode only
DB6Not wired to the ESP32—Parallel mode only
DB7Not wired to the ESP32—Parallel mode only
PSBGroundGNDLOW selects serial mode: connect to GND
NCNot wired to the ESP32—Not connected
RSTInput (the ESP32 drives it)D25Reset, active LOW. Can also be tied HIGH
VOUTNot wired to the ESP32—Contrast voltage output. Leave unconnected
BLANot wired to the ESP32—Backlight anode: to 5 V
BLKNot wired to the ESP32—Backlight cathode: to GND

Suggested wiring for the 30-pin ESP32 DevKit, avoiding flash, input-only and strapping pins. BoardPilot checks it for you as you wire.

This module is sold for 5 V. Its outputs may be 5 V: use a level shifter or a voltage divider on ESP32 inputs.

Starter code (Arduino)

void setup() { pinMode(25, OUTPUT); }  // RST

void loop() {
  digitalWrite(25, HIGH);
  delay(500);
  digitalWrite(25, LOW);
  delay(500);
}

Sources

Try it in 3D in BoardPilot

BoardPilot Part data (JSON)

Related parts

Part data: CC BY 4.0, free to reuse with credit to BoardPilot.