Solar Battery Management System Software
The main aspects of the firmware software structure are shown in the diagram below:
The following standards and libraries are used:
The various modules are each implemented as a separate RTOS task. These are the communications task, data storage task, measurement task, battery charging task, load and SoC management task. A number of support modules are also present. The watchdog module ensures that each task runs through its main loop at regular intervals, restarting the task if it delays too long. A hardware module abstracts all aspects of the microcontroller hardware interfaces. An object dictionary manages global variables through access functions. Some of these variables are stored in FLASH to preserve them through resets. Finally time functions are provided for file storage and some string conversion functions are provided for communications and storage.
A GUI program written in C++ over QT allows comprehensive monitoring and control of the whole system.
A data processing program also in C++ over QT has also been built to provide extraction of blocks of recorded data to csv files and to perform some basic analysis of energy balance.
All code is available on GitHub.