DIY Arduino BMS

elkooo

Member
Joined
Aug 9, 2019
Messages
32
Hi

I don't want to spend 1K$ for a Batrium. So I decided to do my own BMS. I already have some Ideas how I would like to solve it on the hardware side (see schematics conceptenclosed).


image_pvniib.jpg


The CPU unit will be an ATmega.
It will measure each cell in cycles. To overcome common-ground-issues, I will do this by charging a capacitor and measure its voltage. This can be done by connecting the capacitor with two reed-relays to each of the cells in cycles. It balances its Voltage to the cell voltage very quickly, is then disconnected from the cells an connected to the CPU to measure its Voltage.
If one cell block is high by a defined amount against the other blocks, another relay triggers the discharge unit for a defined amount of time / measuring cycles to drain some power from it until it is equalized again.

Low voltage cutoff and so on can all be controlled by the CPU and are matter of programming.

Let me know what you think about it. I am also happy to hear your opinion on thechoice of components (or where I didn't yet choose, let me know if you have a proposal... MOSFET...)since I don't have a lot of electronics experience just now. Still learning ;)


Cheers,
elkooo
 
  • Like
Reactions: jm1
Not to dissuade you from doing your own work, but have you looked at Stuart Pittaways bms?
 
Only had a quick look and I've never designed a BMS, but...

The MOSFET should have a pull down resistor (10k~100k range?) to the negative side of the LiIon cell. Otherwise it could stay turned on for much longer than intended.

1Ohm bypass resistor is quite ambitious. That's up to 18W. You will need a fan, overheat protection, etc. Depends on the size of your battery, but 4Ohm or more with logic to turn it on earlier will make life a lot easier.

You might want to add capacitors in the sensing lines to make sure that current will not flow even if the reed switches should malfunction or get bad signals.
 
OK so I did a bit more of research.
Thanks for the inputs so far.

@ajw22:
I didn't quite understand, where and why to put capacitors into the sensing line... can you further explain?

Here is my version two:



image_xolrlh.jpg
 
You need to be measuring each cell voltage every few seconds.
At this speed, I suspect you will quickly get reliability issues with the relays.
If you get a relay fault you could short your cells = not fun.
Doing individual boards powered by each cell & isolating the communications is a much better approach.
 
Redpacket said:
You need to be measuring each cell voltage every few seconds.
At this speed, I suspect you will quickly get reliability issues with the relays.
If you get a relay fault you could short your cells = not fun.
Doing individual boards powered by each cell & isolating the communications is a much better approach.
Amount of cycles depends alot on the algorithm used to measure.
I think I don't have to permanently measure each cell every few seconds (If you alsohave a total voltage measurement, you can leave the cell level voltage measurements cycles be much longer in the not fully charged / discharged stage).

For Example:
Only measure every 5mins (or even longer cycles) if cells are >3.3v & <3.9v
Go to more dense measuring cycle if total voltage goes below/above calculated single cell threshold values

If the capacity is known and the charging current is known, then the time until theoretically a higher stage of charge is achieved can be calculated.

I don't know the cycle-life of these reed-switches, possibly they do 500'000 cycles?
So if I measure every minute they will be gone in..... 347days?!?! wow! ok... didn't expect that... so even if I only measure every 5 mins, this will mean my relays will go throgh half a million cycles in five years, which is A LOT!

true -maybe have to find another solution... either much longer cycles between measurements or other components...? Maybe via opto couplers?




So... If I want to do individual boards, would I need an ATtiny or something like that?

Problem is: So far I don't have any expiriance with those... still learning ;) :idea: :huh: :angel:

Thanks for your thoughts anyways!
 
I agree that you need to meassure often. A cell can easy go from 3.3 to 2.0v in under 30 seconds. You should meassure every other second. IF you want a Good bms functionality that is.
 
OK - this clearly speaks for another solution.

But on the other hand would such voltage drops also be visible on the total pack voltage (very unlikely that one cell goes up alot while another goes down alot as you might be drawing amps from all cells in the same string...). And upon such a drop (with already near 3v/cell) the algorithm of the BMS could be forced to check on the cell level what is going on... even more so if the CPU knows the amp-draw. If the voltage level gets below a certain point (which with 3.3v/cell is maybe to low...) a closer per-cell-monitoring could be triggered.
Further more (and for the sake of having a longer battery life) I don't plan to drain the last out of my batteries and maybe also don't fully charge them to 4.2v

Nevertheless should the system be able to operate propperly for many years, I agree, and also should it do so reliably and in the best case even out of planned specs in case anything goes wrong...

further to this I will plan to add glass fuses to the measuring lines. Would probbably be a good Idea no matter how I finally gonna measure the cell voltage.
 
  • Like
Reactions: jm1
SOOO,

I went back to the drawing board.
Why I do it myself instead of using one existing solution?

I love doing it the hard way. And I like to know the stuff I build. If I just copy something, I will never have the same understanding and will not be able to optimize and tweak it as well to my needs as if I develop everything from scratch. Already learned a lot & love to learn more every day.

What I came up with so far is the following:

image_kwyeqm.jpg


Looking forward to hear your opinion...
 
Potential issues I see:

* If the fuse for cell#1 blows, and the cell#2 "above" is in bypass mode, the ATiny13#1 chip could be exposed to up to 8.4V? A zener diode to limit the max voltage to a safe limit might be in order. Though that will overheat in short order... but voltage#1 will increase and bypass#1 should activate...
At the same time ATiny#2 would crash due to low voltage... Good luck figuring that out :-(

* Doesn't the ATiny13 chip need a VCC-GND capacitor near it? Esp if you need to accurately measure VCC?

* With the ATiny13 IO driving the MOSFET, a pull down resistor is probably no longer needed
 
A youtube guy @Adam Welch did his own custom BMS for a 7s lithium battery bank - there are several youtubes and follow up with interesting problems. It also supports full graphical monitoring.

Here's a recent one: A year with the diyBMS
Here's an earlier one: diyBMS - Provisioning and Calibrating - 12v Solar Shed

and there are more going thru the whole process and electrical diagrams.

I'm doing Batrium as this kind of electronics is beyond me, but @Adam Welch seems like a serious, electrical circuit guy and his efforts seem like a pretty sophisticated solution for those wanting to wire up their own.
 
OffGridInTheCity said:
@Adam Welch seems like a serious, electrical circuit guy and his efforts seem like a pretty sophisticated solution

This is also stuart pittaways BMS. It is for sure interesting BUT I will learn more doing it the hard way from scratch (also it is easier for me to learn if I start from zero rather than reading countless documents of specification of a already grown / built project).

ajw22 said:
Potential issues I see

Really good points. :idea:
Concerning fuses: the easiest solution might just be two fuses for each bord or separate leads to the boards to solve the problem.
This way, each BMS-Board would probbably work isolated? If one fuse blows, the next board is still connected correctly and should not see more than the actual cell voltage.

Concerning Condensators: added & understood...

PullDown: maybe a large value resistor will be better than none? Leave it for now but I'll keep your remark in mind...

Also I had some mistakes with resistors / missing pulldowns which I corrected... see attached updated drawings..


image_zszyul.jpg
 
Those ATtiny13 measuring/balancing modules are going to be 14x separate boards sitting on each cell pack, like with Batrium, right?
I think you can just fuse each positive side, and remove the negative side fuse.

How about adding a 5V fan in parallel with your balancing resistor? Wastes more power, and cools the resistor all at the same time.

Some of the ATtiny13 IO ports have internal pull-ups. You could reduce hardware and wiring by enabling that for the RX.

You may want to add a button and signaling LED to make the boards more admin friendly.
The button could be used to program the position of the device (#1~#14). You could hard program that, but long term a button will be more convenient.
And the LED to help locate the offending pack. It quickly gets confusing with multiple strings of 14 packs. How many hours I've wasted fixing a perfectly healthy pack, while the faulty pack was sitting one shelf below :-(
 
elkooo said:
Why I do it myself instead of using one existing solution?

I love doing it the hard way. And I like to know the stuff I build. If I just copy something, I will never have the same understanding and will not be able to optimize and tweak it as well to my needs as if I develop everything from scratch. Already learned a lot & love to learn more every day.

I totally agree. I've been working on my own BMS for exactly the same reason.

elkooo said:
Looking forward to hear your opinion...

I notice you have opted for the ATTiny13A. I started out using that on my BMS design, but quickly found it to be false economy trying to go too cheap on the microcontroller. It only has 1K of code space and I used a good chunk of that just implementing some comms since there are no hardware comms interfaces provided. Also there is only one timer that then has to be shared between bit banging the comms and timing other events like when to take the next voltage reading. I'm not saying it can't be done, but it sure makes it hard.


Also I'm pretty sure, on the tiny13, you can't use the trick of measuring your own VCC like some of the AVR's do. So you'll have to add a potential divider and connect that to an ADC pin to get your voltage readings.


In the end I went with the ATMEGA328PB. From Farnell (Element14) they are less that 1 each in lots of 25 in the UK. This then gave me more options like having multiple thermistor inputs and some status leds, and I can simply use Arduino to write and upload the code.
 
If going for a more powerful chip, the ADUM1250 for isolated i2c communication might be interesting. About $1 on aliexpress.
I've not used this chip, but i2c is awesome... hardware support on so many chips, and easy to add more modules to the system, eg. small LCD, temperature sensor, etc
 
ajw22 said:
If going for a more powerful chip, the ADUM1250 for isolated i2c communication might be interesting. About $1 on aliexpress.
I've not used this chip, but i2c is awesome... hardware support on so many chips, and easy to add more modules to the system, eg. small LCD, temperature sensor, etc

In my opinion a uart based communication method is a better fit for this application. I2C relies on signal transitions to clock the bits through. The problem with that is that the switch mode inverters and chargers that we connect to the batteries can generate a lot of noise and transients that can get onto the data lines and create false positives making them unreliable. Uart signals are less susceptible because they are mostly time based, so there is significantly less chance of a stray transient on the line at the exact time the hardware samples the data.
 
That's looking better :)
The optocouplers will give you the voltage isolation & let you talk to each chip with some addressing, etc.

You might want to have separate + & - wires to each cell because if one cell is bypassing, the little extra drop across the fuse will (& does) affect the next unit's readings.
 
i have done something similar for my 4s test pack using 5 pro mini's each have a nrf24l01 module to send data to master. IRFZ44N mosfets with 5ohm 5W resistors for balance. pro minis are 3.3v and i have removed regulators on board and supplied power to VCC.
 
So....

I did a bit of research and found, that the ATmega328P-PU chip also works with very low voltage (down to 1.8v as per spec-sheet) and is capable of running on an internal clock. Basically it can run in a similar environment as the ATtiny but has much more memory and a lot more options (more i/o's etc). The price is as low as 1.2$ each so it is also in the similar range as the ATtiny. Therefore I decided to use the ATmega.

I have ordered some equipment to programm the bare chips (already have some here) and will post about the ongoing process...
As soon as I have a better picture of how the ATmega works and what I will need, I'll also update the scematics.
 
Back
Top