- C 50%
- Python 21%
- C++ 20%
- JavaScript 6%
- CSS 2%
- 2 more languages 1%
roombox #
A voice interface for the Waveshare ESP32-S3-Touch-AMOLED-1.8 that runs on an ESP32-S3 with a 1.8" AMOLED panel, streams gated speech to a hosted ASR service, and displays the proper nouns it hears.
Not a wake-word toy and not a cloud assistant: the device decides when there is speech, sends only that, and paints what it understood. The point of interest is the proper nouns — names, places, brands — not a fixed command vocabulary.
Architecture #
ESP32-S3 Railway
┌──────────────────────┐ ┌───────────────────────┐
│ ES8311 mic 16 kHz │ │ WebSocket ASR service │
│ ↓ │ WSS, PCM frames │ ↓ │
│ VAD gate (on-device) │ ─────────────────► │ faster-whisper int8 │
│ ↓ │ │ ↓ │
│ CO5300 AMOLED 368×448│ ◄───────────────── │ text + proper nouns │
│ scope + entities │ JSON │ │
└──────────────────────┘ └───────────────────────┘
- Audio never leaves the device unless someone is speaking. The VAD is adaptive (noise floor + 12 dB trigger, 200 ms pre-roll, 500 ms hangover); idle frames are not transmitted at all.
- Proper-noun extraction runs on the device, from the transcript the service returns. No model, no heap, a few hundred microseconds.
- No laptop in the loop. The Mac is a flashing and debugging tool only.
Why the ASR is remote #
Measured on this exact board (see RESULTS.md):
| esp-nn int8 throughput | 0.18 GMAC/s with weights in SRAM, 0.057 from PSRAM |
| Practical model ceiling | ~1 M params at 50 fps |
| Whisper tiny | 39 M params — 39 MB int8 against 8 MB of PSRAM, 34× the throughput |
Open-vocabulary speech recognition is not a tuning problem here; the smallest credible model is larger than the whole PSRAM. Everything else — VAD, display, proper-noun filtering, transport — does fit, and does run locally.
Layout #
src/ device firmware (PlatformIO, Arduino)
main.cpp Wi-Fi, mic capture, VAD, WS transport, PN extraction
display.cpp CO5300 init, scope trace, big entity band
display.h
font8x8_basic.h public-domain 8x8 font
platformio.ini esp32-s3, 16 MB flash, octal PSRAM
extras/ compute/network probe firmware (not built by default)
server/ the ASR service deployed to Railway
scripts/ host-side tooling: capture, transcribe, analyse, deploy helpers
include/ secrets.h (gitignored: Wi-Fi passphrase, ASR token)
RESULTS.md every measurement taken on the hardware
Hardware #
| Board | Waveshare ESP32-S3-Touch-AMOLED-1.8 |
| SoC | ESP32-S3 rev v0.2, 2× LX7 @ 240 MHz, 16 MB flash, 8 MB octal PSRAM |
| Display | CO5300 over QSPI, 368×448, X gap 0x10 |
| Mic | analog → ES8311 ADC, I2C 0x18; I2S RX on GPIO10 |
| Display bus | CS 12, PCLK 11, D0–D3 4/5/6/7 |
| I2C | SDA 15, SCL 14 |
| Reset lines | TCA9554 expander at 0x20 (no GPIO reset on this board) |
| Battery gauge | AXP2101 at 0x34; read-only percentage at 0xA4 |
Build and flash #
cp include/secrets.h.example include/secrets.h # fill in Wi-Fi + ASR token
.venv/bin/pio run -t upload --upload-port /dev/cu.usbmodem101
The device prints to USB-Serial/JTAG (/dev/cu.usbmodem101) at 115200.
The device UI shows the AXP2101's battery percentage in the logical bottom-right
corner in every orientation, refreshed every five seconds. NO BAT means no
battery is detected; --% means the reading is unavailable/invalid (not 0%).
The display reserves a footer so entity text cannot obscure it. This is the
PMU's fuel-gauge estimate, not a voltage-derived guess. A static white lightning
bolt beside the percentage indicates actual AXP2101 charging (STATUS2[7:5] = 1,
with a battery present), not merely USB presence. It shares the five-second
poll and disappears on idle/full, discharge, missing battery, or an unavailable
status read; no periodic animation is added. No charger settings, power rails,
or calibration are changed.
Audio capture drains 50 × 20 ms frames/sec. RenderSchedule polls the UI at
2 Hz idle / 4 Hz active, with immediate redraw on a rotation change. Unchanged
quiet frames do no screen transfer. The waveform moves only when audio
exceeds the existing capture trigger (4× the adaptive RMS noise floor, about
12 dB above it, with the existing minimum floor); this is not calibrated dB SPL
and does not change audio sensitivity. It settles to a static line once quiet.
A white bottom-left dot blinks every 500 ms while capturing an utterance or
waiting/processing, using only a 12×12-pixel transfer per blink. Waiting clears
on the returned transcript or the existing four-second fallback timeout.
There is no moving ellipsis, row shifting, entity flashing, or boot colour test.
Battery, entity, and orientation changes still repaint immediately on the next
UI poll. The I2S DMA ring has 320 ms of headroom so a display flush does not
overwrite unread speech. Orientation sampling remains independent of redraws.
Serial PERF lines report actual frame rate, display time, and I2S queue-overflow
audio duration (rx_drop_ms); normal steady-state operation should show about
50 fps and zero dropped audio. This reduces screen work, but battery runtime
still needs measurement. The OLED now runs at 40% brightness and Wi-Fi uses
WIFI_PS_MIN_MODEM (wake for the access point's DTIM), with transmit power
unchanged. The codec is microphone-only (ADC mode), with the unused speaker
amplifier explicitly held off at GPIO46 LOW. Duplex I2S is retained for the
existing clock setup. Serial POWER lines confirm the selected settings.
WebSocket heartbeats run every 15 seconds to detect a stale idle link and use
the existing reconnect path. USB-powered/charging observations are not valid
battery-drain measurements.
Credentials and private data #
Keep real Wi-Fi settings and the ASR token in ignored include/secrets.h; only
include/secrets.h.example belongs in Git. The optional macOS helper
scripts/cred_from_keychain.py reads the SSID from that local file, retrieves
its password from Keychain, and writes it back without printing credentials.
It is a setup tool, not a runtime dependency.
Local .env files, private-key files, logs, pairing databases, captures, and
recorded audio are ignored. The committed WAV files under tests/fixtures/speech/
are synthetic test words, not microphone recordings. Ignore rules are a guardrail,
not secret detection: scan both the working tree and Git history before publishing.
Server #
server/ builds a container that caches the Whisper model at build time, so a
cold start never downloads weights. Deploy with the Railway CLI from server/;
ASR_TOKEN is set as a service variable and is never committed.
Scripts #
scripts/bootlog.py |
reset the device and capture the boot log |
scripts/serial_tap.py |
read the console without resetting |
scripts/bg.py |
start any script fully detached |
scripts/mic_recv.py |
receive the gated PCM stream, write a WAV |
scripts/analyze_wav.py |
level envelope, spectrum, band energy |
scripts/analyze_speech.py |
clipping and gain staging |
scripts/make_stimulus.py |
tone + log sweep reference signal |
scripts/live_ws.py |
laptop-local pipeline (superseded by server/) |
scripts/entities.py |
rule-based intents/slots (superseded by PN extraction) |
TODO #
- Adapt rendering to orientation using the onboard sensors. The board has a QMI8658 6-axis IMU on the I2C bus (address 0x6A or 0x6B; the stock firmware probes both). Read the accelerometer, work out which way up the device is, and rotate the UI to match instead of assuming portrait. This also removes the need to solve landscape as a static layout problem: the renderer would target whichever orientation the device is actually in.
Other open threads, for reference:
- Landscape needs a transpose during the framebuffer flush. Doing it with MADCTL's MV bit corrupts the image, because the driver applies the panel's 0x10 offset to the x axis regardless of the axis swap.
- Noise suppression (esp-sr AFE + NSNet2). Groundwork and diagnosis are in
RESULTS.md;fetch()never returns a frame with the current config. - Repository has not been pushed to
originyet.
Remotes #
origin git@tangled.org:burrito.space/roombox