Skip to content

Firmware Protocol

The current ESP32-S3 sketch listens on serial at 115200 baud.

Commands

Command Meaning
SCAN Emit one raw scan with illumination unchanged
DARK Turn illumination off, scan, tag as dark
WHITE Turn white/reference illumination on, scan, tag as white
LED 1 Enable illumination if interlock allows
LED 0 Disable illumination
STREAM START Emit repeated raw JSON frames
STREAM STOP Stop repeated JSON frames
STREAM 100 Set stream interval to 100 ms; minimum 25 ms

Current Frame

{"device":"luxnode-v0","kind":"raw","pixels":[123,124,130]}

The SDK converts pixels to counts and supplies a default wavelength axis.

Real-Time Streaming

The serial protocol is newline-delimited JSON. Any command that emits repeated scan frames can be consumed by luxspec.LuxStream, logged as JSONL, displayed in Jupyter, or bridged to a browser through the SDK's local SSE server.

For the current V0 sketch, SerialLuxNode.iter_frames() sends STREAM START, reads newline-delimited JSON frames, and sends STREAM STOP when the stream closes. The payload above is already sufficient for:

  • luxspec stream --log run.jsonl
  • notebook_monitor(connect_serial()).run(duration_s=60)
  • run_stream_server(connect_serial(), port=8765)

Next Firmware Protocol Targets

  • include schema_version
  • include firmware_version
  • include timestamp_unix_ms
  • include integration_time_ms
  • include board and detector temperature
  • include battery voltage
  • include module id
  • support VERSION and TELEMETRY commands
  • include dropped-frame and saturation counters