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:

  1. The ARM Cortex-M3 processor STM32F103 is used as a microcontroller. The device driver library selected is libopencm3.
  2. CANopen [1] is chosen as a standard smart transducer communications protocol. CanFestival is an open source implementation.
  3. FreeRTOS is an open source RTOS chosen as the task management support for the project.
  4. Storage is managed through the FAT filesystem provided by Chan's FAT and Martin Thomas' port to STM32.

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.

At this time, CANopen has not been implemented. The communications protocol is simple command-data passed over a serial interface.

First created
30 August 2013
Last Modified 19 July 2014
Ken Sarkies 2013