aiot-production-kit / crc16-bms-parser
PYTHON STDLIB · INDUSTRIAL BMS TELEMETRY

Multi-Gen 142 / 154 / 164-Byte CRC16-Modbus Frame Debugger

Extracts clean per-cell voltage/temperature telemetry from sticky TCP/serial packets across heterogeneous BMS firmware generations.

TL;DR ENGINEERING FACTS
  • Ring-Buffer Re-Synchronization: Hunts binary headers across concatenated or fragmented LTE Cat-1 / RS485 payloads without dropping valid tail frames.
  • Multi-Generation Length Dispatch: Decodes 142-byte, 154-byte, and 164-byte ASCII Hex BMS generations concurrently in one fleet collector.
  • Mandatory CRC16-Modbus Verification: Rejects bit-flipped frames cleanly while emitting structured frame offsets for automated diagnostics.

Run & Test Locally (Zero External Dependencies)

python3 -m unittest discover -s tools -p "test_*.py"
python3 tools/crc16_frame_debugger.py --demo

Field Failure Mode vs. Spacebit Reference Fix

Field Failure ModeWhy Naïve Implementations BreakProduction Guardrail
Field batch upgrade mixes frame lengthsHardcoded fixed-size struct unpack panicsDynamic length table (`142 / 154 / 164B`) dispatch
Sticky cellular TCP reads glue 2 framesNaive split drops second telemetry packetSliding header sync ring buffer
Weak signal flips cell voltage byteBogus 4.9V spike triggers alert stormStrict CRC16-Modbus verification before DB insert

Full-Stack Architecture Guides & Source Modules