Building a cheap, acurate, AND Efficient arduino controlled cell tester from scratch!

walterwitt

New member
Joined
May 26, 2020
Messages
6
Hello Everyone, This is my first post to this forum, So I hope there aren't any issues with this post, But as you can probably gather from the title, I'm working on something that I'm quiteexcited to share.

Also, sorry for anybad spelling, crappy handwriting, and otherwise unclear info. I'm a native English speaker, but that doesn't stop be from being shit at it.

Basically this is what my hopes are for this project. An 18650 Cell Tester that:

  • Is cheap to make, using mostlycomponents that cost less than a dolar, and manyonly a few cents.
  • Is accurate to within a single mAH and can measureand maintainCurrent to within 1mA and Voltage to within 5mV, on each cell.
  • Uses energy from cells being discharged to charge other cells in preparation for testing.
Now, I know this all sounds ambitious, and being that I'm still building the thing, There are probably many challenges I haven't even consideredI might face, but so far, with the tests I've done so far, Things are looking promising. Ether that, or I have no Idea what I'm doing and everything will end in tears. Either way, I'm having fun right now.

Now, here's how This thing is supposed to work, I'll have a power supply, and stable precise 1A DC load creating a 1A circuit that will use relays, to insert, remove, and reverse cells into the circuit. The voltage and current of each cell will be monitored by the Arduino, which will log all the measurements to an SD card, and control the charging and discharging of each cell, via the relays.

Now, to explain the challenges faced with this design, and how exactly I'm dealing with them, here is the circuit diagram for 1 cell channel.

image_avtpxd.jpg


Now, I know this looks like allot for each individual channel, but here's all that built onto a PCB that will have 4 of these channels on it. All of the above diagram is contained almost entirely within the width of the relays.

image_aeayxe.jpg


So, lets start with how the relays are done.Each cell is connected to 2 relays(bottom left of the diagram, top right of the picture) which are controlled by the Arduino using a high powershift register. The first isa SPDT relay at the bottom, which controls whether or not the cell is connected to the 1A circuit, or bypassed. The second relay switches the direction the cell is connected, to ether be charged, or discharged.

By having all cells connect themselves in series, I only have to have 1 accuratecurrent control, and each cell is being given and loaded with the exact same current keeping everything consistent between all the channels.

Now, the first issue to deal with is how do I do the CV portion of charging, if the cell is in a fixed 1A circuit. The solution I'm using is a TL431 Shunt regulator used in conjunction with a PNP power transistor to act as a voltage limiter. You can see this portion around the top middle of the diagram with a circle around it. When the 2nd relay is set to discharge (Un-powered) This portion of the circuit is bypassed, with only the resistor divider pulling any current. When the Relay is switched to charge, then theTL431 (Looks like a zener diode with a 3rd terminal) receives power via the 470 ohm resistor, and if it has more than 2.5V on it's Reference pin, it will pull down on the PNP's base causing extra current to start flowing through it, rather than the cell. The resistor divider on the reference pin has a 10K ohm trim pot so the Voltage limit can be set precisely. I've already tested this portion of the circuit on it's own and when the battery is below the set voltage, the hole circuit only draws 0.25mA, but when the cell voltage passed 4.188V (4.200V set point) it started pulling all the extra current just as expected until it reached it's set point right around 0.5A witch it maintained all the way until the 0.1A cut off at which point the Arduino would disconnect the cell with relay 1, and put the cell into the default discharge state with relay 2.

This results in an extremely accurate and repeatable charge profile for each cell. Much better than what a TP4056 or even more expensive dedicated chargers can achieve. And you need accurate and repeatable charging in order to have accurate and repeatable discharging.

The 2nd issue is how do you have a micro controller accurately measure the voltage and current of an arbitrarily large number of cells, that are being held at different voltage potentials throughout the circuit. This solution has a few different parts to it. The first thing I'm doing is having the 1A circuit powered from a different isolated supply than the one that powers all of the control and measurement. The two are connected via a normal diode from the control side ground to each channel, witch causes the control side ground to always be no higher than 0.7V above the lowest cell voltage potential.

The 1A supply circuit is pretty simple, here's a block diagram of how it works:

image_tiaprf.jpg

It starts with an isolated DC supply of witch the voltage determines the maximum number of cells that can be charged at the same time with no cells being discharged, which the Arduino will know and keep track of. This DC supply is then fed into a cheap switch-mode DC-DC converter, witch will have it's feedback pin connected to the positive input of the 1A DC load. The positive output of the regulator is connected through the series of battery cells to the positive input of the load. This setup will ensure that so long as the Arduino ensures that the total series voltage doesn't go beyond the maximum range of ether the load or the supply, then the 1A circuit will be maintained. If more cells are being discharged and energy needs to be dumped, then the voltage across the load will go beyond the feedback threshold (typically 1.25V) and the converter will reduce it's output voltage until it shuts down. At which point current can still pass through because of the diode all switch-mode buck converters have. If more cells are being charged, and energy needs to be supplied, then the converter will keep it's voltage output high enough to maintain the minimum operating voltage for the DC load (in my case, 1.25V is enough) until it reaches the supply voltage. At which point it will just stay on, and not be able to go any higher. This state of-course would be one that the Arduino would do what it can to prevent from happening.

As for actually measuring the cell voltages, I'll be using 2 OP-Amps arranged as differential amplifiers to bring the voltages withing the 5V range of the ADC, then all the outputs will be connected to a 16 channel multiplexer which will then be connected to a 16-bit external ADC which finally is connected to the Arduino via the I2c bus. The differential amplifiers are shown on the top right of the diagram. A differential amplifier is another really cool circuit that basically subtracts 2 voltages from each other, and amplifies the difference by a gain set by the resistors. The only special thing that's required for them, is the ratio between the 2 resistor pairs has to be the same, otherwise the gain will change and you won't get accurate readings. What I did for this is I measured a hole bunch (50)of my 10K, 100K, and 56K resistors with my 4 1/2 digit multi-meter, and by doing that I was able to arrange a bunch of matching pairs together (Typically I find at least 15 PAIRS within 0.02% of each-other for 1% resistors on the same strip) and use 2 of them to get approximately the gain I need for each amplifier.

Alright, it's getting late, and I need to sleep, It's almost 3AM where I live, but hopefully that explains enough about what I'm working on for now. I'll probably post some ore info, and maybe answer any questions I might get about this thing tomorrow. Right now, I'm going to mention that there are other safety mechanisms such as cell temperature monitoring, that I will be incorporating, and going over later.

For now, good night, sorry if it's a bit of a mess. like I said, 3AM. I'll probably clean it up more tomorrow.

-Chris
 
That sure sounds like a interesting concept. I've read your post more that once trying to get my head around it.

If I understand correctly, you will have an arbitrary number of cells connected in series. A relay can connect each cell either way round, or bypassed, depending on whether it is being charged, discharged or has finished testing?

At any given time the cells being discharged, are supply the energy to the cells being charged, and the cells being charged are acting as the load for the cells being discharged, supplimented by the isolated power supply or 1A load accordingly?

And to prevent any cell from going overvoltage when charging, the surplus current for that cell is routed around it under control of the TL431?

As far as measuring the voltages, I still haven't got my head around that yet. How are the voltages getting referenced to a common ground in order for the single ADC to accurately measure them?

You have clearly thought a lot about this. I will definitely be watching with interest.
 
The TL431's are nice references :)
Looks like you need to think about the levels of the voltages for the op-amps from each cell in the string, eg cell #1 could be 0V referenced but cell #4 would need to be elevated.
You'd need to current limit the transistor & it'll be dissipating some serious heat.
Consider the op-amps operating ranges - you might be limited to a "24V" system.
Maybe also have a think about the life of dc relay contacts, you may have reliability issues there? Any stuck contacts would cause some serious chaos I think?
All that said, simplicity is good sometimes.
Having the flexibility of a small cpu lets you program voltages & get all sorts of other info flowing but more complexity of course....

Edit: the simplest approach could be to just make it do bypass at x.x volts with the 431, the transistor (maybe p-ch mosfet instead) & a big resistor (instead of dissipating the heat in the transistor) and a LED + a few resistors, etc. No relays this way...
Switching cells in/out/reversed with relays would also mean the load (inverter etc) current is being switched, so large amps & hiccups the load around a lot.

Have you seen the stuart pittaway DIY BMS?
https://secondlifestorage.com/showthread.php?tid=6997
https://github.com/stuartpittaway
 
watts-on said:
That sure sounds like a interesting concept. I've read your post more that once trying to get my head around it.

If I understand correctly, you will have an arbitrary number of cells connected in series. A relay can connect each cell either way round, or bypassed, depending on whether it is being charged, discharged or has finished testing?

At any given time the cells being discharged, are supply the energy to the cells being charged, and the cells being charged are acting as the load for the cells being discharged, supplimented by the isolated power supply or 1A load accordingly?

And to prevent any cell from going overvoltage when charging, the surplus current for that cell is routed around it under control of the TL431?

As far as measuring the voltages, I still haven't got my head around that yet. How are the voltages getting referenced to a common ground in order for the single ADC to accurately measure them?

You have clearly thought a lot about this. I will definitely be watching with interest.
You've got it exactly. And no surprise you didn't quite get the "Measuring the voltages with differential amplifiers part. around that part of the post is where my brain was calling it quits for the night. Here's probably a better explanation for how a differential amplifier works (also where I learned about them from). It's basically able to take 2 inputs at any voltage level, and outputs the difference between the two (multiplied by the gain) relative to a reference (Typically ground). in my circuit, I'm having the outputs referenced to a 2.5V rail, so that the ADC (an ads1115 module) can measure both positive and negative values (specifically for the current).


Another thing that I failed to mention is that the Diff-Amps for measuring the battery voltage have a gain of ~0.5X using pairs of 100K and 56K resistors, and the One measuring the voltage across the current sensing 0.1Ohm resistor has a gain of 10X, using 10K and 100K resistor pairs.



Redpacket



The TL431's are nice references :)
Looks like you need to think about the levels of the voltages for the op-amps from each cell in the string, eg cell #1 could be 0V referenced but cell #4 would need to be elevated.
You'd need to current limit the transistor & it'll be dissipating some serious heat.
Consider the op-amps operating ranges - you might be limited to a "24V" system.
Maybe also have a think about the life of dc relay contacts, you may have reliability issues there? Any stuck contacts would cause some serious chaos I think?
All that said, simplicity is good sometimes.
Having the flexibility of a small cpu lets you program voltages & get all sorts of other info flowing but more complexity of course....

Edit: the simplest approach could be to just make it do bypass at x.x volts with the 431, the transistor (maybe p-ch mosfet instead) & a big resistor (instead of dissipating the heat in the transistor) and a LED + a few resistors, etc. No relays this way...
Switching cells in/out/reversed with relays would also mean the load (inverter etc) current is being switched, so large amps & hiccups the load around a lot.

Have you seen the stuart pittaway DIY BMS?
https://secondlifestorage.com/showthread.php?tid=6997
https://github.com/stuartpittaway



Yes, the TL431's are magical, and I keep finding all sorts of uses for them. and at $0.11 a piece how could I not.

Something else I forgot to mention was the voltage rails. The logic side will be powered from a 12V supply, but I'll have small boost converter (with some heavy output filtering) to create a 30V positive rail for the OP-amps, so I can maximize the usable range.

Another thing that should help with the voltage range problem is that I'll have the Arduino programmed to stagger cells that are charging, and discharging to every other slot, so that it can keep the whole string of cells as close to the same potential as possible. I know that since each cell will be different, I cant always guarantee this, but some clever programing could go a long way.


I guess only time will tell if the relays will remain reliable and not weld themselves in any position. perhaps I'll program in a fail-safe where if the Arduino detects current is still flowing through a cell that should be off, or if it's flowing in the wrong direction, then a single bigger and more robust relay could be used to disconnect the whole series. and a big error would be reported.


I'm not sure I quite understand your edit, are you saying have the cell be bypassed with a dummy load parallel to it? Wouldn't that require it to self regulate so that it ensures no extra current is going in or out of the cell?



The part about the constant switching is probably something I should look into though. might be able to mitigate it with an inductor with a snubber diode.

In other news, I've finished building the 4 channel PCB



image_buvhzt.jpg





image_pzcvxe.jpg

image_rsjkee.jpg






Only thing not done is connecting all the wires from it to the cell holders. that and of course the whole rest of the circuit. But yeah, I have it setup so that I can daisy chain them together. So hopefully soon I'll be able to test the thing and hopefully it won't blow itself up.
 
Your build looks very neatly done, hope it works as expected :)
I read your post as being a BMS not a cell tester so ignore the bypass comments!
If you're just testing cells, is there a reason why you're making it more complex with the cells in series instead of all common negative?

I would probably build with common negative (maybe via current sense resistor)
I would look at an analogue mux chip to sample the voltages & currents into the ADC, you'd get consistent results this way.
Each cell would have a current sense resistor and use maybe a TP5100 switch mode charger circuit?
Maybe a MOSFET & a big resistor per cell for the discharge cycle?
Probably lead to much more stable operation, no relays needed?
 
Heya. Ive just finished doing an arduino 30 slot discharges and gotten within 1mV and 4mA with just the atmega2560. Capture and record to influx dB with barcode scanning for tracking.

If you want simple, use big 10W resistors and a single fet driver. Keeping the ground attachment as close to all negative terminals as possible with zero current flowing through those toe points/bus.


image_ovrici.jpg


I found enamel copper wire works well to hookup battery sockets to fet and resistor.

Also use an external RTC clock to keep the arduino in sync. Time matters when integrating

Ive been adapting a maker space project and adding my own flare :) without going nuclear with individual a lot half bridge push pull control, the next phase is for a slave mux 4-wire board with fixed resistance load.

4wire so I can sample R0, Rcf, Rct, internal resistance, as it discharges by turning the charge off quickly and measuring the instantaneous change in V and I. dV/dI = R0 at 0-0.1s

Using a 4wire test setup I measured this over a discharge cycle


image_nwefqu.jpg


Check out my @ArakniD on GitHub :) it should have at least a bunch of arduino code for you to use, some schematics etc.

Phase2 should be good enough for proper catalogue of used cells. Nuclear option would cost like $20 a slot in BOM. Ekk..

Too new cant post link direct


Phone app to view at runtime to verify connection, startup, mAh volts. Web Influx dB and noderes alerts, barcode scanner for assigning battery to discharge graph.

image_bemtey.jpg


This should make a good start for you :)

Ill post the influx and nodered parts next


image_msehkr.jpg


Calibration dashboard per slot, makes setting vref current and clocks easy


image_hclqvm.jpg



The most basic load resistor and fet discharge setup.. with some Vref, rtc and wifi bridge with an esp32.


image_aljvmi.jpg
 
Araknid said:
Check out my @ArakniD on GitHub :) it should have at least a bunch of arduino code for you to use, some schematics etc.

Phase2 should be good enough for proper catalogue of used cells. Nuclear option would cost like $20 a slot in BOM. Ekk..

Too new cant post link direct






Hi ArakniD,
Where can we learn more about your project? It doesn't seem to be in your github.
 
EVtinkerer said:
Araknid said:
Check out my @ArakniD on GitHub :) it should have at least a bunch of arduino code for you to use, some schematics etc.

Phase2 should be good enough for proper catalogue of used cells. Nuclear option would cost like $20 a slot in BOM. Ekk..

Too new cant post link direct






Hi ArakniD,
Where can we learn more about your project? It doesn't seem to be in your github.



Oh ye sorry, i moves it into our hacker space repo. As it was built off someone elses base and then calibrated to hell.

https://github.com/HSBNE/atmega-18650-discharger
 
@Araknid Is your design only a discharger??
How do you charge your cells?? Do you perform a cycle, of charging, discharging a couple of times to determine cell aging?
 
Using a 4wire test setup I measured this over a discharge cycle


View attachment 12725
I found your diagram about SoC versus internal resistance very interesting. As i assumed (and read) the IR is lowest between low to medium SoC, in your diagram its the area of 15 - 55% SoC but your sample is rather small. I wonder if this is just by chance or would it hold for a bigger sample of 18650s? So that would mean to measure the IR at 50% SoC rather than 100% as the IR is at maximum at 100% SoC!??
 
I wonder if this is just by chance or would it hold for a bigger sample of 18650s? So that would mean to measure the IR at 50% SoC rather than 100% as the IR is at maximum at 100% SoC!??
Wolf may have data on this SoC vs IR.
later floyd
 
@paddy72

The INR18650-15Q in @Araknid's demo may not have been the best example as per manufacturer the Samsung INR18650-15Q should have an AC 1kHz IR reading of ≤30mΩ at 100% SOC. The one in the example runs an IR between ≈46 mΩ to ≈50mΩ. Also oddly enough it increases as SOC increases. That being said in my experience with over 7000 recorded cells and more than 10000 tested cells I find that "most" good quality cells i.e. 85+% SOH the IR whether DC or AC will decrease as the cells SOC approaches 100%.
It is not a lot, generally a reduction in the 3 to 5 mΩ range measured with an RC3563 AC 1kHz IR tester.
I have many more examples of this, not necessarily proving this, but with the volume of data I have accrued, it is the general rule of thumb.
The same goes with the DC IR study I have done. See https://secondlifestorage.com/index.php?threads/dc-ir-vs-ac-1kh-ir-measurements.9471/

Wolf


1654105075012.png1654105271691.png1654106505123.png
 
Last edited:
Thanks for clarification, Wolf. So, in general the IR should be lowest at near 100% SoC, right? In the literature/web i found different opinions and charts on this topic and in my rememberance the IR was lowest around 50% SoC. Maybe there is a difference in good/new cells and old/used cells? Anyway, the max. difference in IR over the SoC-Range seems to be rather low, but can be up to 10-15% i guess.
 
Thanks for clarification, Wolf. So, in general the IR should be lowest at near 100% SoC, right?
That has been my observation. Now mind you I have some cells were the IR does goes up a bit ≈.5 to ≈2 mΩ from the quasi 50%SOC.
This could be due to a small temperature change or the accuracy of the RC3563 which is supposed to be 0.5%,
Most of those cells however are also at the extreme high limit of an acceptable IR reading and generally have a SOH less than 80%.
The one anomaly (but not the only one) to these observations has been the LG S3 series which seems out of a 189 cell count had an average of reduced IR of -0.124 mΩ with quite a few of them going to the plus. Again not a lot in the plus with 138 Cells with an average of 1.204 mΩ range
So you see only 51 cells dropped their IR a bit and the other 138 went positive. which is essentially quite the opposite however small the differences may be.
I am by no means the end authority here and am just giving you the data that I have collected.
I do also believe cell chemistry has some influence and possibly the age of the cell.
Wolf
 
Back
Top