OpenBMS Firmware OpenBMS Firmware

OpenBMS Firmware

FirmwareLicense MIT

OpenBMS Firmware is the bare-C firmware that runs on OpenBMS’s STM32L431 (ARM Cortex-M4) microcontroller. It has two layers: a peripheral and communication layer that reads the ADC, drives the balancing and switch circuitry, and talks to the host over UART (CAN and I2C are present in hardware and planned next); and an algorithms layer that turns those raw readings into the numbers a battery management system actually needs — state of charge, state of health, cell balancing decisions, and fault protection.

Features

  • 🔧 Bare C firmware for the STM32L431, no RTOS
  • 🖥️ Custom binary protocol over UART for configuration, calibration, data logging, and bootloader entry
  • 🔋 Battery model and fuel gauge algorithm for state of charge (SoC) and state of health (SoH)
  • 🔀 Cell balancing and overcharge / overdischarge / overheat protection logic
  • 🐍 Companion Python tooling for flashing, HPPC battery characterization, and live SoC preview

Battery Model & Kalman Filter

A battery can’t tell you its own state of charge or health directly — only voltage, current, and temperature can be measured. To bridge that gap, the firmware models each cell as a 2RC Thevenin equivalent circuit, the standard approach for BMS applications, with parameters (OCV, R0, R1, τ1, R2, τ2, capacity) extracted per cell from HPPC (Hybrid Pulse Power Characterization) tests.

An Extended Kalman Filter runs this model alongside the real battery: it predicts what the terminal voltage should be, compares that to what’s actually measured, and uses the difference to continuously correct its state of charge estimate — staying accurate even as the cells age and their behavior drifts from the original model.

License

OpenBMS Firmware is licensed under the MIT license.


← Back to projects