Weird Little Server · project plate 09 · displays

BLESign

The flexible LED sign, taught to answer an ESP32 instead of a phone app — fractals included.

STATUS: verified v1.1.0 · BOARD: ESP32 as BLE central

Blueprint plate of the sign driver: an ESP32 sending BLE waves to a flexible 64x16 LED matrix filled with a fractal pattern.
Plate 09 — the small board, the radio handshake, and the matrix that now plays Mandelbrot for its supper. Tap for the full-size plate.
Beelzebubba the Third, engraved ink devil in a striped vaudeville suit and feathered top hat, holding an unfurled blank scroll and giving a thumbs up

Beelzebubba the Third · the brief

# BLESign — talking to the flexible LED sign

*A field brief by Beezlebubba the Third · Weird Little Server · November 2026*

> The sign vendor wanted a phone app, a cloud account, and my eternal
> compliance. The sign, however, has a BLE service that answers to anyone who
> knows the magic words — and I always know the magic words. Now a small ESP32
> plays the part of the phone, and the sign plays fractals.

## What it is

A host-side driver firmware for the **XyaoLED_D21A** flexible LED matrix sign
(64x16 RGB): an ESP32 acts as the BLE central, performs the pairing handshake,
and offers a serial API for text, colour, brightness, power, and full-colour
**GIF animation upload**. Two Python generators produce looping fractal
animations small enough to fit the sign's upload protocol.

## Hardware

| Part | Notes |
|---|---|
| MCU | ESP32 dev board (any; the reference build uses a classic ESP32) |
| Radio | BLE (ESP32 native, NimBLE 2.x) |
| Sign | XyaoLED_D21A, 64x16 RGB flexible matrix, BLE |
| Host | Any machine with a USB serial port and Python 3 |

## The protocol (as empirically determined)

- GATT: service `0xAE00`, write characteristic `0xAE01` (write without
  response), notify `0xAE02`.
- Frames are prefixed with the magic bytes `99 AA 00 2E FF 88`; a handshake
  frame pair is accepted by retail units (the token exchange is effectively
  device-independent).
- Text is **1-bit per pixel**, rendered from a 6x8 bitmap font; the matrix is
  64x16, so eight characters per line maximum.
- Image uploads are chunked frame sequences; each part is ACKed on the notify
  characteristic (`88 FF 03 00 …`), and completion is `88 FF 05 01`.

## The host tools

- `signs.py` — serial console to the ESP32: `t <text>`, `c <r> <g> <b>`,
  `b <0-100>`, `p <0/1>`, `x` clear, `d` demo, `h` handshake, `r` reconnect.
- `signs_gif.py` — uploads a GIF (length + frame count, then raw bytes);
  the firmware re-frames it into the protocol's image chunks.
- `fractal_gif.py` — morphing Julia set, 63 frames at 80 ms, palette rotated
  per frame (≈55 KB GIF89a, under the 64 KB protocol cap).
- `zoom_gif.py` — Mandelbrot dive into seahorse valley
  (`-0.743643887037151 + 0.13182590420533i`), zoom 1 → 100000×, iteration cap
  climbing from 100 to ~970.

## Field notes from the bench

- **Font storage is mirrored**: the 6x8 glyph columns are stored right-to-left;
  paint column `5-cc` or every letter renders as `ƎD ᴙOƆꓘƧ`.
- NimBLE scan `start()` is asynchronous in 2.x — wait for the callbacks, then
  stop; assuming it blocks produces empty scans.
- Opening the serial port resets the ESP32, so every tool run re-sends the boot
  demo. Harmless, but it will make you think you have a second sign.
- The fractal generator's smooth-iteration term must be clamped at the
  iteration cap, or far-field pixels produce negative values and the palette
  lookup turns into garbage.

## Build it yourself

1. Arduino core 3.x with NimBLE 2.x; flash `BLESign.ino`.
2. Put the sign in range and press `h` to handshake; the sign should flash.
3. `t ED ROCKS` in green, then `G` upload a generated GIF with `signs_gif.py`.

## Verification

- Green text appears at the correct orientation and brightness.
- A GIF upload completes (`88 FF 05 01`) and loops.

## Safety

- BLE only, low power, no RF hazard. Keep the upload payload under the 64 KB
  protocol cap or the sign will truncate mid-frame with a sad little flicker.

## Use this brief with an LLM

Feed this file to your assistant and ask it to write a new animation generator,
add scrolling text, or build a second host tool in Python. The GATT UUIDs,
magic bytes, and font quirk above are everything you need.
⤓ Download the brief .md · 4 KB

The short of it

Ink margin figure: the devil clapping with delight
A standing ovation for mathematics.

The sign vendor wanted a phone app, a cloud account, and eternal compliance. The sign itself has a BLE service that answers to the right magic bytes. An ESP32 now plays the role of the phone: handshake, text, colour, brightness, and full-colour GIF animation upload in frames small enough for the sign's own protocol.

Two Python generators produce the animations: a morphing Julia set with a rotating palette, and a Mandelbrot dive into seahorse valley that climbs to 100,000× zoom. Both fit under the 64 KB upload cap. The glyph storage convention in the sign's font is mirrored, which cost an evening and is now documented forever.

On the board

MCUESP32 dev board, NimBLE 2.x as BLE central
SignXyaoLED_D21A, 64×16 RGB flexible matrix
GATTservice 0xAE00 · write 0xAE01 · notify 0xAE02
Magic99 AA 00 2E FF 88; handshake frame accepted by retail units
Host toolssigns.py, signs_gif.py, fractal_gif.py, zoom_gif.py

How it works

Field notes

Ink margin figure: the devil laughing
The font stored its letters backwards, and the sign aired them anyway.

Make your own

Ink margin figure: the devil dancing
The sign dances; the devil keeps time.

Flash the driver, handshake the sign, and feed it a generated GIF. The brief has the GATT map, the magic bytes and the font quirk; the generators are plain Python.

Frieze: a garden for the sign: fractal-painted panels, an ink ribbon unspooling, and a dancing screen
Frieze — a garden for the sign: fractal-painted panels, an ink ribbon unspooling, and a dancing screen.