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


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...


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.


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 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.


Characters left:

Also very interested in the BMS Pro system. Please let me know when it is available. Thank's

Frans, what you say doesn't fit publishedcapacity/voltage curves of LFP batteries. Check this: https://www.solacity.com/how-to-keep-lifepo4-lithium-ion-batteries-happy/ You see in the 2. plot the 12V version with 13V at 40% LFP capacity. If you discharge from, say, 90% to 40% that leaves you with only 50% of the possible 80% LFP capacity. So loweing the discharge cutoff to 12.6V would still leave the LA batt. rather full and deplete LFP to 15%. Much better!

Hi Frans, thanks for suggesting this simple solution! Why would you want to develop your own BMS? Can't you simply use one that is available like Electrodacus? https://www.youtube.com/watch?v=TrTu9uehOFg you can set the cut-in low voltage separate from the low cut-off voltage, you can set the high cut-off voltage and many more. It also has a battery overtemp protection aswell as an batt undertemp protection (LFP batt should be chared above 5°C only). The starter batt can then float when LFP is full.

Nice article. 1 remark though about charging. You can FloatCharge CCCV lithium @ < bms-cut-off-voltage till it's saturated at the voltage setpoint. Advantage hereof is that the battery bms never disconnect the (solar)charger. Under floatcharge I mean just charging with one voltage set-point, e.g @ 14.0v for a 12v battery. Good idea or not?

Very interested in the pro system.

Your BMS sounds very promising and perfect for our situation. Please add us to your list, and thanks

I'm very interested in your BMS when you start making them, can you notify me with a price when they're ready

I’d be interested in the pro system. What price roughly? Thank you.

Frans Veldman
Sorry, I have no insight yet in the cost of a small production run.

what happens if say the alternators are pumping out 100amps+ I seem to see 50amps as max charge on most .Lithiums?

Frans Veldman
My BMS will disconnect the lithium battery if the charge current is too high. Ofcourse it is better to dimension the system in such a way that the charge current is compatible with the lithium batteries.

Hi there, enjoying your articles, thanks. Does the alternator voltage need to be adjusted in order to run a hybrid system? I have one boat which has an alternator which outputs 14.4v, and one which outputs 14.8v via an external regulator. Would these be compatible with a hybrid system?

Frans Veldman
As long as the lithium battery is charging, the voltage will not be able to go up because the lithiums are absorbing all available current. The BMS will disconnect the lithium battery as soon as it is fully charged. After that, the alternators etc can do just their own thing, increasing the voltage to whatever value they want. So the programmed voltage doesn't matter for the lithium battery, as long as it is higher than the voltage of the lithium charge voltage.

I am very interested in your BMS. You have a very well thought out system but I noticed on GitHub there are no recent postings. Where do you stand on development? Thank you.

Frans Veldman
I have been unavailable for a while, but I will soon continue the project. I'm in the process of developing the PCB's. The prototype is working fine on our ship!

Hi Frans - I am very interested in this because I would like to add a LiFePO on my canal boat. It has twin alternators, a 35A for the starter battery (110Ah SLA) and a 70A for "house" batteries (345Ah SLA). My idea is to connect a LiFepO (120Ah) in parallel with the starter battery for charging via a VSR (ie "split-charging") only when the engine is running, via an ignition controlled changeover relay, which then connects the LiFePo in parallel to the house bank when the engine stops. Any comments?

Frans Veldman
I'm not sure why you would be doing that?

Nice work, i too have built a Battery Monitoring system based on a Particle Photon and the ADS1115 with voltage dividers, amazed to discover such a similar approach. I push the data out to Thingspeak with a web hook.

I have been looking for information about using LFP and LA in parallel and happened upon your comment in the DIY Mobile Solar forum. I have just an off-grid cabin, and this is exactly what I have been dreaming about - a hybrid solution for multiple charging sources at 24v, robust and temperature variable (central plains of the USA here). This solves practically all of my issues. Although I am not much of a help with coding I will follow along eagerly. Thanks so much!

So, when the lithium pack switches off because of low voltage, how does it recognize that it is ok to switch on again? Manually? If you have two circuits (charge and discharge) like usually with LF packs, you will need to redesign a lot.

Frans Veldman
If the lithium is disconnected, the BMS will continue to monitor the bus voltage. As soon as it rises above the lithium battery voltage, it reconnects the lithium battery to the bus.

We both seem to have adopted exactly the same approach. I too use esp8266 and wireless connection for everything including remote displays, web interface, remote monitoring, etc etc.i have the hybrid BMS as a stand alone unit that can perform all required protection and control of the battery environment and that communicates via MQTT with a Pi and direct to other esp control units including proportional dump load control and various other power control and optimising systems. I think hybrid rocks!

Dank je wel voor een zeer interessant artikel!

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.

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)