| Electronics > Projects, Designs, and Technical Stuff |
| Battery discharge testing |
| (1/2) > >> |
| OM222O:
Hello I 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 were current_mA: current in mA load voltage: battery voltage power_mW: power in mW (just the product of current and voltage) energy: energy dissipated by the load eInternalR: energy dissipated by the internal resistance eTotal: 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 inline import matplotlib import matplotlib.pyplot as plt import numpy as np sampleDelay=0.5 internalR=0.45 def duration(): return t[-1]/3600.0 def avg_current(): return sum(I)/len(I) def calc_mAh(): return duration()*avg_current() def calc_mWh(): e=0 for i in range(len(t)-1): e+=(P[i]*(t[i+1]-t[i])/3600.0) return e def calc_waste(): e=0 p=((avg_current()**2)/1000)* internalR for i in range(len(t)-1): e+= p * ((t[i+1]-t[i])/3600.0) return e t=[0] 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[0]) V.append(params[1]) P.append(params[2]) El.append(params[3]) Er.append(params[4]) Et.append(params[5]) except Exception as e: print(e) t=t[:-1] cap_mWh = calc_mWh() cap_waste = calc_waste() cap_total = cap_mWh + cap_waste print("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()[1],plt.xlim()[0]) plt.show() --- End code --- 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" |O 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. |
| Siwastaja:
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. |
| OM222O:
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? |
| Kasper:
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. |
| OM222O:
I actually tried it but excel crashes :-DD I'm not sure how to filter it to reduce the size either ... maybe another python program which takes every nth element and saves it? |
| Navigation |
| Message Index |
| Next page |