Battery discharge testing - Page 1
Forum section: electronics / projects

author: OM222O
author_rank: Frequent Contributor
timestamp: December 19, 2018, 12:41:58 pm
content: HelloI decided to start testing different batteries and trying to extrapolate data for different discharge rates, given the capacity and internal resistance.I used a constant current source to discharge a AAA battery at 100mA and logged the data (0.5 seconds delay between each data point) to a csv file. the parameters werecurrent_mA: current in mAload voltage: battery voltagepower_mW: power in mW (just the product of current and voltage)energy: energy dissipated by the loadeInternalR: energy dissipated by the internal resistanceeTotal: total available power of the battery ( eInternalR + energy )The data seemed a bit odd because I set my cutoff voltage to be 0.5V but the lowest recorded value is about 0.95 (resolution is 10mV). I have also decided to change the parameters which I log as they can be calculated on the PC, but these are besides the point(I should just check my setup for that).I used this code in python to do the calculations and draw the desired graphs:Code:%matplotlib inlineimport matplotlibimport matplotlib.pyplot as pltimport numpy as npsampleDelay=0.5internalR=0.45def duration():return t[-1]/3600.0def avg_current():return sum(I)/len(I)def calc_mAh():return duration()*avg_current()def calc_mWh():e=0for i in range(len(t)-1):e+=(P*(t[i+1]-t)/3600.0)return edef calc_waste():e=0p=((avg_current()**2)/1000)* internalRfor i in range(len(t)-1):e+= p * ((t[i+1]-t)/3600.0)return et=I=[]V=[]P=[]El=[]Er=[]Et=[]with open("Alkaline.CSV", "r") as f:for line in f:try:params=line.strip().split(",")if (not params[-1]==""):params=list(map(float,params))t.append(t[-1]+sampleDelay)I.append(params)V.append(params)P.append(params)El.append(params)Er.append(params)Et.append(params)except Exception as e:print(e)t=t[:-1]cap_mWh = calc_mWh()cap_waste = calc_waste()cap_total = cap_mWh + cap_wasteprint("Test run took %.2f hours" % duration())print("Avg current: %.2f" % avg_current())print("Avg voltage: %.2f" %(sum(V)/len(V)))print("Avg Power: %.2f" %(sum(P)/len(P)))print("Capacity in mAh: %.2f" % calc_mAh())print("Capacity in mWh: %.2f" % cap_mWh)print("Capacity waste in mWh: %.2f" % cap_waste)print("Total capacity in mWh: %.2f" % cap_total)plt.plot(t,V)plt.title("Voltage vs time")plt.xlabel("Time(s)")plt.ylabel("Voltage(v)")plt.show()plt.plot(t,P)plt.title("Power vs time")plt.xlabel("Time(s)")plt.ylabel("Power(mW)")plt.show()plt.plot(t,Et)plt.title("Energy vs time")plt.xlabel("Time(s)")plt.ylabel("Energy(mWh)")plt.show()plt.plot(Et[::-1],V)plt.title("Voltage vs energy")plt.xlabel("Energy(mWh)")plt.ylabel("Voltage(v)")plt.xlim(plt.xlim(),plt.xlim())plt.show()and the result was as follows:Now I just need a way to obtain a voltage value for a given capacity which is shown by the last graph (as you can see, when the capacity decreases, so does the voltage) but it's non linear! I'm not sure what would be suitable equation that fits this type of graph and how to solve it. Please focus on this question rather than suggesting that "The battery should be discharged at the desired rate to obtain accurate values"I need to test about 60 of them and this single test with AAA took 9 hours! a AA or a D might take days and I can't wait that long, so I want to discharge at higher currents, and extrapolate a lower discharge rate. thanks!P.S: the CSV file is too large to attach (2.4mB) so I zipped it before attaching. it contains the raw collected data.

author: Siwastaja
author_rank: Super Contributor
timestamp: December 19, 2018, 02:22:13 pm
content: IMHO, the actual curve shape depends a lot of the internal battery construction. I'm not an alkaline expert, but at least in li-ion, you see clearly different curve shapes with different cell brands even when they have the exact same chemistry "on paper".So I guess you won't be able to fit a standard curve, then extrapolate, and expect reliable results. If you need to test different batteries, the only reliable way is to really fully discharge them all (typically to 1.0V/cell, but 1.1V may work as a more conservative simulation of some loads that drop out earlier). This takes time; AFAIK there is no way around it, unless you already know the result beforehand (i.e., someone else did the testing).It's well possible that some cell delivers quite well down to 1.2V, then starts going down rapidly, while a competitor would go down quicker initially but surprise you at the low end, delivering proper capacity and energy after all.

author: OM222O
author_rank: Frequent Contributor
timestamp: December 19, 2018, 02:34:09 pm
content: I will be testing each brand and chemistry separately but I have a large sample size (about 14 batteries per pack). Extrapolation will be withing that specific pack and I want to see if it's viable or not. this is just validating testing methodology. I think the easiest way would be a look up table rather than forming an equation? I can do a moving average to get rid of the jagged edges as well?

author: Kasper
author_rank: Frequent Contributor
timestamp: December 19, 2018, 04:45:33 pm
content: Some other things that could affect your curves are temperature, current draw and battery age. And also, agitation; the first time I did a drain test I had weird results, battery voltage seemed to increase whenever I measured it. Eventually I realized moving the battery to connect my DMM caused its voltage to increase. Then I realized why hitting 'broken' electronics sometimes 'fixes' them (when the battery is dead, shaking it might get a bit more life out of it).To find an equation that describes the curve: you can graph it in excel then in the graph options add trendline or best fit then play with the options until it gives a satisfactory curve. Select the option to display equation. Other programs do it too, if you search for 'best fit trendline' you should find something.

author: OM222O
author_rank: Frequent Contributor
timestamp: December 19, 2018, 08:54:08 pm
content: I actually tried it but excel crashesI'm not sure how to filter it to reduce the size either ... maybe another python program which takes every nth element and saves it?

author: thm_w
author_rank: Super Contributor
timestamp: December 20, 2018, 10:25:48 pm
content: Click on your data in the chart in excel, right click and select "Add trendline". Then choose 3rd or 4th order polynomial, depending on how close you want it to fit.Then check the box "display equation on chart".