A Battery Management System(BMS) for 2018 rebooted #8

Hi
I’m trying to Use an Arduino/Arduino to make a BMS for my ebike battery, I could just buy one from China but that way I will not know exactly what is going on and rely on faith.

The basic idea is this to be able to manage a battery pack with up to 20 cells in series (more than that and I have to get different speed controllers).

The BMS must be able to mesure cell voltage, the AtoD converter should give me an accuracy of about 0.005v.

A Low Voltage And High Voltage cutoff will be needed to prevent over discharge and charge both settings must be user settable.

To stop the battery pack from getting out of balance there needs to be a balancing system in there.

The cutoff circuit would probably work best with mosfets 1 per 20a.

Unless someone has solved the problem it looks like I am going to have to go for a system with each cell controlled by its own ATtiny45 or 85 the outputs must be optically isolated from a controlling Arduino in the form of probably a nano though the chip from a uno could be used.

There needs to be a way to pole the ATtiny’s so the information from them is recived one at a time, other information to be sent back is to control the balance circuitry (if the cell was high then connect the cell to a power resistor to drain the cell a bit till the cell is in line with the rest).
Once fully charged disconnect the charger from the BMS.

Have a way to connect a display to the BMS to check what the voltage of the cells are, mostly to be used while charging but can be used while the Battery is being discharged.

A possible extra idea would be to put a way to mesure how much power in the form of Watt Hours are being put into the battery how comes out and a way to in effect make a fuel tank gauge.(measuring from full charge to full discharge would be required for that the power would be stored, take a bit then store that as a fuel “tank”size with the energy going down not up.

Kendrick

1 Like

Whew!
That's a heck of a project!

I use a lot of LiIo batteries for various things but nothing that large. But this thread interests me because I have friends with e-bikes and we've discussed battery options and charging.

Please update this thread with your progress. I'm earmarking it to check back on your progress.

Good luck!

I’m going to start small with a 3 cell setup this i should be able to breadboard.
First object is to get the attinys to recognise the LVC and HVC limits I want, for this I will need a few more attinys and a programming card there are plenty of instructions for making the latter on YouTube.
Next I’ll be ordering some optoisolators for the link between the attinys and the Nano.
Kendrick

The LTC6802 (RS components) can monitor/balance 12 cells, and can be daisy-chained.
Might be easier/cheaper than 12 ATtiny and 12 mosfets.
Leo..

I’ve been having some second thoughts instead of using one attiny per cell in series with its internal AtoD use an external AtoD with much higher resoloution to mesure 5 cells at once using a voltage divider to reduce the voltage to the 5v range one of the ADS1115’s with a 16 bit converter should fit the bill. The first cell would use an internal AtoD the rest the AtoD converters in the ADS1115.

That chip has 4 AtoD converters with it the cells could be tested between ground and their cell positive so 1 cell would read the first cell 2 would read the first 2 cells and so on,voltage dividers used where needed except for the first.

The voltage from the previous reading would be taken from the voltage measurement to separate out each cells individual voltage. In theory since 4 of these chips can be inputted into a single Arduino up to 17 cells could be measured but the accuracy would be reduced in the higher cells.

The coding would be more complicated but the reduction in number of components would probably be worth it.

A standard decider would probably be good enough allowing for overvoltage the maximum voltage you will need to read is 4.2v allow a bit of leeway so make it 4.5v per cell that way a 5 to1 decider should work.
I have all the parts needed to make a 5 cell tester at the moment I will just need the circuit for the voltage divider.

I’ll take a look at the LTC6802.
The mosfets are not for use with the attinys they work as an electronic switch to disconnect the battery from the speed controller, I would need one for the charging side of things.

Kendrick

Four voltage dividers will discharge the cells unevenly.

The mosfets in the LTC are for cell balancing during charging time.

Did you consider "flying capacitors" with relays to measure the cells.
That would have zero draw from the cells, and no measurement difference between cells.
Because only one A/D is used.

Battery stack measurement is a frequent subject on this forum.
Search the site (lollypop on top of this page).
Leo..

The LTC would probably be the best way to go but I would need a lot more information about it than I have found so far flying capacitors and relays sounds interesting what type of relay, what does the turm flying capacitors mean and how are they measured.
Kendrick

Kendrick:
what type of relay, what does the turm flying capacitors mean and how are they measured.

Imagine you having to measure the battery of your car,
but you're not allowed to take the expensive digital multimeter out of the lab...

Take a small capacitor, and connect it to the battery of the car.
Voltage on the cap is now the same as the battery.
Throw it to your friend in the lab.
Your friend measures voltage on the cap, writes it down, and throws it back.
You connect it to the car battery again, in case you have to measure it again.
It did come back charged, so no new charge charge from the car battery is used.
This 'throwing' can be done with a small DPDT relay.
Leo..

Pictures of an 8-cell flying cap experiment in post 49 here.
https://forum.arduino.cc/index.php?topic=92074.45

Hi
I have been gathering parts and talking to people on other forums about this and a sister project both are for electric bikes. the second project will be in a different thread when i have all the parts I want for it.

first to the BMS, the goals laid down in the first post have not changed though my method of getting there has.

the BMS will be a modular system with one controlling board and within reason as many sub board each of which are able to work both in conjunction with the main board and stand allown.
First a bit of history that ties in with my concept, about 8 years ago in conjunction with one of the brains on the Endless Sphere electric vehicle forum I developed, had made and sold a small board that would activate a throttle cutoff when any cell in the battery pack reached 3v or 2.1v(depending on chemistry). The boards were small and for the community very useful it was very limited in what it could do and relied on components with fixed values.

Turn the clock forward to about 6 months ago, I had changed over to BMS boards bought over the internet.

One ride halfway through the life of the charge my bike stopped now I always fit external battery monitor connections to my batteries by then and after taking a quick reading I discovered that one of my cells had gone flat with all others reading fine the BMS had saved the battery from fire at the cost of my ride a fair price to pay what was not such a fair price to pay was repairing the battery pack.

The battery pack was fairly new so replacing cells would not cause an unbalanced pack as far as lifetime was concerned, the cost was more than I expected my battery pack is not made of individual cells that I put together myself but of premade packs of cells that I then joined together in both series and parallel making a large pack.
A standard BMS is designed to monitor the cells in series to monitor every cell all cells that are in parallel are joined together with all positives linked and all negatives linked then the linked cells have wires going to the BMS.
As the cells are joined in parallel when on goes down the whole row of parallel cells go down and since the original packs I had made the battery from are spot welded together it takes out the whole row of packs in the battery pack I had made that should have been 4 packs at £30 each that was going to be a bill of £120, for some reason one of the packs balance wires had come off that saved me £30 and gave me the incentive and idea for this project instead of a BMS that monitored cells in parallel , have a BMs that monitors each cell individually or in the case of Lithium Ion maybe packs of 4 cells in parallel.
kendrick

After a long winded trip down memory lane time to get to business.
The small sub boards will be doing most of the work with a central master board handing out instructions and overseeing everything.
Due to the the screen I have chosen when I need a display or to alter things I have chosen a board built around a mega2560 it will have room for extra sub programs that I may well need to include.

the sub boards which am nicknaming minions will have very limited functions but what they can do will be vital.
each board will be linked to 4 cells in series the function is to monitor, balance and generally protect the cells from harm. the monitoring will bee done with an ADS1115 AtoD converter, the balancing will be done with a bank of power resistors controlled by a PCF8574.
The board will talk to the main board through the I2C bus with an I2C isolator used to allow for the problems with having a common ground. Each board will be powered from a step up converter powered by the first cell, it will be switched on with an opto isolator connected to the main board. for a controlling chip I hope to use a ATtiny85 SMD, Im hoping that I can set up 2 I2C busses on the ATtiny85 one for the board with the tiny the master the other to talk to the main board in which it will be a slave no other pins are needed on the tiny so with luck can be used for this purpose.
kendrick.

after an evening watching attiny85 videos with the last thinking a mega168 would be a better option, I then checked aliexpress for the cost of mega 168 vs attiny85 and found the mega was cheaper, I've put 10 on order plus a nano and pro mini 168. With the mega 168 I can drop the PCF8574 the mega 168 has enough pins for the job.
kendrick

following. I need to develop a similar device, needs to have 12v output, around 20aH or more, made up of 3500mah 18650's (or 5000mah 26650's, I have access to both, direct from efest) that once connected to a power source will isolate and charge each cell, balance the cells, and also offer an oled to monitor it all, and also switch the output on and off, from the oled screen. I have absolutely no idea what I am doing btw, 100% new not just to arduino, but to electronics as well.

I too am interested in seeing where this goes ...

Given the HUGE range of IC's that are available to work with BMS systems, I'm interested to see why people choose different options.

I am new to Arduino and electronics and so see the BMS as an option for a good project (for a powerwall) but wonder if it is the bets way.

Cheers.

A BMS has to do more than just measure the individual cell voltages.
It has to regulate the current flow thru each cell when charging to make sure that all the cells get fully charged.
Its not by any means a beginner project, and if you have to ask how to make one , then forget it.

Hi
I’ve been working on the circuit on my own for a while trying to iron out the kinks and take advise from other places.
The results of my work are that what I need is not a true BMS but a battery protection system that protects the cells from over charging and over discharging what I would call a LVC HVC(low voltage circuit,high voltage circuit) I made an analog version of that a long time ago, this would be programmable soo could set the voltages, since the voltages of all the cells are sent back to the central controller it will also be able to tell how out of balance the cells are, cell balancing will be needed every so often so with that in mind I’m making a cell balancing device, the RC world have had one for several years now called a battery medic but it is frankly not very good.
I intend to make a version of it that is on steroids so to speak the battery medic can take a day to balance a battery pack that is well out of balance due to using banks of small wattage SMD resistors I will be using 10 w resistors should only take about an hour.
As for the discharge protection circuit if you choose your battery discharge ratings correctly that will not matter, if required that can be added to the power output from the main board.
Kendrick