docs/adr/ADR-059-live-esp32-csi-pipeline.md
Accepted
2026-03-12
ADR-058 established a dual-modal browser demo combining webcam video and WiFi CSI for pose estimation. However, it used simulated CSI data. To demonstrate real-world capability, we need an end-to-end pipeline from physical ESP32 hardware through to the browser visualization.
The ESP32-S3 firmware (firmware/esp32-csi-node/) already supports CSI collection and UDP streaming (ADR-018). The sensing server (wifi-densepose-sensing-server) already supports UDP ingestion and WebSocket bridging. The missing piece was connecting these components and enabling the browser demo to consume live data.
Implement a complete live CSI pipeline:
ESP32-S3 (CSI capture) → UDP:5005 → sensing-server (Rust/Axum) → WS:8765 → browser demo
ESP32 Firmware — Rebuilt with native Windows ESP-IDF v5.4.0 toolchain (no Docker). Configured for target network and PC IP via sdkconfig. Helper scripts added:
build_firmware.ps1 — Sets up IDF environment, cleans, builds, and flashesread_serial.ps1 — Serial monitor with DTR/RTS reset capabilitySensing Server — wifi-densepose-sensing-server started with:
--source esp32 — Expect real ESP32 UDP frames--bind-addr 0.0.0.0 — Accept connections from any interface--ui-path <path> — Serve the demo UI via HTTPBrowser Demo — main.js updated to auto-connect to ws://localhost:8765/ws/sensing on page load. Falls back to simulated CSI if the WebSocket is unavailable (GitHub Pages).
The ESP32 sends UDP packets to a configured target IP. If the PC's IP doesn't match the firmware's compiled target, a secondary IP alias can be added:
# PowerShell (Admin)
New-NetIPAddress -IPAddress 192.168.1.100 -PrefixLength 24 -InterfaceAlias "Wi-Fi"
| Stage | Protocol | Format | Rate |
|---|---|---|---|
| ESP32 → Server | UDP | ADR-018 binary frame (magic 0xC5110001, I/Q pairs) | ~100 Hz |
| Server → Browser | WebSocket | ADR-018 binary frame (forwarded) | ~10 Hz (tick-ms=100) |
| Browser decode | JavaScript | Float32 amplitude/phase arrays | Per frame |
ESP-IDF v5.4.0 on Windows requires:
idf.py executionThe build_firmware.ps1 script handles all of this automatically.