TeardownMar 2025 to nowSoftware Engineer, Blue Brand
Battery energy platform
The production backend and edge controller for a home battery system: an inverter, a smart meter and a BMS on one Raspberry Pi 5.
Company work. The code is private.
- device polling failures after debugging the link
- 80% to 0%
- devices on Modbus RTU: inverter, meter and BMS
- 3
- BMS modules in the docs, against one polled in code, found in review
- 16
Wire the bus
Try putting the meter and the BMS on one RS485 bus, then split them. The baud rates are the ones measured on the hardware.
- DTSU666 meterOK
- JK BMSUnreadable
At 9600 baud the meter answers, but the BMS speaks its own protocol at 115200, so it never gets a frame it understands.
Found on the hardware before deployment, alongside an architecture review of the control loop.
The problem
A home battery system has three devices that each speak their own dialect of Modbus: a Deye inverter, a DTSU666 smart meter and a JK BMS. The platform has to read them reliably, control the battery safely and report to the cloud.
How I built it
FastAPI services in production, with PostgreSQL and TimescaleDB for telemetry, MQTT, Docker and GitLab CI/CD.
A Python controller on a Raspberry Pi 5 talks Modbus RTU over RS485 to all three devices and runs the control loop.
REST, WebSocket and MQTT integrations with retry and fallback, and a control-panel dashboard in Vue 3, TypeScript and Tailwind.
What happened
- Debugging the device link cut polling failures from about 80% to 0%.
- A pre-deployment architecture review found that the control loop's verify step was never wired into execution, and that the code polled one BMS while the docs described 16 modules.
- Hardware testing showed the meter is fixed at 9600 baud while the BMS speaks a custom protocol at 115200, so the two can't share one RS485 bus. That changed the wiring design.
Architecture
- Python
- FastAPI
- PostgreSQL
- TimescaleDB
- MQTT
- Modbus RTU
- Raspberry Pi 5
- Docker
- GitLab CI
- Vue 3
- TypeScript
Next teardown
A public IP behind CGNAT
WireGuard through carrier-grade NAT