OpenHybridBMS Open source BMS for lithium / lead-acid hybrid installations

image

This project was started because I was not satisfied with the commercial Battery Management Systems available.

With the knowledge I aquired about lithium batteries, I was wondering how many BMS manufacturers really "got it right". After all, there are so many otherwise respected manufacturers who produce chargers with a "voltage setting" for lithium batteries, while voltage regulation does not work with lithium batteries. This didn't really put confidence in their knowledge about lithium systems. And that was a major obstacle, because my life could easily depend on it on the middle of the ocean.

Also, too many features were missing. It looks like these manufacturers never sail themselves. There are some useless features (bluetooth? Do they really think I keep caring for a darn cellphone while sailing in an area without coverage, just to keep track of the batteries?) but they lack important features like the ability to signal when there is surplus charge energy available so it can be used for non-critical devices like fuel polishers etc.

And above all, there were no Battery Management Systems available which could work nicely in a hybrid installation.

So, I decided to develop my own BMS. Which turned out to become much more complex than estimated...

Implementation

OpenHybridBMS was initially centered around an Arduino Mega, but after adding a WiFi network interface utilizing an ESP8266 it became soon clear that the ESP8266 by itself would be fully capable to carry out all the handling and calculations necessary to implement the BMS. Further evolution of this idea led to a layout consisting of the following main units:

The BMS main unit
This is pretty much a "black box", containing all the voltage, current and temperature sensor connections, two indication LED's, an emergency "disconnect" button, control outputs for a battery cooling fan, battery heater and bi-stable battery disconnector, and an ESP8266 WiFi-unit for communication with webbrowsers, remote displays, remote automatic energy management switches and network services.
The remote display unit
Although I like the web-interface for maintenance work, I also like to have a comprehensive display/control unit mounted in my navigation corner where I can just glance at the battery status whenever I pass by. The remote display unit uses the wifi-system to communicate with the BMS unit.
Remote automatic energy management switches
These switches can be used to automatially switch on a boiler when all batteries are fully charged and charge current is still available, or automatically shut down certain non-essential consumers when SoC drops down a certain value, etc. These switches are fully programmable via, you guess it, a web-interface. They communicate wireless with the main BMS unit.

Features

For more information about each of the following features, click on the associated links or scroll down to the more detailed descriptions.

Design criteria and features explained

There is not much fun in duplicating something already existing. So I wanted to develop something much better than what already was available.

Special design for lead-acid/LiFePO4 hybrid systems

Most (if not all) Battery Management Systems are designed for use with lithium batteries only. I wanted my BMS to be able to get the most out of the advantages of lead-acid/lithium hybrid systems.

No change necessary in existing installation
Wiring and alternators, solar chargers, etc. can all remain like they are. The lithium system is just "piggy backed" onto the lead-acid system. A lead-acid/lithium hybrid installation is the only way to incorporate lithium batteries without replacing or modifying existing equipment. A hybrid system is the most easy and affordable, yet also most reliable and versatile way to go. This is explained fully in my Lithium-Hybrid article.
Full redundancy
Lithium batteries offer many advantages over lead-acid batteries. However, a somewhat weak point is that lithium batteries need a Battery Management System to operate reliably and safely, and that a BMS is a sensitive piece of electronics. It can get damaged by one of the many threats electronics on board a ship have to live with: corrosion, moisture, lightning strikes, breaking wires due to chafing and metal fatigue because of the constant movement, etc. With OpenHybridBMS, a lead-acid battery remains always connected to the bus, ready to instantly take over if something goes wrong. It provides you with a plan B you don't have to worry about.
Lead-acid bulk priority charging
If both the lead-acid battery and lithium battery need recharging, the lithium battery will absorb all available charge current because it has a lower charge voltage than lead-acid batteries. However, if the duration of strength of the charge current is not sufficient to charge both batteries, you might end up with a fully charged lithium battery and a still discharged lead-acid battery. This is not the best strategy: Lead-acid batteries deteriorate when they are not fully charged, but lithium batteries actually live longer when they are only partly charged.

OpenHybridBMS uses a better strategy: it knows when the lead-acid batteries have had to assist in providing energy and need a charge, and in that case it gives priority to recharging the lead-acid batteries by disconnecting the lithium battery. Once the lead-acid bulk charge is completed the lead-acid batteries are not yet fully charged but they are no longer able to absorb the full available charge current. Completing the absorption fase would take quite some time and precious available energy would be wasted. To avoid this, OpenHybridBMS will connect the lithium battery again once it detects that the lead-acid batteries are no longer able to absorb the full available charge current, and once the lithium battery is fully charged then it is taken off line again, the voltage rises so the lead-acid batteries can then complete their absorption fase at their own slow pace.
Cross-feed protection
Cross-feeding is when the lithium batteries start charging the lead-acid batteries. This should normally not occur because the lithium voltage is below the voltage where lead acid batteries accept charge current. However, in case of a defective lead acid battery the defective battery might start drawing the lithium batteries down. OpenHybridBMS recognizes this condition and will break the connection between the lithium battery and lead acid battery.
High side current sensing
Many battery monitors include some way of sensing current and typically this means including a shunt resistor in the negative wire of the battery. This is very counter intuitive for many people and invites errors when later additional batteries or connections to "ground" or the "battery negative pole" need to be made.

This is one of the reasons OpenHybridBMS uses high side current sensing, which means that the shunt resistors are placed in the positive wire. This way, the "minus" is always ground, all negative wires from all batteries, alternators, whatever, can all be connected to a single big ground connection. This is done for both the lead-acid battery as well as the lithium battery.

Wifi interface

The idea here is that the BMS, which does all the essential work, will be mounted close to the lithium battery, most likely not a very comfortable place to read out all relevant data and to tinker with settings. You will most likely want a "remote" control unit, preferably with a wireless connection to the main unit.

The Wifi interface offers the following options:

Integrated web browser interface
These days, a common solution is to use an "app" on a smartphone for communication with the BMS-unit, but I think a web browser interface is a much better solution because it is an open platform and works just as well under Android, Apple, Windows, Linux, smartphones, tablets, laptops or desktop computers. The BMS will house a "website" which will offer:
  • a status page (see example) where you can read out:
    • a copy of the remote display
    • an event log
    • system status (cable losses, ambient and outside temperature)
    • all relevant battery monitoring data (Bus-voltage, current, State of Charge, etc)
    • cell data (Individual cell voltages, calculated internal resistance, cell temperatures, cell balance, etc)
    • statistical data (highest/lowest voltages and currents over 24 hours, etc)
  • a settings page where you can configure the BMS, where each setting links to the relevant section in the documentation
  • an "online" installation/user manual.
  • a maintenance page where you can upload new firmware into the BMS unit.
Discharging 13.3V Li:-17.3A -37Ah 90% La: -0.1A 0Ah 100% TT:-17.4A -37Ah 96%

Wireless remote display unit
The remote display unit houses a 4*40 LCD, two control LED's and a "stop" and a "go" button. The first line on the LCD will display what is going on (bus voltage, charging, discharging, error messages, etc.), the other lines show the current, state of charge, Ah's used, successively for the lead-acid battery, the lithium battery, and the overal combination of the two. It can also display individual cell data.
Wireless automatic energy management switches
A BMS by its very nature aquires a lot of valuable system information. It knows about the charge state of the battery and it knows when there is surplus of energy available. I just don't want the BMS to start and stop charging, I also want it to be able to divert loads and make optimal use of the available energy.

On ZwerfCat I have quite a few devices which should operate regularly but are not time critical. Some examples: I have built a fuel polishing system. I don't want it to eat from the battery, but if there is charge current available and none of the batteries is critically empty, why not use a small portion of the charge current to run the pump of the fuel polisher? Another consumer is the hot water boiler. We are sailing in the tropics, so hot water is not a priority, but if the batteries are fully charged and there is still lots of solar power available, why not dump all the surplus energy into the boiler? Then we have a water maker. That thing makes quite some noise, so we tend to switch it on when we leave the boat. But well, sometimes we come back later than we intended (possibly in the dark), and the water maker is still happily humming but now consuming current out of the battery. That is not what we want!

To get all this working the way we want we use remote switches to control equipment automatically depending on various conditions announced by the BMS. No more potential energy is left unused, no more energy is wasted to power non-critical devices.

These automatic energy management switches are fully configurable with any web browser via their integrated web interface.
Connection to network services
NTP, remote logging, etc. The possibilities are endless.
Firmware upgrades via web-interface
OpenHybridBMS is a work in progress so new features will come out on a regular basis. Via the webinterface you can upload new firmware into the BMS, remote display, and automatic energy management switches.

The BMS automatically sets up a WiFi hotspot to which the remote display and webbrowsers can connect, but it is also possible to let the BMS connect to your onboard WiFi (if you have it) to extend the possibilities even further and to extend the coverage (if you are adventurous you could even use port forwarding to make OpenHybridBMS accesible from the world wide web so you can monitor and control your lithium batteries from anywhere over the world).

Many communication and reporting options

I like to be able to have a grasp of what's going on in the electrical system of my ship, and I like to have it in one package. Since OpenHybridBMS has to track both Lithium and lead-acid State Of Charge, currents, voltages and temperatures anyway, why not present this information to the user?

Fully featured multi battery monitor
OpenHybridBMS implements a fully featured battery monitor for the lead-acid battery, lithium battery, and overall battery status. OpenHybridBMS is designed to be able to replace your existing battery monitors.
Remote logging
For long term insight OpenHybridBMS is able to log information to an external server which runs rsyslog or something similar.
Signal-K compatibility
To communicate via the new Signal-K protocol. Signal-K is the successor of NMEA0183 and NMEA2000.

Open source

Since one of my problems is that I don't trust manufacturers for mission critical applications unless I can verify myself that they made it "right", I decided that my BMS should be an open source project. This way, everyone can verify my work, make comments on it, suggest improvements, get it to work with their odd third party hardware, or just correct me when I got something wrong. After all, the best software these days is open source, chances are that the very webbrowser you are using to read this page is open source as well. The source code of OpenHybridBMS is published on GitHub.

Basic version rebuildable for the homebuilder

Open source is just an academic excercise if the project can not be dupliated anyway. So I wanted to design a version which uses only off-the-shelf parts which can be soldered with normal tools. The basis is formed by an ESP8266 combined with a few Adafruit break-out boards and some classic additional parts. The build instructions for OpenHybridBMS are published on GitHub.

Pro version completely assembled

Not everyone is proficient enough to build the DIY version, and honestly I think that critical equipment like this BMS should be very robust which is hard to achieve with an experimental setup. So I also plan to create a batch of ready to be installed systems where all components reside on a single PCB. Since these boards will be professionally assembled, it will be possible to make use of some enhanced components (SMD) which are not so suitable for homebuilders. Due to these enhancements, the pro version thus has a few extra features:

  • Extended voltage range, so it is also suitable for 24V systems
  • On board cell balancing
  • Higher voltage and current precision, higher sample rate
  • 4 independant current sensing channels: 2 High side current sensors and 2 low side current sensors
  • Periodic self check of all components. Automatic shutdown if any component is out of specification

Let me know if you are interested in the pro version.

Output for mono-stable and bi-stable (latching) relays

The most common relais are mono-stable relays. They don't need power when they are disconnected, but they need constant power to remain engaged. A big power relay can easily use 1 amp to stay engaged, which adds up to 24Ah during an entire day. A better (but more expensive) approach is to use a bi-stable (latching) relay, which only uses power to transition from one state to the other. They typically have two separate coils which only need a short pulse to switch over. OpenHybridBMS can control both types of relays.

Safety

Safety was a major issue in the design. After all, lithium batteries can be a safety hazard and I didn't want something bad happening while being on an ocean passage.

Extensive voltage checking on cell level
Each cell is monitored for voltage. There are limits for charging and discharging, but also a wider margin which should never be reached unless something went wrong. In the latter case, OpenHybridBMS shuts down with a fatal error.
Temperature sensors for each cell
Temperature sensors are not only used to prevent charging at sub-zero temperatures, but also for safety. Cells are only allowed to warm up a few degrees over ambient temperature (which is measured as well) and cells should equally warm up. If a specific cells warms up faster than its neighbours, it indicates that something is wrong with the cell and OpenHybridBMS shuts the battery down and issues a fatal error.
Softfuse to limit discharge currents
OpenHybridBMS implements a softfuse which can disconnect the lithium battery if the discharge current exceeds a configurable parameter.
Cable loss guard
The positive lead from the lithium battery runs via quite a few items: a fuse, an interrupter, and a shunt resistor to measure current. All these connections have some unavoidable losses, which can increase over time when connectors get corroded or when nuts slowly loose their tension. If the current to or from the lithium battery is 100 Amps and one Volt gets lost, this sounds not so bad, but it means 100 Watt of energy is lost, i.e. converted into heat. This amount of heat is sufficient to melt some things or even cause a fire. To enhance safety, OpenHybridBMS compares the voltage of the cell stack to the voltage at the output of the shunt resistor, and together with the measured current it can calculate how much energy is converted into heat. If a (user configurable) treshold is exceeded the lithium battery will be disconnected and a fatal error will be displayed and logged.

Lithium battery life extending features

I want to get the maximum life out of the lithium batteries, so I added a few features which should promote longevity.

Trickle charge guarding
If a lithium battery is nearly full but the charge current tapers off (clouds appearing over the solar panels) it might be possible that the shut-off voltage will never be reached but a relatively low current is flowing in the battery for a long time. This is called trickle charging and it is established that this is harmful for the lithium cells. Apart from silently overcharging it also promotes harmful lithium plating. OpenHybridBMS recognizes this situation and aborts the charging process.
User selectable partial charge targets
As explained earlier, remaining in a high State Of Charge is harmfull for lithium cells. To extend the life of the battery it is possible to target to a less than 100% charge. A BMS can not do this by just monitoring cell voltages due to the flat voltage curve of lithium cells, but because OpenHybridBMS incorporates a battery monitor and also keeps track of the amps going in and out of the battery, it can really charge to, let's say, an 80 percent target independant of cell voltage. Once in a while it will charge the battery to 100% to avoid memory effects and to recalibrate its State Of Charge tracking. The actual charge percentage can of course be configured by the user. One push on a button is enough to override the charge target and go for a full 100% charge: handy if it is foreseen that some cloudy days will follow and/or the next day the admiral plans to operate the washing machine (yup, we run it from the inverter powered by the lithium battery). The rest of the time the life of the lithium batteries is extended because they don't have to sit and wait any time in a full State Of Charge.
Charge current softfuse
OpenHybridBMS implements a softfuse which can disconnect the lithium battery if the charge current exceeds a configurable parameter. Often the specifications of lithium batteries allow them to discharge with more current than to charge so both values can be individually configured. Charging with too much current promotes harmful lithium plating. On our catamaran ZwerfCat this can happen when the solar panels provide their full 120 Amps output and the engines are running at the same time. OpenHybridBMS will then disconnect the lithium battery and postpone charging until the situation becomes more healthy for charging the lithium battery.
Protection against charging at too low temperatures
Charging below zero degrees Celsius is harmfull for lithium cells. If the temperature is too low, OpenHybridBMS will prevent charging until the temperature rises sufficiently.

Environmental control

Since OpenHybridBMS is equipped with an abundance of temperature sensors, it can make decisions when it is beneficial to run a fan or battery heater.

Battery heater control for charging in sub-zero temperatures
A battery heater can be used to charge batteries in sub-zero temperatures; it can be configured whether the heater is dependant on charge current or fully independant. If the heater is charge current dependant it will only be activated if sufficient charge current is available to run the heater, otherwise it will just start the heater whenever the battery approaches a critically low temperature.
Two speed fan control for keeping the batteries cool in the tropics
Lithium batteries should best be kept at about "room temperature", i.e. 20 degrees Celsius. In the tropics this is not achievable, so OpenHybridBMS monitors both the cell temperatures and the outside temperature, and only run the fan when it is beneficial to do so. To minimize noise, it will run the fan at low speed, unless the temperature-difference becomes higher than a configurable value.
image
last

Comments

Name:
Characters left:

Frans, finally someone who sees a hybrid system with the same view! I have been struggling with some of the same questions, even the same thoughts about hardware for a BMS. I would enjoy hearing more as you move forward, and could possibly work on the Pro a bit. I am not an EDA expert, but I have worked with it a bit.
0
0

Frans we zijn zelf bezig met het voorbereiden van een li ion verhaal. Wat ons nog niet duidelijk is, is hoe je omgaat met je alternator. De meeste alternatoren branden door als ze li ion laden zonder dat er een regeling is in functie van de temperatuur ten gevolge van de hoge laadstroom? Hoe vangt jouw systeem dat op? Voor ons is juni 2021 of 2022 de vertrekdatum en hopen we jullie ergens in de pacific nog te ontmoeten. Bert (schip: Evarne)
0
0

contact