arduino based BMS

Farfle

100 kW
Joined
Jun 27, 2010
Messages
1,759
Location
Redmond OR
Search didn't turn up anything, so ill toss this out here.
So, an arduino mega (about 60 bucks) has 16 0-5v analog inputs and 50 odd digital low/high input/outputs. So was thinking about making a simple 16s bms where the analog inputs watch the cell voltage, and the digital outputs run small relays/transistors to a shunt resistor. The inputs and outputs are isolated. Going to try it with a single cell to see where I can get with it. may be a decent expandable setup for 8s or 16s increments. anybody have any inputs on this?
 
I don't beleive the IOs are isolated, they all reference a common ground and 5V, and report the analog signal relative to those. So it may work for the first cell, but you would need to isolate the voltages off all the other cells.

- Adrian
 
Adrian nailed the basic issue. Everything is referenced to the chip ground. So you either resistively divide the voltages down and lose resolution (and you only have 10 bits already), or you use differential amplifiers on each cell to re-reference the cell voltage to chip ground. The CellLog does something like this and the schematics are floating around ES as I recall.
 
Google for Arduino. They are an AVR based hobbyist board with a couple different chips. The Mega uses a mega256 AVR, The Uno uses a 328. They have written a nice IDE that is easy to install and they have a really easy system for loading software. It is open and based on GCC-AVR. With lots of examples and documentation it is a good way for folks to get started on micros and do little projects. See Sparkfun.com for some examples.
 
I do lots of Arduino stuff. It's great.

For a BMS, it's about the worst possible thing to use though. You would need a voltage divider for every cell because the inputs are all ground referenced with 5v maximum's, so your bottom cell would have great measurement accuracy, and your top cell would be wildly inaccurate. Then you gotta have isolation for your balancing, through opto's to fet drivers to fets, or through relays, either option is going to be bulky and costly and lame.

Ti makes some chips that each measure 12 cells, you stack them on each other in series, up to like 400cells in series, they are powered by the cells themselves (drawing current evenly, and only uA's), and the whole stack has isolated communication between itself to output SPI bus to a uController of your choice to take the measurement data from each chip and choose to turn on or off the bleed resistor (or whatever you want) as you please.

If you're just making one for yourself, you can buy the developer kit from them for a few hundred bucks to learn (it only does 12 cells), and then once you've learned the architecture, you can spin your own board to do whatever number of channels you require.

I would plan on spending 200hours and no less than $5,000usd to get your first working prototype.
 
I've been thinking about a similar project...but not for a BMS per se. Rather, more for just data collection and monitoring. For monitoring the voltage on a cell level, I've found it's better to approach things with a multiplexer design: Buy a few really nice differntial ADC's,(that solves the need for dividers and common grounds and gets you out of the lame 10-it world), then use cheap CMOS multiplexer chips to switch in the cell voltages. Drive the switches with a latching shift register. Use ADC's with SPI bus to the micro. Program in offsets and non-linearities into the micro for the on resistance of each CMOS switch channel.

You could still take pack wide actions with the micro (like alarms or throttle cuts) but like LFP said, trying to balance with it will be clunky.
 
Aah, knew it couldn't be that easy. Although now I have a pretty sweet single cell balancer set up right now, :roll: it does over/under voltage, temperature and cell voltage logging. I'm just glad I didn't plug in that second cell... Prob would have cooked the poor thing feeding it almost 9v. I guess ill just wait in line for GGoodrum's BMS.
 
Here is a drawing I made of a single cell ATTiny 45 based BMS or balancing charger setup. I haven't built it so there may be issues to resolve.

To use something like this with the Arduino environment one would probably set up the Arduino as a programmer and program the chip off-board, then use a socket on the BMS board, or the ISP programming connector could be used as shown in this schematic.

bms8mpc001.jpg


An Arduino could be used as the "master" Micro (the one at the bottom of the schematic). If a small PC board was designed for one "cell" of the circuit it would be pretty straightforward to make a bunch of them.
 
The most exciting thing in my book is that google teamed with audriono. Meaning, now you can use any android device to interface with a an aurdriono. Instead of 4 cell logs, a temp monitor, and a cycle anaylst, you could get away with just one aurdriono and one of those $50 android PDAs.

Really wish more people in this forums could build stuff like that because it could solve a great deal of issues for us.
 
Is this a dead idea amongst the ES crowd, or is it an active project under another name??

I have spent considerable time trying to resolve the many issues surrounding the design and placement of a circuit for this requirement and isolation is a big issue... I have many solutions to this, none are perfect... some are more accurate at the expense of complexity and some are more simple and inexpensive but provide a cheap HVC/LVC using a handful of parts and an MCU to oversee everything.

Just thought I would bump this up and see if anything interesting shakes loose ?

-Mike
 
I too want to build an arduino lipo cell monitor. Each analog connect can detect up to 5v so i guess that it is good for measuring a single cell voltage ie 3.7v to 4.2v I thought of basically using dpdt optical relays to cycle through each cell so that the arduino is in effect measuring each cell akin to a human moving both voltmeter probes up the jst-xh balance connector. Code would be fairly easy to adapt for any number of cells in series as the arduino would test one at a time and placing the value into an array the size of the number of cells in series. then the data could be logged and output to a screen on a phone/lcd on the handle bars.

Found that opto relays are expensive for this and not sure how efficient. I do think that the idea is sound but not sure about how to get it to work, any ideas?

I already thought about voltage dividers but figured I dont want to lose resolution and want to use the other analog connects for other devices ie temp monitoring etc.

I can definately programs the java/arduino but im quite limited on my hardware electronics knowledge.
 
How do you plan to power the Arduino?

All the inputs are relative to the power source ground. So if for example you are power the arduino from the tha battery you are measuring, you would still ahve the same issue when trying to measure cells 2 and above. In that the voltage will be > 5v above GND.
 
ah ok, I get what you are saying, I wonder whether the arduino would stay on via switching power input at the same time as it the relay changes to get to the next cell, im guessing not though, also dont want to burn my arduino finding out. back to the drawing board. Anyone else got suggestions?
 
As someone already said, using an arduino to monitor more than 2 or 3 cells really is a bad option.

Having said that, and if you're doing it just for the fun and forgetting about practicality, relays switch in a few ms, so with a big capacitor at the arduino power input, it can hang on during the switching. Even if it didn't, you could probably just let it reset (save last read cell on EEPROM before power switch, just don't do it many times - relays aren't made to be switched many times anyhow). But that's not the end of your problems, just the beginning. Maybe better to have the arduino powered from its own battery and use relays to choose the cell, this way the isolation problem goes away.
 
Hello all;

Since it seems I began the debate again but have not explained some solutions.

Devices like the LT6802/6803 are nice but they get expensive fast.

Those who think that you can just hook x cells to x micro controller inputs, even through a multiplexer - wrong - it would dead short and burn up the chips and or the packs.

Another issue (as I previously mentioned) is to keep costs down you want to do a resistor divider network of high precision (cheap as dirt) but that maxes about 5 or 6 cells per MCU and would suffice.

Then we add the issue of isolating the battery inputs by not just an input resistor on each line between 1k and 10K but rather with a reversed biased SMT NPN transistor - acting as an infinite disconnect to the circuit so the resistor / divider network doesn't consume power while not measuring the input...

Once the MCU code connects a cells transistors to establish a circuit - there could be a few problems:
1.) Unless we sample the voltage into a capacitor which is isolated from the circuit (similar fet fashion), then once the sample is collected connect to the ADC to measure it (isolation)
2.) *Provide actual isolation of the power supply before enumerating the cell voltages, this means what it seems like - adding a 1-2s cell pack of perhaps 300mv (think pico chopper) which is self powered
3.) etc, etc,

That is the only way I can conceive to provide accurate measurements using 10 bit ADC conversions and an input scale of 0-5v

Short of adding an attiny85 for each 2 cells which would work but again require more parts and signal isolation, adding to complexity...

At this point i have done slave modules using this method and am debugging the client / master protocol to see what timing we could expect but I think I will settle on what I refer to as a capacitor shuffle... its' actually going to end up (if done correctly) simply using a gated load switch to go between the measurement capacitor (R/C) and analog input A0 - A# while using an isolated lipo power supply.

I know this sounds odd, it should - but it allows a floating ground and that means the 2.5v - 4.25v range we are interested in (LiPoly) is scaleable to 0-5v for best resolution steps in analog values.

If this makes little sense, sorry... I'll begin a thread to walk everyone through the various redesigns I've visited over the past weeks (short project my ass) and what I end up with (not there yet, still testing)... Schematics, Eagle Files and CAM files + Source Code.

ATTiny85 is a great chip btw - and with I believe 1.25v - 5v power supply it's very accurate and stable, the ideal single cell powered channel but the issue remains of how to connect them since they will all have a higher potential ground, optical isolation is the only real solution (there are others - not economical though) so 12 Cells would be 6 dual channel opto couplers - the Atmega328P have 14 dedicated digital IO lines - which handle the required opto-isolated input perfectly, receiving voltages - or at first just alarms.

More to follow....

-Mike
 
I recently found some low cost optical isolators in quantity. Have been researching similar ideas for a year or so. I have not settled on a design but am leaning toward an ATTiny45 or ATTiny44 per cell group.

The master CPU could be an Arduino talking via an optically isolated bus to the per cell CPUs. By designing around available low cost parts the per cell cost can be pretty low. My designs have had around 12-15 parts per cell group. The optos were a big part of the cost, but now we've fixed that. Surface mount makes it small and much less work to build, and lowers cost for manufacturing in quantity.
 
walls99 said:
quote]
Anyone knocking these out yet brother, these sound like the buis, best thing since proverbial sliced cheese.
 
Back
Top