Close
0%
0%

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!

VIDEO PRESENTATION

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

Cell Module description is available on this page: https://hackaday.io/project/181453-green-bms/log/198376-cell-module


CONTROL UNIT

Control Unit description is available on this page: https://hackaday.io/project/181453-green-bms/log/198414-green-bms-control-unit


LIMITER

The BMS Battery Management System Limiter is described here: https://hackaday.io/project/181453-green-bms/log/198378-limiter



GREEN BMS ANDROID APP

Green BMS Android app  is described here: https://hackaday.io/project/181453-green-bms/log/198377-green-bms-android-app


OPENSOURCE HARDWARE CERTIFICATION

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


LICENSE

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

  • Design challenge n.7: the fuse voltage drop

    Green-bms2 days ago 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? No...it 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

    Green-bms2 days ago 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?

    Green-bms3 days ago 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 currents...it 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

    Green-bms5 days ago 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!

    Panic…

    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:

  • Design Challenge n.3: How to program Attiny without disconnect the module from the cell

    Green-bms7 days ago 0 comments

    The problem of the separation of the power supplies also arrived as regards the loading of the software in the memory of the Attiny controller.

    To program Attiny microcontroller I used the Arduino as isp programmer, realized by Arduino Uno board.

    But how to connect the programmer (signals powered by the Arduino UNO 5v supplied by the PC USB) with the Attiny microcontroller powered by the lithium cell?

    How to separate the power supplies?

    To solve this question I decided to carry out a hardware separation by means of jumpers connected to 2 connectors:

    Connectors inserted = battery power supply

    Connectors removed = it is possible to connect the programmer isolated from the battery

    This technical solution, in addition to allowing the software upgrade without removing the module from the cell, also allows you to:

    - remove power from the module (recommended during installation and removal of the module)

    - perform a hardware reset of the module, avoiding the installation of the reset button

  • Design challenge n.2: what is the best way to set the cell address?

    Green-bms10/10/2021 at 06:51 0 comments

    The address of each single cell is written in a variable within the sketch of the Attiny controller:

    TinyWireS.begin (address);

    Obviously I couldn't create a sketch for each cell, it would have been a terrible project and impossible to manage !!!

    Imagine each software release having to create n different sketches ..

    So the challenge was to find a simple and user friendly way to be able to set the address of the cells, keeping a single sketch.

    The first idea I had was to install a dip switch in each cell module.

     I immediately put this solution aside, because it had a huge limit:

    In order to manage a large number of cells (in perspective I would like to reach at least 72 cells) I would have had to use a 7-position dip switch.

    6 bits = 64 addresses

    This choice would have occupied too many I / O pins of the microcontroller!

    So after some tests I found the solution I was looking for:

    I used 2 buttons and 2 LEDs.

    I have created a "programming" mode that can be activated or deactivated by pressing the 2 buttons simultaneously

    I gave the user the possibility to set the cell address by setting the units (first button) and tens (second button).

    The number of blinks of the LEDs is the feedback that indicates to the user how many units and how many tens.

    When the user exits the programming mode, the set address is permanently saved in the Eeprom of the microcontroller.

    So by occupying 4 pins, I created a solution that allows you to reach 99 addresses!

    This design hurdle has also been overcome!

    Here is a video that shows in practice how to set the address of each cell:


  • Design challenge n.1: system architecture and bus isolation

    Green-bms10/09/2021 at 10:00 0 comments

    The BMS I had in mind consisted of a cell module screwed directly to the poles.

    To make it smart I had to use a microcontroller.

    The best choice was to use an ATTiny Microcontroller ATTiny84A powered directly from the cell.

    For the control unit I immediately had in mind to use the Arduino Mega board, a very popular board, with widespread online support.

    But how to manage the dialogue between Mega and the various ATTiny's?

    Among the various possibilities I chose to use an I2c network, because from the programming point of view it was the simplest and safest way, thanks to the libraries available online.

    But the first question was: how can I connect devices that have different power supplies (which absolutely must remain separate) communicate on the same bus?

    Fortunately, a suitable component came to my aid: Adum1250, a bidirectional digital isolator.

    So I bought the various components, networked them together in a breadboard, addressed them and started reading and writing bytes between Arduino Mega and  Attiny's.

    The result was satisfactory and from this test I was able to say:

    "IT CAN BE DONE !!!"

  • Balancing Check

    Green-bms10/03/2021 at 15:50 0 comments

    Passive Balancing

    Green BMS cell modules carry out the passive balancing. What does it mean?
    When the cell reaches the user defined balance threshold, the BMS circuit connects a power resistor of approximately 3 ohms as load to the cell, in order to discharge the cell to help the entire battery pack balancing.


    In many BMS systems, the verification of the correct functioning of the balancing circuit is difficult to carry out, because it is necessary to create the unbalanced conditions of the cells, moreover in many cases it is impossible to test the balancing circuit of all the cells.

    For this reason, when designing Green BMS, I wanted to add a test function that I think is important: the balancing check.



    Balancing Check

    The operation is very simple: you have to connect to your battery pack using the Green BMS App and press the button relating to the cell whose balancing circuit you want to test.


    At the same time you must check the status of the LEDs on the cell module and make sure that the “Balancing OK” LED lights up and the “Communication LEDs” alternate fast and intermittently.

    During balancing test you can also check the real balancing current measuring the voltage drop across the resistors and applying the Ohm’s law formula Ibal = V / R (R=3ohm).


    How to perform balancing check video tutorial

    In the following video I show you how to perform this test.
    bye bye

  • Where to buy

    Green-bms10/03/2021 at 15:37 0 comments

    Green BMS is an open source project, so you can download the gerber files from download page and you can buy the cards wherever you want.

    Alternatively you can purchase Green BMS components on PCBway Store.

    For each component there is the possibility to buy only the PCB by carrying out the do-it-yourself assembly, or ask PCBway for a quote to receive the board already assembled, using the BOM file included in the product page.

    If you are not yet subscribed to PCBway, you can do it at my invitation link: https://www.pcbway.com/setinvite.aspx?inviteid=436793

    These are the pages where you can buy the PCB's:

    Cell module ver. 0.2

    Interface Board ver. 0.1

  • GREEN BMS CONTROL UNIT

    Green-bms10/01/2021 at 17:01 0 comments

    CONTROL UNIT DESCRIPTION

    Control Unit is the BMS main unit, it is based on Opensource Microcontroller Arduino Mega. Control Unit functions are:

    • Communicating by I2c with all the cell modules of the battery pack
    • To receive from cell modules the values of: cell voltage, cell pole temperature, balancing resistor temperature for battery pack management system
    • Sending to cell modules the balancing command
    • To perform the following safety functions by relays:
    • Charge ok: open two relays contact when just one cell of the pack reach the high value or I2C communication with Cell modules is loss
    • Discharge ok: open a relay contact when just one cell of the pack goes down the minimum value or I2C communication with Cell modules is loss
    • Alarm led: close a contact to supply a led in case of alarm
    • Balancing: close a contact when just one cell of the pack is balancing: Green BMS System uses this signal to reduce the charging current (see Green BMS Limiter)
    • System OK: closes the contact when the Control Unit has to switch off to avoid unnecessary consumption. Green BMS System uses this signal to drive an external power stop circuit to the Control Unit.
    • To communicate with an Android device by a Bluetooth module. (see Green BMS Android app)

    Through the android application it is possible to perform the BMS calibrations: System stores all the parameters in the Eeprom memory of the Arduino Mega Microcontroller inside Control Unit.

    CONTROL UNIT HARDWARE

    The picture above shows the main components of the Control Unit. Arduino Mega is the backplane of Control Unit, it must supplied at 12vdc by the relevant connector.

    To supply Arduino Mega and all the Control Unit functions, You must use a DC-DC converter to convert the total battery pack to 12vdc.

    Arduino Mega is a commercially available Opensource card.

    The Interface board is inserted above the Arduino Mega.

    The interface board includes the control unit input / output connectors. The interface board includes a watchdog circuit that de-energizes the relays in the event of a software crash. The mini output relays (12vdc coil) are driven by a driver IC.

    IMPORTANT: the maximum current supported by the relay contacts is 1A, do not use these contacts directly in the battery charge-discharge circuits, but use them to drive power relays!

    The control unit has an average consumption of 5.5 watts. If you always leave it powered, even when it is not needed, it can discharge the battery pack in a few days! For this reason it is absolutely necessary that the 12v power supply circuit be designed so as to switch off the Control Unit when the discharge or charge operations are not active. In any case, it is advisable to keep the battery pack charged after each discharge and in case of prolonged periods of inactivity of the battery, provide for a weekly charge.

    Interface Board PCB was designed with Kicad Opensource application.

    Control Unit transparent plexiglass Case cut-out drawing, was designed with Opensource 2D cad Librecad.

    All project files are available in the Github repository

    CONTROL UNIT SOFTWARE

    The software present in the Arduino Mega was developed using the Opensource Arduino IDE application

    The software is loaded using a standard USB cable (generally provided with Arduino Mega), connected on the relevant port.

    You can download it in the Github repository.

View all 13 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?

Share

Discussions

Similar Projects

Does this project spark your interest?

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