Arduino cell cycle tester project

How do you store and manage your electricity?
User avatar
jonescg
Senior Member
Posts: 4721
Joined: Thu, 21 Jan 2010, 23:05
Real Name: Chris Jones
Location: Perth, WA.
Contact:

Arduino cell cycle tester project

Post by jonescg »

Hi All,

I've been meaning to put together a cell cycle tester for about a year now, and finally seem to have got around to it. It came about because I would often test a cell or several cells in a battery by load testing with a roll of galvanised wire and a current clamp, along with a stopwatch. It's good for testing capacity and discharge curve, but what I really need to know is, will it do this 100 times? Or 1000 times?

So a robot is required to repeat the discharge/recharge cycles. I'll get onto the code for the program in a later post, but the circuit is something like this:

Image

I have an automotive relay for discharging, an auto relay for re-charging, a load consisting of nichrome wire (which can be adjusted depending on the load) and a charger, which in my case will be a fairly powerful 9 V power supply. Maximum currents are in the order of 20 to 40 amps, but voltages are always below 8.4 V since I'm going to be testing two LiCo cells in series. It's a means of ensuring the termination system is tested too.

Additional features are the 50 mV current shunt and a voltage divider which will turn the 8.4 V maximum down to a 4.2 V signal good enough for the AIN port to read.

Now, I'm using an Arduino Uno and the program is really quite simple. I'm not planning on getting the unit to log data at this stage, although it will no doubt be possible. I simply want to use the stopwatch and current meter method on the first, second, third, fifth, tenth and 20th cycles, and then maybe every 20 cycles after that. I should get an indication of cell cycle life by about the 40th cycle.

The program is going to be something like this:
Image

I could include some counting feature, but I can determine how long it takes to do one cycle and extrapolate from there.

Digital output 13 is for the discharge relay, which is driven by the Arduino-staple dual relay board, and digital output 12 is the re-charge relay. The power supply would be always on, so it can start charging as soon as the contactor closed.

The Analogue input with ground reference is designed to provide feedback on the state of charge. Once the cell approaches 4.2 V, a condition is met where the discharge may commence, but there will need to be a separate program for discharge lest it oscillate rapidly between charge and discharge.

The other analogue input can be from the shunt, which would eventually be used to calculate the number of Ah drained from the battery. But that's for another day.

It's slowly coming together. Hope to be able to start programming soon.

*Edited Sat Jun 18th with up-to-date wiring diagram.
Last edited by jonescg on Sat, 18 Jun 2016, 18:53, edited 1 time in total.
AEVA National President, WA branch director.
User avatar
evric
Site Admin
Posts: 503
Joined: Sun, 20 Jul 2008, 01:57
Real Name: Eric
Location: Adelaide SA
Contact:

Arduino cell cycle tester project

Post by evric »

It would nicer to be able to monitor individual cells of a series set as shown.
Last edited by evric on Sat, 04 Jun 2016, 20:29, edited 1 time in total.
Prius Plug-in Conversion: http://www.evplus.com.au ...Holden Barina EV: http://www.evric.kestar.com.au
TooQik
Groupie
Posts: 179
Joined: Mon, 18 Jun 2012, 00:53
Real Name: Chris
Location: Mount Gambier

Arduino cell cycle tester project

Post by TooQik »

Are you going to program a rest period between the charge/discharge and discharge/charge cycles to allow the cell to settle each time?
User avatar
jonescg
Senior Member
Posts: 4721
Joined: Thu, 21 Jan 2010, 23:05
Real Name: Chris Jones
Location: Perth, WA.
Contact:

Arduino cell cycle tester project

Post by jonescg »

It might be good to monitor individual cells, but I'm only ever going to be testing a 2-cell battery. I could make a bigger battery, but then the loads start to get huge. Even a little CellLog8 on the battery would be good just for keeping an eye on how they change.

Easy enough to put a delay in there, but I've found with LoPo cells it really doesn't drop much. There's no BMS or balancing on these cells I do testing on - just measuring volts and amps.
AEVA National President, WA branch director.
User avatar
jonescg
Senior Member
Posts: 4721
Joined: Thu, 21 Jan 2010, 23:05
Real Name: Chris Jones
Location: Perth, WA.
Contact:

Arduino cell cycle tester project

Post by jonescg »

The whole lot doesn't neatly fit inside a jiffy box.
Image
But it does fit messily inside a jiffy box Image

The black Andersons are for the load, while the others are for the battery and charger.

AEVA National President, WA branch director.
User avatar
jeffthewalker
Groupie
Posts: 84
Joined: Mon, 07 Dec 2015, 21:43
Real Name: Jeff Johnson
Location: Queensland
Contact:

Arduino cell cycle tester project

Post by jeffthewalker »

jonescg wrote: Hi All,

I've been meaning to put together a cell cycle tester for about a year now, and finally seem to have got around to it. It came about because I would often test a cell or several cells in a battery by load testing with a roll of galvanised wire and a current clamp, along with a stopwatch. It's good for testing capacity and discharge curve, but what I really need to know is, will it do this 100 times? Or 1000 times?

It's slowly coming together. Hope to be able to start programming soon.
Likewise, I have been thinking around this as a project over a few years. I work with PIC microprocessors, programming in assembler. I often report via an 8 digit display. This could provide cycle number and charge and discharge duration. And others. A button could allow a look through each recorded cycle's data.

My brother tells me there are Arduino libraries to drive these displays.

If it can provide enough load, I find a car headlight globe to be a good load (and you have a visual indication of current:-).

8_digit_display.pdf
Last edited by jeffthewalker on Sun, 05 Jun 2016, 13:10, edited 1 time in total.
It is hard to make predictions, especially about the future. Yogi Berra
User avatar
jonescg
Senior Member
Posts: 4721
Joined: Thu, 21 Jan 2010, 23:05
Real Name: Chris Jones
Location: Perth, WA.
Contact:

Arduino cell cycle tester project

Post by jonescg »

Well I fitted the 12 V relays and turned it on with a simple program where the outputs 12 and 13 alternate on and off with a delay after each event. Arduinos do this weird thing where they chuck a spaz once you turn it on, but then it goes into the program loop. Not ideal where bouncy relays are concerned.

Anyway, the little relays couldn't drive the automotive relays without everything bouncing and oscillating wildly. What should be an On-delay-off-delay-on-delay-off-delay sounds more like wind-up toy juggling its way across the table. Either the 12 V, 5 amp power supply to the Arduino isn't up to the task, or the auto relays need suppression diodes across their coils. Or both. As it turns out these little blue relays are good for 10 amps continuous, so perhaps I can get away with using them on their own? They have their own build-in diodes for spike suppression.
Last edited by jonescg on Sun, 05 Jun 2016, 15:08, edited 1 time in total.
AEVA National President, WA branch director.
User avatar
jeffthewalker
Groupie
Posts: 84
Joined: Mon, 07 Dec 2015, 21:43
Real Name: Jeff Johnson
Location: Queensland
Contact:

Arduino cell cycle tester project

Post by jeffthewalker »

jonescg wrote: Well I fitted the 12 V relays and turned it on with a simple program where the outputs 12 and 13 alternate on and off with a delay after each event. Arduinos do this weird thing where they chuck a spaz once you turn it on, but then it goes into the program loop. Not ideal where bouncy relays are concerned.

Anyway, the little relays couldn't drive the automotive relays without everything bouncing and oscillating wildly. What should be an On-delay-off-delay-on-delay-off-delay sounds more like wind-up toy juggling its way across the table. Either the 12 V, 5 amp power supply to the Arduino isn't up to the task, or the auto relays need suppression diodes across their coils. Or both. As it turns out these little blue relays are good for 10 amps continuous, so perhaps I can get away with using them on their own? They have their own build-in diodes for spike suppression.

How about an STP60NF06L FET switching the low side. It would easily handle 20A with a small heatsink. Drive it straight off the Arduino output.
It is hard to make predictions, especially about the future. Yogi Berra
User avatar
jonescg
Senior Member
Posts: 4721
Joined: Thu, 21 Jan 2010, 23:05
Real Name: Chris Jones
Location: Perth, WA.
Contact:

Arduino cell cycle tester project

Post by jonescg »

Just checked and sure enough it was a lack of suppression diodes that was causing the chatter. Easy fix. I really con't want to be pushing more than 15 amps through these circuits anyway; after 1000 cycles, that's like $30 worth of power! Image
AEVA National President, WA branch director.
User avatar
jonescg
Senior Member
Posts: 4721
Joined: Thu, 21 Jan 2010, 23:05
Real Name: Chris Jones
Location: Perth, WA.
Contact:

Arduino cell cycle tester project

Post by jonescg »

Finished the hardware (almost). Just have to put Anderson connectors on everything for convenience.

Image

The current sense wires from the shunt should read a 0.050 volt difference at full scale deflection, which should be detectable using one of the Arduino's analogue inputs.

Likewise the V bat sense wire and ground will vary between 4.2 V (with a 2:1 divider) and about 3 volts, which is the low voltage cutoff.

I guess I could leave it all as a single cell tester so it wouldn't need the divider, but I can't check how the terminations of a 'typical' battery might behave.

Now for the hard part... programming the thing.
AEVA National President, WA branch director.
User avatar
jonescg
Senior Member
Posts: 4721
Joined: Thu, 21 Jan 2010, 23:05
Real Name: Chris Jones
Location: Perth, WA.
Contact:

Arduino cell cycle tester project

Post by jonescg »

Okay, I think the hardware is almost complete. I've given up on the current sensing at this stage as the way I've built it (The shunt is off the positive terminal; that's just how it worked out) would have the shunt's low side still sitting at more or less battery voltage. So no good trying to tie that analog input to ground... I will swap the leads around next time I feel inclined.

But I've hit a couple of snags - the local Jaycar re-seller in Albany has very limited stock, so things like Anderson connectors are never in supply. Also, I need to find a battery charger which will happily sit waiting for a battery to be connected to it. I have RC hobby chargers, but they all require me to press a button first. I was looking for Meanwell 9 V regulated power supplies (ideal for a 2 cell battery) but they seem to have been discontinued. Plus I don't think they are current limited. The internal resistance of these cells is pretty low, so even a Vdiff of about 3 volts will result in >20 amps. So I'm on the hunt for a battery charger or simple power supply capable of charging at about 10 amps or so.

Oh, and the big problem - programming Image

To be completely up front, I know nothing about programming. I learnt BASIC when I was about 8 years old (in 1988) and haven't touched it since. I'm playing with a few programs off the web where people are using the analogue inputs to do things, and I have so far managed to succeed in a few areas.

Like putting a potentiometer across the A0 and 5 V rail and getting it to read a value between 0 and 1023, then setting an IF command where if the value of the Analog value is 613 or less, digitalWrite to one of the output pins to HIGH (that is, turn on the charge relay).

Obviously I'm going to have to turn the digital output for 'discharge' off first, but baby steps...

I'm excited Image but also saddened I don't have the parts I need!

AEVA National President, WA branch director.
neilg
Groupie
Posts: 38
Joined: Sat, 07 Apr 2012, 06:24
Real Name: Neil Gibbs
Location: Perth

Arduino cell cycle tester project

Post by neilg »

Jonescg said "Oh, and the big problem - programming"

As no one has piped up to offer you some assistance, I would like to offer some help in the programming department.
I've been playing with Arduinos for a year or so now and been programming for about 40 years.
I have knocked together a quick sketch to act as a framework for your future development which is based on the info in this post.
I will test it on an AtMega test bed I have and it should recompile for any Arduino.
What sort of display do you intend to use?
You can use the serial monitor tool that comes with the Arduino development app if you don't mind a laptop or PC running while testing and this will provide all the logging you may want.
In the next day or two I will repost with a zipped file for you.
Cheers
neilg
User avatar
Richo
Senior Member
Posts: 3737
Joined: Mon, 16 Jun 2008, 00:19
Real Name: Richard
Location: Perth, WA

Arduino cell cycle tester project

Post by Richo »

jonescg wrote: Also, I need to find a battery charger which will happily sit waiting for a battery to be connected to it... So I'm on the hunt for a battery charger or simple power supply capable of charging at about 10 amps or so.


Best I can come up with is Altronics M8310 20V desktop power supply.
You can set the current and voltage to what every you want.

10A seems to be the main issue on availability on chargers.
A quick look around they only seem to go up to 5A.
So the short answer is NO but the long answer is YES.
Help prevent road rage - get outta my way!
User avatar
jonescg
Senior Member
Posts: 4721
Joined: Thu, 21 Jan 2010, 23:05
Real Name: Chris Jones
Location: Perth, WA.
Contact:

Arduino cell cycle tester project

Post by jonescg »

Yeah, I have been meaning to get a benchtop power supply for a while now, probably time I just did it. But I might as well get one with a decent range - up to 30 volts is probably sufficient.
AEVA National President, WA branch director.
neilg
Groupie
Posts: 38
Joined: Sat, 07 Apr 2012, 06:24
Real Name: Neil Gibbs
Location: Perth

Arduino cell cycle tester project

Post by neilg »

Jonescg: Here is the CellTester Arduino project for you to play with.
I have had a bit of fun writing and testing this.
Anyone is free to use and modify it as they like.
There is a description at the top of the file and it is fairly well commented so should be self explanatory.
I developed this on a AtMega and have also compiled for the Uno.

CellTester.zip

Enjoy
neilg
User avatar
jonescg
Senior Member
Posts: 4721
Joined: Thu, 21 Jan 2010, 23:05
Real Name: Chris Jones
Location: Perth, WA.
Contact:

Arduino cell cycle tester project

Post by jonescg »

Thanks Neil! Ant Day has also written one but it didn't include amp-hour counting. I can compare them and see how it goes :)

Cheers!
AEVA National President, WA branch director.
User avatar
jonescg
Senior Member
Posts: 4721
Joined: Thu, 21 Jan 2010, 23:05
Real Name: Chris Jones
Location: Perth, WA.
Contact:

Arduino cell cycle tester project

Post by jonescg »

Hi Neil, finally got a chance to read the program and your notes. I'd be looking to use the analogue input from the current shunt to eventually measure Ah, so perhaps we should set that input to read amps on the discharge cycle?

I don't mind leaving a laptop set up to record values on the serialPrint, but even if all it does is charge and discharge a hundred times, I can repeat my benchtop testing with the coil of wire and a stopwatch.

Shame I have to work for a week before i get a chance to play Image
AEVA National President, WA branch director.
neilg
Groupie
Posts: 38
Joined: Sat, 07 Apr 2012, 06:24
Real Name: Neil Gibbs
Location: Perth

Arduino cell cycle tester project

Post by neilg »

If you know the load resistance and the voltage then you can work out the discharge current.
Using the analogue input with a 50mV shunt will only give you a count of 0 - 10 for whatever the rating of the shunt is. i.e a 50mV 10A shunt will give a resolution of about 1A. 50mV @ 20A = 2A.
I think using Ohms Law: I=V/R will give better accuracy than what you will get using the shunt.
The logging I have setup will show the total charge & discharge times in milliseconds for each cycle (easily changed to H:M:S if you like) so no need for a stop watch.

Anyway have some fun with it.
neilg
User avatar
coulomb
Site Admin
Posts: 6357
Joined: Thu, 22 Jan 2009, 20:32
Real Name: Mike Van Emmerik
Location: Brisbane
Contact:

Arduino cell cycle tester project

Post by coulomb »

neilg wrote: I think using Ohms Law: I=V/R will give better accuracy than what you will get using the shunt.

? But when charging the battery the "load resistance" is variable and unknown. Maybe you don't care about amp-hours into the battery, but I think it would be handy.
Usually with a shunt, you use a differential op-amp (operational amplifier) with a gain of about 10-30, depending on the expected shunt voltage and the full scale input voltage of your ADC (analogue to digital conversion) input. For example in the electric MX-5 and our solar energy systems, we use a gain of 10 so that the plus or minus 75 mV (50 mV shunt with short term 50% overload) becomes plus or minus 0.75 V, to match the 1.5 V input range of the MSP430 microcontrollers that we use.
The other advantage of a diff-amp is that it's easy to set up an offset so thst for example 0-150 A read as 0-511, and negative 0-150 A read as 0 to -511.

Edit: see for example the upper left corner of the schematic diagram of this post:

viewtopic.php?title=weber-coulombs-lyte ... 302#p57724 .

Use your browser's "view image" facility (often in a right mouse button menu) to see the diagram at full scale. Vref+ is a 1.50 V reference voltage from the microcontroller, that is the voltage it will read full scale at (in our case, unsigned 1023 or signed +511, since it's a 10 bit ADC).
Last edited by coulomb on Tue, 14 Jun 2016, 04:17, edited 1 time in total.
MG ZS EV 2021 April 2021. Nissan Leaf 2012 with new battery May 2019.
5650 W solar, 2xPIP-4048MS inverters, 16 kWh battery.
Patching PIP-4048/5048 inverter-chargers.
If you appreciate my work, you can buy me a coffee.
User avatar
jeffthewalker
Groupie
Posts: 84
Joined: Mon, 07 Dec 2015, 21:43
Real Name: Jeff Johnson
Location: Queensland
Contact:

Arduino cell cycle tester project

Post by jeffthewalker »

neilg wrote: I think using Ohms Law: I=V/R will give better accuracy than what you will get using the shunt.

I program PIC microprocessors in assembler and have the ability to reference the analog input on one pin to another pin's voltage. That is, the shunt voltage on pin AN0 and the reference voltage (say 1V) on pin AN3. If you can do this you can get an increase in resolution.

From the PIC16F716 manual
7.1.3 ADC VOLTAGE REFERENCE The PCFG bits of the ADCON0 register provide independent control of the positive voltage reference. The positive voltage reference can be either VDD or an external voltage source.

The Arduino code may allow you to do this.
It is hard to make predictions, especially about the future. Yogi Berra
User avatar
Richo
Senior Member
Posts: 3737
Joined: Mon, 16 Jun 2008, 00:19
Real Name: Richard
Location: Perth, WA

Arduino cell cycle tester project

Post by Richo »

jeffthewalker wrote:I program PIC microprocessors in assembler and have the ability to reference the analog input on one pin to another pin's voltage.

The Arduino code may allow you to do this.


I see two problems with this:
1. You use a PIC
2. You program in assembler


Audino's are Atmel (which unfortunately is now pwned by Micro#*it).

Although I like the purity of assembler it isn't time practical.
The only time assembler is used is for space or run-time constrained applications - even then assembler is usu only a portion of the code.

You can have an external reference as an option.
The Mega's can do that.
Depending on version you can use the internal bandgap for reading the voltage inputs and then flick to an external reference (of lower value) to read the current inputs.
Some of the channels may have a 20x gain too which may help.



So the short answer is NO but the long answer is YES.
Help prevent road rage - get outta my way!
neilg
Groupie
Posts: 38
Joined: Sat, 07 Apr 2012, 06:24
Real Name: Neil Gibbs
Location: Perth

Arduino cell cycle tester project

Post by neilg »

I realise using a gain stage is the best solution for measuring current but I was only going on the original circuit in the first post which shows the shunt input going directly to an analogue input and the limitations of this needed to be pointed out.
Also my suggestion for using Ohms Law was for the discharge current as the charge current would be able to be read by an analogue input.

neilg
User avatar
jonescg
Senior Member
Posts: 4721
Joined: Thu, 21 Jan 2010, 23:05
Real Name: Chris Jones
Location: Perth, WA.
Contact:

Arduino cell cycle tester project

Post by jonescg »

Okay, I finally bought myself a decent power supply (on special from Altronics for $400 - 32 V, 20 A) so now I can charge my cells however fast I please.

Image

The hardware is complete. I have moved the shunt to battery negative so any current monitoring is consistent with the voltage divider.

Image

Since I might be testing several cells in series, I decided to put a 10k potentiometer in place so I can cut the 8+ volts down to something less than 5 for the Vsense on the analog input.

Image

The program currently on the Arduino is a simple SerialPrint of A0 and a potentiometer across the 5V rail and ground, with the IF function telling it to open a relay if the value is less than 500.

I measured the voltage between AIN1 (the output of the potentiometer) and ground, while having an 8.3 volt battery connected across the input of the pot. As I wound it up, the voltage climbe from a few milivolts to 2.5 V, then 3 V, then it jumped rapidly to 8.4 V! And the Arduino board powered on! The board isn't connected to a PC or its power supply.

So I'm wondering if a voltage divider for sensing the battery voltage is a good idea or not. Should I keep it to a maximum of 4.2 volts (one cell)?

Program yet to be tested...
AEVA National President, WA branch director.
User avatar
evric
Site Admin
Posts: 503
Joined: Sun, 20 Jul 2008, 01:57
Real Name: Eric
Location: Adelaide SA
Contact:

Arduino cell cycle tester project

Post by evric »

Is it a linear pot or logarithmic? Logarithmic could cause a sudden change.
Last edited by evric on Sat, 18 Jun 2016, 13:30, edited 1 time in total.
Prius Plug-in Conversion: http://www.evplus.com.au ...Holden Barina EV: http://www.evric.kestar.com.au
User avatar
jonescg
Senior Member
Posts: 4721
Joined: Thu, 21 Jan 2010, 23:05
Real Name: Chris Jones
Location: Perth, WA.
Contact:

Arduino cell cycle tester project

Post by jonescg »

It's linear. I think the issue was the board wasn't powered up so there was some means of allowing current to flow back into the chip. Once powered up and adjusted, the output reads 2:1 as planned:

Image

I've uploaded Neil's program and changed a couple of variables to suit - like Digital Output 13 is charge, and 12 is discharge, AIN0 is the current shunt's high side input and AIN1 is the output of the pot (as a voltage divider).

It starts up, but the charge and discharge relays are both on for about 8 seconds. Then the discharge relay opens and the charge relay remains on. Nothing happens as long as the battery is charging. Even when it's fully charge and the voltage across the pot output is 4.2 volts. The charger is still delivering a low current to the battery though:

Image

Only when I disconnect the battery does the discharge relay kick in...
The Serial output screen isn't completely useful - I had to set the baud rate to 9600 before it would read anything. No current or voltage readings, just time. Only after disconnecting the battery would a new 'cycle' be logged.

I think we're on the right track, but not there yet.
AEVA National President, WA branch director.
Post Reply