Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Ah batery capacity logger

What they are really measuring with the capacitive model of a battery is not the 'equivalent capacitance' of the battery but the capacitance needed to store x kJ of energy at that voltage range which means that value is much higher than the actual battery capacitance. For measuring peak discharge rates it's fairly accurate (10%) with good internal lookup tables but it can be wildly inaccurate for total battery Ah capacity when used with worn lead acid batteries.

https://doc.utwente.nl/64556/1/BatteryRep4.pdf
 
It probably can be done for a given kind of battery (e.g. automotive), but it'll depend on the charge state too. Discharged batteries will show less "capacity" than fully charged ones. So, you would need to restrict tests to fully charged batteries.

If you throw in different kinds of batteries - automotive, marine, motive etc. then the method will underestimate the capacity of a batteries with higher Peukert number and overestimate capacity of batteries with low Peukert number.
 
What they are really measuring with the capacitive model of a battery is not the 'equivalent capacitance' of the battery but the capacitance needed to store x kJ of energy at that voltage range which means that value is much higher than the actual battery capacitance. For measuring peak discharge rates it's fairly accurate (10%) with good internal lookup tables but it can be wildly inaccurate for total battery Ah capacity when used with worn lead acid batteries.

https://doc.utwente.nl/64556/1/BatteryRep4.pdf


Hi,

Yes that's what i meant by (quote) "capacitance correlates to the Ampere Hour capacity".

We could go over the calculation if anyone is interested.
 
Hi,
Yes that's what i meant by (quote) "capacitance correlates to the Ampere Hour capacity".

I was just making sure someone (not you) didn't think a battery is really a big capacitor. :)
 
?.... For measuring peak discharge rates it's fairly accurate (10%) with good internal lookup tables but it can be wildly inaccurate for total battery Ah capacity when used with worn lead acid batteries.

https://doc.utwente.nl/64556/1/BatteryRep4.pdf

When you say wildly inaccurate, what sort of figure are you thinking ? I've found it to be a good indicator, but never crossed referenced with a discharge test

Thanks all for the answers.
 
When you say wildly inaccurate, what sort of figure are you thinking ? I've found it to be a good indicator, but never crossed referenced with a discharge test

Thanks all for the answers.

This is with flooded cells in a solar off-grid system running several models from the same input data.
My experience with this method has been >30% for older batteries with intermittent load/charge cycles and almost useless to measure and track a battery with a SG calculated SOC of less than 80% with dynamic loads. The ability of a battery to 'recover' capacity from plate surface reformation after discharges when resting makes it difficult to judge it's true condition with simple short discharge testing. I've used a two step process that applies a moderate load a first to evaluate the surface charge then a much heavier for at least 10 seconds to measure the internal resistance and other factors from the change of battery voltage with changing currents just to get a rough idea of Ah capacity from resting battery.
 
Hi again,

Just to note, the Ampere Hour rating based on the pure capacitance model comes out to this:
AHr=dt*I/3600

where dt is the time in seconds to discharge over the useful voltage range and I is the constant current load in Amperes, and because we can get the capacitance from a measurement we can combine equations and get this:

AHr=I*dt*(dv1/dv)/3600

where
dv1 is the change in voltage over the useful range of the battery,
dv is the measured change in voltage with the applied load,
dt is the time it takes to discharge by the amount of dv above,
the constant 3600 is just a conversion factor to convert Ampere Seconds to Ampere Hours.

For a typical Lead Acid battery we charge it up and after a rest period it might measure 12.6v, and we can apply a load and use it down to 11v, which means dv1=1.6v.

Example:
We measure 12.7v battery voltage, discharge it to 12.60v with a 10 amp load, and then start the timer. 36 seconds later we measure 12.52v.
For this example we have:
I=10
dv1=12.60-12.52=0.08
dt=36
and dv1=1.6 because we allow a full discharge to go from 12.6 to 11.0 volts.

Plugging all these into the equation for AHr we get:
AHr=2

Now this will not be the true Ampere Hour rating because we did not take into account the effects of different load currents on the same battery. Thus we' d have to adjust this factor using what is known as the "P" factor or "Peukert Factor".
Also note that we loaded this battery with a huge current (10 amps) relative to it's capacity, which we would not want to do either. The manufacturers usually use a C/20 discharge when rating the batteries, where C is the capacity in Ampere Hours here. We probably do have to use a higher current than that however in order to make the test method much faster.

This gives an idea how to go about doing this kind of test and is not meant to be exact.
 
..
Now this will not be the true Ampere Hour rating because we did not take into account the effects of different load currents on the same battery. Thus we' d have to adjust this factor using what is known as the "P" factor or "Peukert Factor".
Also note that we loaded this battery with a huge current (10 amps) relative to it's capacity, which we would not want to do either. The manufacturers usually use a C/20 discharge when rating the batteries, where C is the capacity in Ampere Hours here. We probably do have to use a higher current than that however in order to make the test method much faster.

This gives an idea how to go about doing this kind of test and is not meant to be exact.

I've played around with the various methods while tinkering with my hobby solar project. I run 3 capacity models simultaneously with my "work in progess" BMS system that also selects which battery to charge out of the 4 it's tracking.

1: The S quasi-Static model, with is similar to the 'capacitance model' with Peukert Factor, temperature and battery aging (mainly ESR and charge/discharge cycle counts) adjustments.
2: The C Coulomb-counting model, amps/voltage in/out parameters every 30 seconds with rest factor recovery (using a available-charge well and the bound-charge well model), charge efficiency factors with the above adjustments.
3: The M voltage Measurement model, battery voltage with load and temperature corrections to a table of voltage to SOC values.

I then do a sanity check on the results by comparison and select or blend the models results depending on the current mode of operation (rest, charge, discharge).
The code base is a mess and the amount of parameters is unwieldy but it works fairly well to keep track of capacity and 'time to go' with dynamic loading and charging after fine tuning.

Some of the data stuctures in the code.
Code:
#if defined(__18CXX)

typedef struct celltype { // C18 uses byte alignment
#else

typedef struct __attribute__((aligned(1))) celltype { // force C32 to byte alignment, 32bit alignment is still critical
#endif
uint16_t id, model; // battery cell type S,M,L
int32_t voltage, current, charge, cycles, noload, date;
uint8_t cconline, online, discharged, dead, critical, valid, fresh, misc;
float weight;
}
volatile celltype;

/* hist[x].h[x]
* h0 Peukert Factor adjusted Ah usage this cycle, MUST BE INTERGER variable type!
* h1 Lowest discharge ever,
* h2 current lowest discharge,
* h3 avg discharge
* h4 Number of full charge cycles, h5 Number of full discharge cycles
* h6 Real Ah usage this cycle, MUST BE INTERGER variable type!
* h7 Min Batt Voltage
* h8 Max Batt Voltage
* h9 Lowest ESR Pre
* h10 Lowest ESR Post
*/

#if defined(__18CXX)

typedef struct histtype { // C18 uses byte alignment
#else

typedef struct __attribute__((aligned(1))) histtype { // force C32 to byte alignment, 32bit alignment is still critical
#endif
uint16_t rate, udod, bsoc, bound_rate, bound_factor, samplei, sampleo, ah, drate, esr, rest_rate, rest_factor, esrp;
int16_t h[HPARAM_SIZE]; // h[6]=cumulative battery Ah cc and inv (real),h[0]=cumulative battery Ah cc and inv (p_adj)
int32_t kwi, kwo, ttg, btest;
int32_t ahi, aho, ahir, ahop, thermo; // A stored in battery, A taken from battery, A from raw pv, peukert adjusted A
int32_t pv_eff, tot_eff; // pv generation eff factor, total system eff factor
float peukert, cef, peukert_adj, cef_calc, cef_save;
}
volatile histtype;

typedef struct R_data { // set only in adc_read
int32_t current, currentin, currentcharger, thermo_batt;
uint32_t systemvoltage, ccvoltage, inputvoltage, primarypower[POWER_SLOTS];
} R_data;

typedef struct V_data { // OS Counters
uint32_t highint_count, lowint_count, eeprom_count, timerint_count, adc_count, mbmcdata_count, c1rx_int, c1tx_int, c2_int, buttonint_count,
clock50, pwm4int_count;
} V_data;

typedef struct C_data { // set only in adc_read
int32_t currentload;
int temp_drate;
float t_comp;
} C_data;

typedef struct B_data {
int16_t start_ahu, cef_raw; // must be int TYPE
uint32_t start_ahi, start_aho, absorp_ahi, absorp_time, charge_time_left; // uint32_t TYPE
uint8_t yesterday, today, r_soc[DATA_SLOTS]; // Harvest quality for the whole day, 0..100, uses time of harvest (seconds) -> input power (watts) -> max power (watts).
int32_t diversion;
} volatile B_data; // of each measurement during that period.
 
Last edited:
I then do a sanity check on the results by comparison and select or blend the models results depending on the current mode of operation (rest, charge, discharge).
The code base is a mess and the amount of parameters is unwieldy but it works fairly well to keep track of capacity and 'time to go' with dynamic loading and charging after fine tuning

I do straight coloumb counting on my batteries with 3kHz sampling rate and minor corrections introduced at higher voltages. Works fairly well too. Accuracy is within 1% most of the time (3.5% worst case I have on record).
 
I do straight coloumb counting on my batteries with 3kHz sampling rate and minor corrections introduced at higher voltages. Works fairly well too. Accuracy is within 1% most of the time (3.5% worst case I have on record).

Yea, I do fast sampling with averaging in the ADC routines to integrate the PWM cycles from the charge controller into a stable signal then send it to a digital LP filter later.

Code Fragments:
Code:
... program defines
/* The number of samples must be high to sample several complete PWM cycles from the CC to get stable voltage and current measurements at lower ranges. */
#define ADC_SAMP_F 128
#define ADC_SAMP_S 512
#define ADC_CHAN_DELAY 100 // delay in 10X chip cycles after switching ADC channels

... Daq header
extern uint32_t Vin, rawp1, rawp2, rawp3, vbatol_t, solar_t;
... Daq code functions
ADC_zero();
SetChanADC(ADC_CH1); // Smooth the voltage from the CC as it contains PWM pulses.
Delay10TCYx(ADC_CHAN_DELAY);
Vin = 0;
for (i = 0; i < ADC_SAMP_S; i++) {
ConvertADC();
while (BusyADC());
Vin += (uint16_t) ReadADC();
}
Vin /= ADC_SAMP_S; // very long measurement sample time to get several PWM cycles from CC
 
I have an ACT gold battery tester. In the space of a few seconds it displays capacity in Ah for 6 or 12 volt batteries. Can anyone explain how it does it?
That 'estimate' is only good for early life in batteries. As batteries' age the 'knee' voltage moves and this can lead to unpredictable results with a sudden drop off of Ah.

I recently met a worn battery with no knee before 10.5V at all....quite unusual. I deal with worn lead acid batteries often and I do a full profile discharge chart (using the kit mentioned) to be certain of their real capacity.
 
Hi,

Just to note, a physical RC filter is often not as good as doing it in software because a physical RC filter reduces the noise content of the signal. I wont say that this will always be the case, but i think it is most often the case.

I was also fascinated by the recovery capability of batteries, bit i also noticed that this happens with some electrolytic capacitors too. Pretty amazing. I never tried to model this behavior myself.

I might look into the diffusion model a little more at some point as that looks very interesting. I just wonder if we can get all the required parameters without having to get information directly from the manufacturer. With the electrical model i've looked at in the past (ie Rincon-Mora) i think all of the required parameters are measurable.

It's really nice to hear from you guys, that have taken this subject into the practical domain because of your own needs. It's nice to hear from people who have made progress measuring battery properties over the life of their batteries.

I've worked with other types of batteries too like NiMH, and have seen some strange things happen with age. The charge curve of one set was completely different from many others i have measured. I can only guess that they were made from some older technology or something.
 
Hi,

Just to note, a physical RC filter is often not as good as doing it in software because a physical RC filter reduces the noise content of the signal. I wont say that this will always be the case, but i think it is most often the case

Can you explain why you'd want noise to hit an ADC? I can imagine very fast real time control, not wanting to lose the higher end, but for almost everything else I'd lean towards a simple external filter....maybe wrongly?
 
Can you explain why you'd want noise to hit an ADC? I can imagine very fast real time control, not wanting to lose the higher end, but for almost everything else I'd lean towards a simple external filter....maybe wrongly?

In my case with a PWM signal ~180Hz (charge controller current) with a possible large DC component (battery current) it was just easier to do in software when accounting for the slope of the PWM signal pulses into a non-linear load like a battery. It's been my experience that the software models work well in a mainly static load mode but you need very accurate data from the sensors to have good dynamic energy tracking.

I saved a few clips from when I was working on the filters:
These are the varying signals from a Hall sensor (1/2 5vdc = zero current): The top trace is the software sample gate trigger (sent to a debug port for the scope sync)
The bottom trace is the DC+PWM signal from the sensor. (the bottom of the scope is zero volts for this signal).

https://flic.kr/p/a7YLSY
https://flic.kr/p/a7VUA2
https://flic.kr/p/a7YM11
https://flic.kr/p/a7YM2b
 
Last edited:
Can you explain why you'd want noise to hit an ADC? I can imagine very fast real time control, not wanting to lose the higher end, but for almost everything else I'd lean towards a simple external filter....maybe wrongly?


Hi,

Well in a word, noise is what makes oversampling work. Ok that was six words :-)

True noise averages to zero, and according to oversampling theory if the noise is at least as large as (something like) one or two bits, the noise pushes the ADC value up or down many many times over the course of one oversampling interval, and this allows (something like) an average to show an increased ADC resolution. So we can get 12 bit resolution from a 10 bit ADC if the measured signal contains the right kind of noise.

Note i say "according to oversampling theory" in quotes because i am not sure i agree with all of the theory i have read on the web. I think that the range of the noise as well as the origin of the noise comes into question. For example, if the noise is systematic then it better not be too systematic or else it would produce systematic errors in the averaged (and truncated) ADC readings.
 
Recently I was Surprised at How Sophicated some New car battery testers are.

Not only does it measure the A/H Rating, they also measure the Cold Cranking amps and the "Quality of Each Individual Cell in the battery".
And this is acomplished with Just Connections to the 12 Volt terminals.
Test take about 10 Seconds.

I Can't understand How this Individual Cell Test is done?
 
I Can't understand How this Individual Cell Test is done?

Wonders of marketing. You bought it. Others may too.

Other guys may have a tester that actually may be able to test batteries, but who in the right mind would buy their product if you can buy much better tester which tests 6 cells through a single connection and costs 30% less?

Which company do you think will stay in business longer? You guessed it. The next one, which will test batteries without any connections at all!
 

Latest threads

Back
Top