Architecture¶
splanc turns a phone and an addressable-LED fixture into a 3D scanner, then a live effects console. This page is the map of the whole system: the components, the data that flows between them, and the geometry problem at the center of it.
For the durable, decision-level treatment see the design spec; for how to build and run each piece see Developing splanc.
The two halves (and the third)¶
There are two major components — the PWA you point at the fixture, and the firmware on the controller — plus the shared wire protocol, the Rust solver, and the original Raspberry Pi path that the design grew out of.
flowchart LR
subgraph Phone["📱 Phone — the PWA (web/)"]
cam["Camera + IMU<br/>(getUserMedia + DeviceMotion)"]
cv["CV pipeline<br/>detect · track · decode"]
editor["Effects editor<br/>+ in-browser VM preview"]
cam --> cv
end
subgraph Ctrl["🔌 Controller — firmware (firmware/)"]
pat["Hue-code pattern<br/>generator"]
leds["WS2812 LEDs<br/>(PARLIO + GDMA)"]
vm["Effects VM<br/>(fx_vm)"]
wss["Control server<br/>wss:// + BLE"]
pat --> leds
vm --> leds
wss --> vm
end
pat -. "coded light" .-> cam
cv -- "detection records (wss)" --> wss
editor -- ".fxb bytecode + uniforms (wss)" --> wss
solve["Solver<br/>(reconstruction / VIO)"]
cv --> solve
solve -- "per-LED xyz map" --> editor
Coded light leaves the fixture, the phone’s camera sees it, the CV pipeline decodes which blink belongs to which LED, and a solver turns those 2D observations across many viewpoints into a 3D position for every LED. That map then drives the effects editor, whose compiled effects stream back to the controller to play across the fixture’s true shape.
Coordinate frame. Everything lives in the WebXR session reference space: right-handed, +Y up, meters, origin fixed where the capture started. It is arbitrary but consistent within one capture; re-anchoring to a fixture-local frame is a post-processing convenience.
Capture → map → effects, end to end¶
sequenceDiagram
autonumber
participant U as User
participant P as PWA (phone)
participant F as Firmware (controller)
participant S as Solver
U->>P: Start mapping session
P->>F: start_mapping (wss)
F->>F: Drive Gray-code hue pattern on LEDs
loop Each camera frame
P->>P: Grab frame + IMU pose
P->>P: threshold → CCL → track → decode
end
P->>S: Batched detection records
S->>S: Triangulate → bundle-adjust → reject outliers
S-->>P: OutputMap (per-LED xyz + quality)
U->>P: Clean up topology, author an effect
P->>P: Compile effect → .fxb
P->>F: Upload .fxb + uniforms (wss)
F->>F: Run effect on the fx_vm across the real geometry
The fixtures splanc maps¶
A “fixture” is however you mounted your LEDs — a line, a grid, a sculpture, a
tree. The synthetic simulator models the canonical
shapes the reconstruction has to recover; these are rendered straight from
shared/simulator:
The four built-in ground-truth fixtures (line, grid, cube, helix) — the
known geometries the solver is tested against.¶
How a map is recovered¶
During a capture the phone walks a slow arc around the lit fixture. Each frame contributes a camera pose and a set of 2D LED detections; parallax between views is what makes the depth solvable.
A synthetic capture walk: the camera (viewpoints in orange) arcs around a helix fixture, each pose observing the LEDs from a slightly different angle.¶
The reconstruction then triangulates each LED from its observations, refines all positions jointly with a robust (Huber) bundle adjustment, and rejects outliers. Run against synthetic ground truth we can measure exactly how well it recovers the shape:
Ground truth (hollow) vs the reconstructed positions (filled, colored by error)
for a helix, produced by running shared/simulator through
pi/reconstruction. The tight overlay is the whole point: sub-centimeter
recovery from a phone walk-around.¶
Note
Every figure and animation on this page is regenerated by bazel run //docs:build, which runs the real simulator → reconstruction code path
before building the site. Nothing here is hand-drawn or stale. See how the docs are built.
The effects path¶
Once a map exists, effects are authored in a GLSL-ish language, compiled to
compact .fxb bytecode, and run by a tiny stack VM — the same VM in three
places: on the ESP32-C6, as wasm in the browser preview, and in the host tests.
flowchart LR
src["effect source<br/>(.fx, GLSL-ish)"]
comp["fx_compiler<br/>(single-pass → .fxb)"]
fxb[".fxb container<br/>bytecode + uniform manifest"]
subgraph vm["fx_vm — one VM, three hosts"]
c6["ESP32-C6<br/>(on device)"]
wasm["wasm<br/>(browser preview)"]
host["host<br/>(golden tests)"]
end
map["per-LED xyz map"]
src --> comp --> fxb --> vm
map --> vm
vm --> out["per-LED RGB<br/>every frame"]
The compiler and VM are covered in depth in The splanc effects engine, with the design rationale in Design: Effects runtime (bytecode VM + language) and Design: Effects compiler (editor + wasm compile + AI generation), and measured on-device numbers in FX-VM performance.
The agent path¶
The same control protocol that the app speaks is also the interface for AI
agents. The agent/ hub is an MCP server and CLI. It finds every player on the
LAN (mDNS _splanc._tcp, then each player’s /.well-known/splanc.json
manifest), compiles and previews effects with the toolchain matching each
player’s firmware, checks frame budgets, and deploys across the whole room. Each
fixture has a pose in a shared room frame (led.room), and every player gets
one time base, so a single effect spans several fixtures in step.
flowchart LR
a["AI agent"] -- "MCP / CLI" --> hub["agent hub<br/>(agent/)"]
hub -- "mDNS + manifest" --> d1["player 1"]
hub -- "mDNS + manifest" --> d2["player 2"]
hub -- "wss: .fxb · uniforms ·<br/>pose · time base" --> d1
hub -- "wss" --> d2
The device stays thin (render, persist, advertise) and the intelligence lives in the bridge; The agent bridge (agent/) has the details and The Splanc manifesto the reasoning.
Agents that run in the cloud can’t see the LAN. For them, splanc-agent bridge
runs the same hub on an always-on LAN host and keeps an outbound WebSocket to
the cloud relay (a Cloudflare Worker with one Durable Object per bridge), which
exposes it as a remote MCP server that pairs with a code shown on the bridge.
See Cloud relay + LAN bridge and Use Splanc from a cloud agent.
Where to go next¶
Subsystems — a per-component tour with entry points and build targets.
Developing splanc — build, test, and run the pipeline (with or without hardware).
LED Mapper — Design Doc (Android-first) — the full design spec and module breakdown.
The Splanc manifesto — why the system is built the way it is.