Skip to content

LauriAlanen/BMS

Repository files navigation

BMS for 4S LiFePO4 battery packs running on the STM32L152RE. Features a custom FreeModbus port and a Dockerized Python telemetry stack.

Firmware Architecture Highlights

  • 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.

Telemetry Stack + Master

  • A USB-RS485 connection feeds data to a containerized dashboard.
  • Master supports multiple BMS nodes.
  • Ported freemodbus library to STM32L152RE
  • Dashboard: Python Streamlit app for control and live metrics.
  • Storage: InfluxDB for time-series data.
  • Visualization: Grafana for analytics.
  • image

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •