XIAO ESP32-C6 Sensor Node
This Arduino sketch reads a BNO086 IMU and MAX-M10S GPS and publishes versioned, newline-delimited JSON over the Seeed RS485 expansion board. It produces vehicle telemetry only; Cargo remains the controller and /api/v1 authority.
| Function | XIAO pin |
|---|---|
| RS485 DE / TX / RX | D2 / D4 / D5 |
| BNO086 SDA / SCL | D7 / D8 |
| GPS TX to XIAO RX | D9 |
| GPS RX from XIAO TX | D10 |
Power both sensors from 3.3V with shared ground. Required Arduino libraries are Adafruit BNO08x, TinyGPSPlus, and ArduinoJson 6.x. Enable USB CDC On Boot for diagnostics. GPS uses hardware UART0 and RS485 uses hardware UART1.
At startup the firmware scans D7/D8 and accepts either valid BNO08x address, 0x4A or 0x4B. If neither appears in the scan, verify 3.3V/GND, swap-check SDA and SCL, and confirm the breakout's PS0/PS1 jumpers are configured for I2C.
The node sends sensor_status at 115200 baud every 200 ms. See docs/SENSOR_NODE_PROTOCOL.md. The initial firmware is transmit-only; add a dashboard receiver after bench-testing the node, RS485 polarity, and sensor axes.
During bring-up, USB_TELEMETRY_ENABLED mirrors each RS485 JSON frame to the Arduino Serial Monitor at 115200 baud. Set it to 0 in sensor_node_config.h when continuous USB output is no longer wanted.