Files
overland-controller/docs/SENSOR_NODE_PROTOCOL.md
T

2.2 KiB

XIAO ESP32-C6 Sensor Node Protocol

The XIAO sensor node reads the BNO086 and MAX-M10S and publishes vehicle telemetry over half-duplex RS485 at 115200 8-N-1, one JSON object per line. It owns no control state. Cargo remains the controller, HTTP server, and /api/v1 source of truth; JBD/NimBLE behavior is unchanged.

The expansion-board pins are D2 driver enable, D4 TX, and D5 RX. Only physical bus ends should be terminated. Confirm A/B polarity because vendor labels vary.

Schema version 1

sensor_status includes node_id, firmware_version, uptime_ms, and:

  • imu: rotation data plus linear acceleration, angular velocity, gravity, stability classification, and per-report accuracy/age.
  • gps: existing navigation data plus HDOP and location/time ages.

online only means UART bytes arrived recently. In gps.nmea, a rising sentences_passed count proves valid NMEA at the configured baud rate. A rising character count with no passed sentences indicates wrong-baud noise or malformed data. A consistently rising failed count indicates corrupt UART data or a baud mismatch.

Consumers must check valid or fix before displaying measurements and ignore unknown fields. The native breakout coordinate frame is reported initially; installation-specific axis remapping should follow physical calibration.

This link does not replace dashboard-to-Cargo WiFi/HTTP. A future dashboard receiver may display this telemetry without moving relay, BMS, alarm, or configuration authority away from Cargo.

Level calibration commands

The receiver may send {"type":"calibrate_level"} followed by a newline. The node immediately responds with calibration_response result started, then samples the IMU for five seconds. If pitch or roll moves by more than two degrees, it responds with vehicle_moved and retains the previous calibration. On success it saves averaged pitch and roll offsets in NVS and responds with complete.

Send {"type":"clear_level_calibration"} to erase the saved offsets. Telemetry retains native imu.pitch_degrees and imu.roll_degrees and adds imu.level_calibration containing status, offsets, and calibrated pitch/roll. Level calibration intentionally does not alter yaw.