Green BMS

Open source Bluetooth Smart Battery Management System

Public Chat
Similar projects worth following
Smart BMS is an Open Source Battery Management System for Lithium Cells (Lifepo4, Li-ion, NCM, etc.) Battery Pack.
Why Green BMS?
A year ago I bought an electric motorcycle for my daughter, on which I replaced the exhausted PB-gel batteries with a Lithium battery pack (LiFePO4).
To manage lithium cells, I have not found a smart, cheap and easy to configure product on the market. So I decided to make it myself!
After a lot of work, when I saw that it worked well, I decided to share Green BMS project with the world, giving others the opportunity to use it and even improve it.
My daughter's scooter has already traveled hundreds of kilometers, but this project is not only applicable for electric mobility, it can also be used for storage systems for solar energy and for any application powered by lithium batteries.
I am happy to give my small contribution to the environment and to a sustainable future, with my project!


Lithium battery pack needs a BMS (Battery Management System).

The main functions of a BMS are:

  • To protect the cells against overvoltage 
  • To protect the cells against undervoltage
  • To save the cells in case of temperature out of the ranges
  • To balance the cells

A Smart BMS has these additional functions: 

  • To consent the monitoring of the battery pack
  • To consent the monitoring of each cell
  • To consent to perform parameter settings

Green BMS is a Smart BMS and it includes four main components: 

1. Cell Module

2. Control Unit 

3. Limiter 

4. Android App

The voltage and the temperature values of each cell are acquired by the relevant Cell Module (Attiny) and sent to Control Unit (Arduino Mega) through a serial I2C line. 

Control Unit starts or stop charging (by output relay) through Limiter, that includes a power relay for opening or closing the charging circuit. Control Unit can also start or stop discharging by output relay.

 Balancing current: up to 1,2 A (adjustable by parameter).

When just one cell of the pack is balancing, Control Unit activates  the current limit function inside the Limiter (the charging current is limited to 1A).

Control Unit can be connected (bluetooth) with a Smartphone by Green BMS App!


Cell Module description is available on this page:


Control Unit description is available on this page:


The BMS Battery Management System Limiter is described here:


Green BMS Android app  is described here:


Green BMS has been certified as open source hardware by the Open Source Hardware Association, with the UID: IT000007.


This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International LicenseCreative Commons Attribution-ShareAlike 4.0 International License.

  • Design Challenge n.13: Android app

    Sergio Ghirardelli10 hours ago 0 comments

    At the beginning of the project, I was thinking of connecting a touchscreen display as a human-machine interface, which is a typical solution used by many.

    But immediately I asked myself: how many times does the user of a BMS need to look at the display to check the status of the battery cells?

    Wouldn't it be better to think of an occasional interface, to be used only when needed, occupying the necessary resources only on these few occasions?

    This is why I thought of an application on a smartphone: who doesn't have a smartphone?

    After a lot of online research, I decided to use Mit App Inventor, an open source online application.

    Developing a smartphone application was the absolute novelty for me in this project.

    I spent a lot of time learning the various programming rules and especially data exchange with Arduino.

    The main difficulties I had to overcome were 2:

    1. The management of unwanted characters that often pass through the Bluetooth network which forced me to use char control instructions

    2. The compilation process of the Mit App Inventor project.

    A typical mistake that beginners (like me) make is to use too many programming blocks: this crashes the project at compile time.

    Researching through the Mit App inventor community, I learned to significantly reduce blocks using the Lists of objects, calling each of them through the For Loop.

    This solved the problem!

    I had also to work a lot on the graphic look. I thought of a layout that could be simple and practical, with a few pages containing only the information necessary for the user ... I hope I succeeded …

  • Design challenge n.12: Control Unit Interfaces

    Sergio Ghirardellia day ago 0 comments

    The main function of a BMS is to give consent to charge or discharge the battery.

    To make green BMS as versatile as possible, in order to cover many types of applications with different powers, I made this choice: I decided to use relays.

    With the free voltage contacts of the relays, the user can control an additional protection circuits best suited to his needs.

    Important: the charge and discharge protection relays are used with NO (normally open) contacts energized to close the contact: this is a safety feature because in the event of a loss of power on the relay coil, the contacts open.

    The Control Unit therefore consists of the following components:

    How to combine them all together in the most compact way possible?

    Kicad and the open source community gave me a great idea.

    In fact, with Kicad various customizable models of expansion cards are already available, including the arduino Mega expansion!

    So I tried to enclose all the components of the Control Unit in a single board called “Interface board” to be plugged onto the Arduino Mega, here is the result:

    After that it was easy to design and build the case:

  • Design challenge n.11: Watchdog

    Sergio Ghirardelli2 days ago 0 comments

    Microcontrollers can crash.

    This can happen for sketch mistakes, but also for failures in the microcontroller itself... so it can happen.

    When this happens, the outputs remain frozen at the last value and this led me to an important question:

    What would happen if the Arduino Mega crashes while charging the battery, with the charge consent output active?

    The risk is to lose the protection of the BMS due to overvoltage of the cells, with bad consequences on the battery pack.

    For this reason I have inserted 2 levels of watchdog control:

    1) Software: in case of crash, the microcontroller is restarted, but this protection for me wasn’t enough, so I added the watchdog ...

    2) Hardware: I made a circuit independent from the microcontroller, using the NE555 integrated circuit.

    Here is the scheme:

    It works like this:

    Arduino Mega provides a digital output called "Heartbeat". It is a square wave with a period of 500 ms.

    When this signal is present (software OK), the watchdog circuit closes the relay "K0" which has the function of supplying all the relays including those for enabling the charge and discharge.

    When the Heartbit signal is blocked , at a high logic level or at a low logic level (software crash), after the delay time of 5 seconds (t = 1,1* R11*C5) the relay K0 is disconnected opening relays supply.

    This solution satisfied me, because with few components, I made the system safer in case of Arduino crash.

  • Design challenge n.10: Project development

    Sergio Ghirardelli3 days ago 0 comments

    With my experience I have learned that, before starting with the development of a project, it is advisable to dedicate some time to create a simulation platform, in order to have the whole system at hand, with the various interconnected components. It is not a waste of time!

    To develop the project, I made a “portable” 4 cells BMS simulator.

    First I designed with Kicad and made the prototype of the cell module (without balance resistors), on a matrix board, using dip through hole components:

    After that, I thought of a way to simulate the battery cells, varying the voltage of each to my liking.

    I made a 4 set point generator using components I had:

    So I assembled all the components on a wooden board...

    Thanks to this prototype I was able to simulate all parts of the system and develop the software of each component including the Android app, comfortably in the warmth of my home during the winter months of last year!

  • Design challenge n.9: Arduino IDE Software functions

    Sergio Ghirardelli4 days ago 0 comments

    Every software designer has their own way of programming, there is no single method.

    My job is PLC (Programmable Logic Controller) programmer and therefore I developed my project on Arduino IDE using the methods and functions that I normally use in Ladder language.

    First, I avoided using interrupts and the "delay" command: I made sure that the task always ran as smoothly as possible.

    So where it was necessary to use timings, I did it via the "Millis ()" function, here is an example:

    I have also created 2 typical PLC functions that are very important to me:

    1. TON = timer on

    The function I created to use the TON is this:

      2. Positive and negative edges

    The functions to use edges are this:

    These functions, added to others that I have created, have allowed me to develop Attiny and Mega sketches as I like!!!

  • Design challenge n.8: temperature sensors

    Sergio Ghirardelli5 days ago 0 comments

    One of my goals in this project was to do a temperature control on each single cell module, in order to remove the enabling for charging and discharging in case of high temperature.

    First I had to choose the type of sensor.

    Due to the supply voltage ranges of the cell, I chose to use the TMP36 analog sensor that can be supplied between 2.7v and 5.5v.

    TMP36 can detect temperatures from -40 °C to 125 °C.

    While I was thinking about the most suitable point of the circuit where to install the sensor, I thought about one thing:

    Why not include something more in my project than other BMS's? Why not also monitor the temperature of the balancing resistors, in order to interrupt the balancing in case of exceeding a threshold set by the user?

    So I decided to add a second TMP36 for the resistors.

    I placed the sensors like this:

    To be more effective in the measurement, I fixed the sensor body with thermal glue to the point to be measured.

    Thanks to this configuration, it is possible to monitor the temperature values of the pole (TP) and of the resistances (TB) in each cell at any time via the app.

    Through the threshold parameters of high cell temperature and high balancing temperature, the user can decide above which pole temperature to remove the consent for battery charging and discharging and above which temperature of the resistors to stop balancing.

    A possible improvement?

    To add a Low temperature threshold parameter of the pole, below which to block the consent to charge the battery.

    This thing will be done in the future evolution of the project ...

  • Design challenge n.7: the fuse voltage drop

    Sergio Ghirardelli10/16/2021 at 17:25 0 comments

    The cell module circuit includes a 3A fuse connected immediately to the module's positive power supply.

    The fuse has a very low internal resistance (about 50 mOhm)

    However, this resistance becomes a problem during balancing, because the balancing current of 1A causes a voltage drop across the fuse of about 50mV.

    This drop compromises the cell voltage measurement during balancing, compromising the regulation logics: because the microcontroller detects a lower voltage than the real one of the cell!

    How to solve this challenge?

    Could I remove the fuse? could be dangerous in case of short circuit!

    So I immediately tried to find a way to calculate this drop and compensate it with a mathematical formula in the software.

    But this choice proved to be very complex due to the many variables involved to be managed:

    different fuse resistance for each board, user variable balancing current, balancing resistors with different tolerances, different balancing voltage between Lifepo4 and Lion ... etc.

    Too inaccurate: another solution had to be found.

    After a few days of reasoning I had a simple thought:

    I have a microcontroller that manages the balancing circuit and I have a mosfet that can switch quickly!

    So why not periodically interrupt the balancing, to acquire the real voltage of the cell?

    This graphic shows the logic I have implemented in the software:

    Every 5000 ms the balance is stopped for 50 ms.

    In the middle of this time a voltage reading is taken, which without the fuse voltage drop corresponds exactly to the real cell voltage!

    I am very satisfied with this simple solution that I have found.

  • Design Challenge n.6: balance circuit mosfet N short circuit failure

    Sergio Ghirardelli10/15/2021 at 20:55 0 comments

    This was the first version of the balancing circuit diagram of cell module:

    The balancing command digital output (from Attiny microcontroller) drives a N-channel Logic Mosfet which closes the circuit on the balancing resistor.

    I did not like this version of the circuit for this reason: in the event of a short circuit failure between the source and drain of the mosfet, the circuit would have closed the resistance on the cell, causing the risk to damage the cell by falling below the minimum voltage threshold.

    I wanted a protection for this event, so I modified the circuit like this:

    I added a second P-channel Logic Mosfet on the positive power supply of the circuit, driven by another digital output of the microcontroller.

    When the cell voltage is greater than 3200 mV, the balancing circuit is enabled, when it’s lower the balancing circuit is disabled.

    So I protect the cell from the short circuit failure of the mosfet N, because below 3200 mV it is no longer balanced.

    In the next evolution of the cell module, I decided to no longer drive the mosfet P from the microcontroller, but to use a hardware comparator circuit independent of the software of the microcontroller, in order to make the circuit even more safe.

  • Design challenge n.5: what type of balancing resistors?

    Sergio Ghirardelli10/14/2021 at 18:16 0 comments

    Most of the low cost passive smart bms that are on the market, in my opinion they all have one limit in common: low balancing currents, from 30mA to 100mA

    Anyone who has experience with lithium cells, especially with Lifepo4, knows that with use, the cells can reach differences that are really difficult to compensate with such low balancing takes many hours of balancing!

    For this reason, I have chosen to make a BMS capable of balancing at 1 A.

    The challenge was clearly to achieve this goal while maintaining prices, dimensions and temperatures at acceptable levels.

    I chose the experimental method.

    I defined the volume of the module that I would dedicate to the resistance:

    (W20mm x H40mm x W10mm)

    After that I compared three types of power resistor, each soldering them on their own prototype board:

    1 – n.1 armored resistor 3 ohm 10W

    2 – Parallel of n.33 smd resistors 100 ohm 1W: equivalent to 3 ohm

    3 – parallel of n.4 cement resistors 12 ohm 5W: equivalent to 3 ohm

    Then, under the same environmental conditions (same day, with ambient temperature: 17 °C), I applied a voltage to each of the prototypes, in order to have the same balancing current (1,1 A), for 1 hour.

    During the balancing I measured the temperature on the body of each resistor using the TMP36 chip, acquired by my Picoscope 2204A oscilloscope and I recorded its trend using the PicoLog application.

    For the cement resistors I did a double test: the first test with the resistors in contact, the second test with the resistors slightly spaced from each other, in order to allow the passage of air.

    This is the result:

    The test shows that:

    1) cement resistors heat up much more slowly and reach a temperature of about 10-15 ° lower than other types

    2) spaced resistors are better than resistors in contact

    3) smd and armored resistors have more or less the same behavior

    The following graphic shows temperature trend after disconnecting the power supply (return to ambient temperature).

    From this measurement, it can be seen that on the other hand, smd and armored resistors have faster cooling time (5-6 minutes), while cement resistors take longer time (11 minutes).

    After these tests, also considering the prices, I decided without any doubt to use the cement resistors on Green BMS cell modules.

  • Design challenge n.4: voltage measurement accuracy

    Sergio Ghirardelli10/12/2021 at 18:49 0 comments

    Attiny84 microcontroller consents to measure the supply voltage, avoiding the use of an analog pin.

    How is accurate this measurement?

    In this phase of the design I made a bad discovery: connecting several controllers to the same power supply, I had different measurements, with values that differed even by 30-40 mV!


    In order to solve a situation like this, experience teaches me that we need to calmly collect the necessary data ...

    So I connected 3 different attiny microcontrollers (one at a time) to my bench linear power supply, and I collected in an excel sheet the voltage measured with my multimeter and that detected by the microcontroller, for a scale from 2.6v to 5v, taking a measurement every 50 mV

    I first tried to figure out if there was simply an offset to add up to compensate for the error, but I quickly saw that this was not constant.

    So I created a calculation column where I reported the gain, according to the formula:

    gain = V_measured (multimeter) / V_attiny (microcontroller input)

    After which I reported the gains of the three modules in a graph as a function of the measured voltage, with the aim of finding a visual relationship between the gains of each module.

    This is the resulting graph:

    Looking at the trends, we see that the gain drops with increasing voltage, with a similar range, for all the modules. The difference seemed to be just a question of offset:

    So, playing with the data, adding or subtracting an offset, I was able to superimpose the trends of the 3 gains:

    So, summarizing, I found that:

    - for each module, the gain varies linearly as a function of the voltage following the same angular coefficient

    - In order to accurately calibrate the voltage, the user must be able to set the offset of each module…

    At this point the question was: how?

    The simplest and most immediate way to perform this “one time” setting was to increase and decrease the offset using the buttons on each module, storing the Offset value on the eeprom …

    The result was satisfactory !!!

    I have done several tests on 16 cell modules, varying the voltage and the measurement has never shown an error greater than 10 mV!

    In the following video I show how to perform this calibration:

View all 19 project logs

  • 1
    Step 1 - Purchase the hardware components

    Green BMS hardware components are:

    • Cell modules (the quantity is according to cells number) (*)

    • n.1 Arduino Mega board
    • n.1 HC-05 Bluetooth module

    Power charge enable components:

    If you decide to use Limiter to manage charge enable and current limiter , you have to buy the components included in this diagram, this is the list:

    • n.2 Led diodes
    • n.2 1 Kohm 1/4 w resistors
    • n.1 510 ohm 1/4 w resistor
    • n.1 0,68 ohm 5 w power resistor
    • n.1 5k potentiometer
    • n.2 diodes 1N4007
    • n.2 power relays, coil: 12vdc, max coil current: 1A, 1 NC/NO contact, max contact current: 40A
    • n.1 isolated DC-DC 12v-12v converter: Traco TBA 1-1212E
    • n.1 NPN transistor BD139
    • n.1 N-channel Mosfet IRFZ44N
    • n.1 4A fuse
    • n.1Thermal switch: Honeywell 2455R 82-195 L70C
    • n.1 3p signal connector (min. 1A)
    • n.1 2p power connector (min.40A)
    • n.1 Heatsink case (this is an example to buy)

    As alternative, you can decide to use the charge enable relay you prefere, considering that:

    • The coil must be 12vdc, max coil current: 1A
    • The NO contact must support the charging current you need

    Power discharge enable components:

    • Power relay, coil: 12vdc, max coil current: 1A, NO contact, max contact current according to max discharge current

    (*) You can decide to assemble PCB yourself. In this case you can order only the PCB and you can purchase all the electronic components according to BOM file available on PCBway store.

  • 2
    Step 2 - Purchase the hardware tools

    Hardware tools necessary to make Green BMS are:

    • n.1 Arduino Uno board. You need it do load software on Cell Module Attiny84 microcontroller
  • 3
    Step 3 - Install the software tools

    To make a Green BMS system, you have to install the following Open Source Applications:

    To perform hardware modifications on project, you need the following Open Source Applications:

    To perform modifications on Green BMS Android App, you have to use the web open source application:

View all 13 instructions

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates