Skip to main content

OSynaptic-RX

RX-only OpenSynaptic packet decoder for 8-bit MCUs

C89 Version AVR ESP32 License

OSynaptic-RX decodes OpenSynaptic sensor frames from any serial transport (UART / UDP / LoRa / RS-485 / SPI) into validated integer sensor readings using pure C89, with no heap usage and a stack peak as low as 55 bytes on AVR.

GitHub: https://github.com/OpenSynaptic/OSynaptic-RX


Why OSynaptic-RX?

FeatureDetails
RX-only, no encode codeFlash cost is a fraction of a full-duplex library
C89 cleanCompiles on every toolchain targeting 8-bit MCUs: avr-gcc, SDCC, IAR, MPLAB XC8
No heapZero malloc/free calls; all state in a stack-or-global OSRXParser
No floatValues decoded into fixed-point scaled integers (field->scaled / OSRX_VALUE_SCALE)
Dual CRCCRC-8/SMBUS (body) + CRC-16/CCITT-FALSE (full frame) — bit-loop, 0 B RAM, no lookup table
Spec-compatibleDecodes every frame from OSynaptic-TX and the OpenSynaptic Python hub without glue code

Try In 30 Seconds

Arduino IDE → Sketch > Include Library > Add .ZIP Library → select OSynaptic-RX.zip
File > Examples > OSynaptic-RX > BasicRX → Upload

Connect an OSynaptic-TX node to the RX board's Serial port. Open Serial Monitor at 9600 baud — decoded sensor readings appear once per received frame.


Two Decode Paths

PathAPIBest for
Streaming parserosrx_feed_byte() + osrx_feed_done()UART with idle-gap, USB-CDC
Direct frame decodeosrx_sensor_recv()UDP, LoRa, SPI (frame boundary from transport)

The streaming parser uses OSRXParser (102 B RAM on AVR). For transports with natural frame boundaries, set OSRX_NO_PARSER=1 to save 102 B RAM + 316 B Flash and call osrx_sensor_recv() directly on the datagram buffer.


Memory Footprint

Streaming parser (UART / RS-485)

ResourceSize
OSRXParser static RAM102 B (buf[96] + len + fn_ptr + ctx_ptr)
Stack peak in callback~55 B
Flash (full defaults, -Os)~616 B

Direct decode (UDP / LoRa, OSRX_NO_PARSER=1)

ResourceSize
OSRXParser RAM0 B (parser excluded)
Stack peak (osrx_sensor_recv)~41 B
Flash (-Os)~442 B

Minimum supported MCU

ModeMin RAMMin FlashExample device
Streaming≥ 256 B≥ 2 KBATmega88 / ATmega168
No parser≥ 64 B≥ 1 KBATtiny85 / ATmega48

Quick Navigation

SectionDescription
Quick StartCode walkthrough for three environments
InstallationArduino IDE, CMake, and find_package
Decode PathsStreaming vs direct decode — choose the right one
Wire FormatByte-level packet layout, CRC specs, Base62 decode
ConfigurationAll osrx_config.h macros with defaults
MCU DeploymentPer-MCU config tier table
Transport SelectionUART, UDP, LoRa, SPI, multi-channel
Flash Optimization8 flash profiles with measured values
API ReferenceComplete function and struct reference
ExamplesFive annotated examples

  • OSynaptic-TX — the sender side: GitHub · Docs
  • OSynaptic-FX — high-level C99 runtime: GitHub · Docs
  • OpenSynaptic — the Python/Rust server hub: GitHub