<- Back to Projects

WaveDisp

Interactive control dashboard and rendering engine for Raspberry Pi LED matrix displays.

PythonReactFastAPIRaspberry PiHardware

WaveDisp

A 64 × 64 RGB LED matrix you control from any browser: clocks, animations, pixel art, QR codes and Spotify album art, rendered on a Raspberry Pi Zero 2 W.

License: MITPythonFastAPIReactViteRaspberry PiSpotify
WaveDisp dashboard in the light theme: display mode buttons, clock settings, a live preview of the matrix showing the time, and the preset memory bank
The dashboard, with the live preview mirroring the panel in real time.
4,096
RGB LEDs, 64 × 64
12
Display modes
<1%
Render CPU for a clock
10
Preset slots

Twelve Display Modes

Clock, stopwatch, matrix rain, Game of Life, Bad Apple, QR codes, a drawing canvas, Spotify album art and more, switched with a smooth fade.

Live Preview

The dashboard streams the panel’s framebuffer back as MJPEG, so you see exactly what the LEDs show from anywhere on the network.

Presets & Schedules

Ten named preset slots, recalled instantly or on a weekly schedule, such as a bright clock at 08:00 and lights out at 23:00.

Pixel-Art Canvas

Draw straight onto the matrix from a phone or laptop. Strokes are batched and streamed to the panel as you paint.

Built for a 512 MB Pi

Two processes, shared-memory hand-off and frame skipping keep a Pi Zero 2 W cool and responsive, driving the panel through hzeller/rpi-rgb-led-matrix.

Safe by Default

Every setting is validated before it reaches the renderer, the Spotify secret never leaves the device, and cross-site requests can’t drive it.

Overview

WaveDisp turns a Waveshare P2.5 64 × 64 HUB75 panel and a Raspberry Pi Zero 2 W into a network-connected display. A FastAPI backend owns the configuration and drives the panel; a React dashboard, served by the same backend, lets any device on the network change modes, tune colours and layouts, draw pixel art, and manage presets. Everything is also available over a small REST API, so the display can be scripted from Home Assistant or curl.

Display Modes

Every image below comes straight out of WaveDisp’s own renderer: the exact 64 × 64 frame it sends to the panel, drawn as an LED grid.

Clock mode: large stacked hours and minutes in yellow and pink
Clock · custom fonts & layouts
Clock mode with milliseconds shown below the time
Clock · with milliseconds
Stopwatch mode showing 12 minutes 34.381 seconds
Stopwatch · start, stop, reset
Matrix rain mode: green falling streaks with white heads
Matrix Rain · colour & speed
Conway's Game of Life in cyan
Game of Life · self-reseeding
A frame of the Bad Apple shadow-art animation in black and white
Bad Apple · 30 fps, 1-bit
A scannable QR code filling the panel
QR Code · URLs, Wi-Fi, vCards
Drawing canvas: a pink pixel-art heart above a blue wave
Drawing Canvas · paint from any device
Animated smiley face with blinking eyes
Smiley · blinks & glances
Yellow warning triangle with an exclamation mark
Warning · strobing sign

Rounding it out are Spotify (the album art of whatever is playing, fetched through the Spotify Web API with OAuth), a full-panel colour-cycling Alarm, and Off.

The Dashboard

The dashboard is a single-page React app with a bold, high-contrast look and fully themeable light and dark palettes. Each mode gets its own settings panel, and changes show up on the panel almost instantly.

Dark theme dashboard in matrix rain mode with colour and fall speed settings
Dark theme · matrix rain, colour and fall speed
Drawing canvas in the dashboard with a heart and wave mirrored on the live preview
Drawing canvas · paint pixels, see them on the panel
QR code settings with payload builder, error correction and colours
QR codes · payload builder, error correction, Micro QR
Bad Apple playback with invert option and the live preview showing a silhouette frame
Bad Apple · 6,572 frames packed into 3.4 MB
Ten named preset slots with save and load buttons, and weekly schedules that load presets at set times
Presets & schedules · ten slots, weekly timers
Dashboard on a phone showing the display mode buttons and brightness slider
On a phone · modes
Dashboard on a phone showing the live preview of the smiley mode and the presets list
On a phone · live preview

How It Works

Architecture diagram: the browser talks to a FastAPI main process holding the StateStore, scheduler, Spotify poller and watchdog; settings snapshots flow to a separate render process through shared memory and rendered frames flow back for the live preview; the render process drives the LED panel through the hzeller driver
  • Two processes, one writer. The FastAPI process owns all configuration. The API, the scheduler and the Spotify poller all go through a single StateStore, which validates each change, bumps a version number, and publishes a snapshot to the render process through shared memory. The renderer only ever reads, so it never waits on a lock or a network call.
  • Frame skipping. Every display mode reports a small frame key that changes only when its picture would. If neither the key nor the settings changed, the frame is skipped entirely; the LED driver’s own real-time thread keeps refreshing the panel. A plain clock redraws once per second instead of 120 times.
  • Cached glyphs. Rendered text is cached as alpha masks and pasted, so a clock frame renders in about 0.4 ms on the Pi instead of 14 ms, with output verified pixel-identical to drawing the text directly.
  • Fades that actually fade. The driver applies brightness as pixels are written, so mode transitions ramp brightness across real frames rather than adjusting a value the panel never sees.
  • Supervised. A failing frame is logged and blanked instead of crashing the renderer. If the render process does die, the whole service exits so systemd restarts it. On shutdown, the panel is cleared.

Performance on a Pi Zero 2 W

Measured on the device, with the same configuration before and after the rendering pipeline rework:

Metric Before After
Render thread CPU, clock mode 75% 0.8%
Clock frame render time 13.8 ms 0.42 ms
Full drawing canvas render time 29 ms 0.06 ms
Matrix rain render time 4.9 ms 1.5 ms
Python processes / memory (RSS) 3 / 211 MB 2 / 148 MB

The LED driver’s refresh thread, which bit-bangs the panel and runs at real-time priority, is unaffected and still uses most of one core by design. Everything WaveDisp adds on top now sits near idle.

Reliability & Security

  • Validated configuration. Every write is checked against a strict Pydantic schema with ranges, enums and safe font file names. Invalid input is rejected with a 422 before it can reach the renderer, and a stale or hand-edited config file falls back to defaults key by key instead of failing to boot.
  • SD-card friendly. Saves are debounced and atomic (temp file, fsync, rename), so a burst of slider changes becomes one write, and pulling the plug can’t corrupt the config.
  • No secrets over the wire. The Spotify client secret is stored on the device but never returned by the API.
  • No drive-by control. Browser requests that change state are only accepted from the dashboard’s own origin, so a web page you happen to visit can’t drive the display. Scripts and Home Assistant are unaffected.
  • Tested. A pytest suite covers config validation, presets, the API and the render loop (frame skipping, fades, error recovery) through a built-in hardware emulator, so it runs on any machine.

Technology Stack

Frontend

  • Framework: React 19 / Vite 8
  • Styling: Vanilla CSS with custom properties, with user-editable light and dark palettes.
  • Icons: lucide-react

Backend

  • Server: FastAPI and Uvicorn
  • Validation: Pydantic v2 (backend/config.py)
  • Rendering: Pillow and NumPy, with a shared-memory hand-off to the render process (backend/channels.py)
  • Integrations: Spotipy (Spotify Web API), Segno (QR codes)

Hardware & Deployment

  • Target: Raspberry Pi Zero 2 W, Waveshare P2.5 64 × 64 HUB75 panel, and an Adafruit RGB Matrix Bonnet or compatible wiring.
  • Driver: hzeller/rpi-rgb-led-matrix Python bindings.
  • Deployment: deploy.sh builds the dashboard, syncs it to the Pi over SSH and installs a systemd service, without ever overwriting the device’s own config or Spotify tokens.
  • HTTPS: Optional, via WAVEDISP_USE_HTTPS and your own certificate.

Try It Without a Pi

The renderer can run against a built-in emulator, with the dashboard’s live preview standing in for the panel:

git clone https://github.com/nicx17/wavedisp && cd wavedisp
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
npm --prefix dashboard install && npm --prefix dashboard run build
WAVEDISP_EMULATE_MATRIX=true python backend/main.py
# then open http://localhost:5000