BMS for 4S LiFePO4 battery packs running on the STM32L152RE. Features a custom FreeModbus port and a Dockerized Python telemetry stack.
- MCU: STM32L152RE using LL (Low Layer) drivers.
- Control Loops:
- Fast Loop: Current sensing and Coulomb Counting.
- Slow Loop (500ms): Voltage/Temp monitoring and slower safety checks.
- SoC Algorithm: Coulomb counting with OCV (Open Circuit Voltage) recalibration during rest.
- Protection: Over/Under Voltage, Over/Under Temp, Overcurrent sensing with analog WDT (includes cooldown retry logic).
- Handle-Based: Encapsulates all state variables in BMS_handle_t, enabling modular, instance-specific logic.
- Data Decoupling: Uses separate packed structs for Modbus communication (BMS_input_t/BMS_output_t), isolating internal state from the external protocol layer.
- Runtime Configurability: Utilizes a nested BMS_config_t struct to allow hot-swapping of safety limits and parameters via Modbus without recompilation.
