This repository contains the firmware for the different Libre Solar Battery Management Systems. Originally, the firmware was based on ARM Mbed OS. The current version also supports using Zephyr RTOS for some boards.
Warning: This firmware is under active development. Even though we try our best not to break any features that worked before, not every commit is fully tested on every board before including it to the master branch. As soon as the status of the firmware is considered stable enough, we will test the core features on all boards and generate a release.
ARM Mbed OS:
- Libre Solar 3-5s (12V) BMS with TI bq76920: BMS-5S50-SC
- Libre Solar 6-15s (24-48V) BMS with TI bq76930/40: BMS-15S80-SC
Zephyr (preliminary):
- Libre Solar 3-8s (12V/24V) BMS with Intersil ISL94202: BMS-8S50-IC
This repository contains git submodules, so you need to clone (download) the repository by calling:
git clone --recursive https://github.com/LibreSolar/bms-firmware
Unfortunately, the green GitHub "Clone or download" button does not include submodules. If you cloned the repository already and want to pull the submodules, run git submodule update --init --recursive
.
It is suggested to use Visual Studio Code and PlatformIO for firmware development, as it simplifies compiling and uploading the code a lot:
-
Install Visual Studio Code and PlatformIO to build the firmware.
-
Select the correct board in
platformio.ini
by removing the comment before the board name under[platformio]
-
Connect the board via a programmer. See the Libre Solar website for further project-agnostic instructions.
-
Press the upload button at the bottom left corner in VS Code.
The BMS-8S50-IC is currently only supported in Zephyr. PlatformIO has built-in support for Zephyr, so you can use it the same way as explained above for Mbed. (see platformio.ini for configured Zephyr environments)
If you want to use the native Zephyr build environment, you need to call west
from within the zephyr
subfolder, where prj.conf
and CMakeLists.txt
are located.
The documentation auto-generated by Doxygen can be found here.
Writing the tests is still work in progress. New functions should be implemented in test-driven development fashion. Tests for old functions will be added step by step.
Run the tests with the following command:
platformio test -e unit_test_isl94202 -e unit_test_bq769x0