Solar Battery Management System

The German made solar charger, which uses fuzzy logic to track battery state of charge, fails to track properly when the batteries are fully charged; doesn't handle multiple batteries or multiple power sources; and doesn't provide prioritization of loads. This is more than enough provocation for a geek to build a battery management system.

The accurate tracking of the state of charge in lead-acid and other battery types is a significantly difficult problem, having many "solutions", none of which work well. The concept of battery state of charge is vague: the measures used can change as temperature and other environmental variables change. The tracking of charge state by counting Coulombs passing in and out of the battery is probably the simplest and most effective, but is subject to cumulative errors and needs to be regularly reset. In addition charge passed into a battery is not always stored and can simply pass though by means of side reactions such as electrolysis and grid corrosion. For this BMS project, the algorithms developed for tracking charge state still could be refined.

On this page the electronics associated with the BMS is described. As indicated above the requirements are:

  • Accurate battery charge state tracking and battery disconnection when the charge state reaches its lowest safe limit.

  • Multiple battery management allowing standby batteries to be switched in.

  • Multiple load prioritization allowing low priority, heavy current loads to be disconnected when battery charge state is critically low, while low current loads of higher priority may remain connected for a longer time.

Overall Design

The BMS has been designed to manage three batteries. In practice batteries can be connected together in parallel but this is safe only if they are of the same chemistry and age. It is better in fact to manage each battery separately. That way if a battery's state of health fails it can be isolated from the system and not adversely affect the other batteries.

The BMS has also been designed to manage two load priorities. Heavy current loads can be allocated low priority and will disconnected when the battery charge state becomes critically low. Low current loads can be allowed to remain connected for a longer time.

For this design only one power source has been incorporated. In principle it would be valuable to have other power sources available of the same or different types.

A major design decision to be made is how an electrical common is to be provided. In many solar charge regulators, switching and current measurements are performed at the negative side of the power feeds (as suitable low resistance N-type MOSFET switches are readily available). This however means that an electrical common cannot be established for the source, batteries and load and so creates design difficulties for the electronics used in measurement and control. For this design where the number of managed elements is greater than the usual three, current measurement and switching is performed at the positive side of the power feeds making the overall electronics design much simpler. to avoid the need for generating the high control voltages required by the N-type MOSFETs, switching is performed using P-type MOSFETs. These have higher on-resistance than the more commonly available N-type MOSFETs, but for the currents and voltages present in the application in mind (<20 amps and 10 to 15 volts) there are suitably low resistance P-type MOSFETs available at a reasonable price.

The design currently envisages a central controller that measures voltages and currents, and issues controls, directly to all parts of the circuit, rather than having self contained modules with their own processor. The latter system can be more flexible and modular but poses a number of challenges with regard to reliability and communication with a central processor. It would also have a higher current drain than a directly connected system

The overall design consists of:

  • A microcontroller board taking measurements and issuing control signals. This makes decisions for battery charging and load control.
  • A number of current and voltage measurement interface boards that include a latching circuit breaker and undervoltage detection, for use with the batteries and power sources.

  • A switching matrix that interconnects source inputs to batteries and batteries to loads. This must ensure that batteries are not accidentally connected together. This incidentally is the best place to provide a regulated power source for the electronics as it can be derived from all the batteries through a diode isolator.

  • Firmware to manage the system.

The entire software and PCB designs are held on GitHub. This includes some data analysis software to perform some basic computations of energy balance, and to convert the somewhat large data files into forms suitable for passing to other analysis software such as spreadsheet and data base.

The hardware layout is shown below:

This is a prototype board with space at the top left for a remote control receiver. The interface boards are hand wired.

This is the second version, needing the interface boards and switching board updated and the remote control receiver replaced.


Overall the system works satisfactorily but a number of issues remain:

  1. The batteries are switched with MOSFETs without protection from accidental discharge through the MOSFET body diode. This decision was made to avoid additional voltage drops in the loads. However if a battery is removed the terminal wires must be carefully protected. If they are shorted together, the switch MOSFET that connects a battery to a load will be destroyed.
  2. The power drain is a little high, being about 200mA for the main circuitry plus about the same for auxiliary circuitry such as the light controller and RF communications interface (provided currently by an XBee) that must remain on all the time. In periods of low solar module output this can cause the batteries to gradually run down.
  3. An uncomfortable number of batteries have died. This appears to have been due mainly to problems with algorithms and hardware design faults. The system is installed in a remote location and in the event of a fault it may be left for some time. The death of a battery can affect the other batteries which may discharge into it. At this time most of these bugs have been fixed and the batteries are working well.
  4. The algorithm for automatic battery management is complex and often shows some undesirable characteristics, such as switching rapidly between batteries and causing variation in load voltages. It also tends to hold the loads on to a low battery for too long due to errors in estimating state of charge. The algorithm for determining battery state of charge needs to be seriously improved. A state of health feature is also very desirable.

First created 6 June 2013

Last Modified 22 February 2016
Ken Sarkies 2013