Page 4 of 6

Re: Battery Performance Tester

Posted: Fri 11 Sep 11 2009 7:55 am
by Daniel Wee
I decided to re-measure the Rds+load resistance using a different scheme - basically supplying a known voltage while measuring the current with the DMM. The resultant resistances (V/I) for channels 1 to 4 (our LCD doesn't show channel 5 voltage in test mode) are as follows:-

CH1 1.088 ohms
CH2 1.092 ohms
CH3 1.061 ohms
CH4 1.094 ohms

According to this calculation, the value on channel-2 and -4 will be higher than channel-1 and -3 because of the higher resistance (and thus lower loading). Notice that here again the original DMM resistance readings were way off. That mode seems in capable of handling these types of situations. Most of the above tests were done at around 2.26V terminal voltage. We should repeat this test at 1V terminal voltage if possible and at terminal voltage of about 0.98V, the results are as follows:-

CH1 1.07266 ohms
CH2 1.0792 ohms
CH3 1.0500 ohms
CH4 1.0785 ohms
CH5 1.08586 ohms

Notice how CH2 and CH4 has changed positions in terms of ranking. The rest remains about the same in terms of rank. There is some non-linearity that we see but that adds up to only around 0.016V from 2.26V to 0.98V. I think we can probably ignore this for the most part. CH3 has the lowest resistance, expectedly, since the ground point goes straight to it, and CH5 has higher resistance (as well as CH1) since they are further from the grounding point. We will update our code to now use these values.

With this level of calibration, I don't think we can do much better in terms of matching all the channels so we will just have to trust the results from here on out and start testing batteries.


Re: Battery Performance Tester

Posted: Fri 11 Sep 11 2009 1:27 pm
by Daniel Wee
Okay, this is it. Probably the most likely and best result yet. Batteries (GP1600) came off the ReCyko charger and using the latest code with all the corrections:-
GP-1600-1234ABCD-8.jpg (77.62 KiB) Viewed 7758 times
Reported capacities were:-

BATT1 1223mAh
BATT2 1139mAh
BATT3 1248mAh
BATT4 1182mAh

We're going to run a last round after an analyze cycle on the C-9000.


Re: Battery Performance Tester

Posted: Fri 11 Sep 11 2009 2:27 pm
by Daniel Wee
I added a new reading to the new code - mWh. Using mAh as a capacity indicator has always been somewhat problematic for me since it only tells half the story. For mAh, we are essentially integrating V/R over the test period, which gives you I. Power capacity would involve only a minor change of integrating V*V/R over the same period. I think this will actually yield a more accuracy reflection of the capacity of any given battery. In this application, however, we are seeing a constant load with variable terminal voltages and times so we are in effect giving terminal voltages greater weightage, resulting in more pronounced effect of the voltage. The overall ranking should not be affected by this, however since R is constant.


Re: Battery Performance Tester

Posted: Fri 11 Sep 11 2009 5:55 pm
by Daniel Wee
The Sanyo2700 test is done with some rather interesting results. CH3 seems to be somewhat anomalous but first the results:-
GP-1600-1234ABCD-9.jpg (69.94 KiB) Viewed 7755 times
Reported capacities (numbers in brackets shows the charge taken in charging):-

BATT1 1594mAh 1618mWh (2063mAh)
BATT2 1295mAh 1483mWh (1928mAh)
BATT3 1441mAh 1488mWh (1942mAh)
BATT4 1330mAh 1396mWh (1865mAh)

Notice how cell-2 on CH3 stands out from all the rest whereas CH1, CH2 and CH4 are better matched this time. Notice also how the mWh capacities are closer to each other than the mAh reading would otherwise suggest. The mWh numbers also match the charge input numbers better.


Re: Battery Performance Tester

Posted: Fri 11 Sep 11 2009 6:17 pm
by Daniel Wee
Re-measuring the load resistance at 1.1V, we get:-

CH1 1.09659ohms
CH2 1.1008ohms
CH3 1.0707ohms
CH4 1.1020ohms
CH5 1.06096ohms

Comparing this set with the previous set (bracketed), relative to CH3 we have:-

CH1 2.42% (2.16%)
CH2 2.81% (2.78%)
CH4 2.92% (2.71%)
CH5 -0.01% (3.42%)

Based on this, we can expect that with the new readings, with the exception of CH5, CH3 will show higher relative voltage than when using the previous set of coefficients. CH2 will gain a little on CH4. Capacity readings will also be marginally lower.


Re: Battery Performance Tester

Posted: Fri 11 Sep 11 2009 7:27 pm
by Daniel Wee
I managed to squeeze a beeper into the circuit board so now we have audible indication of the end of a test run.

More importantly though, I am increasingly convinced that there is an issue either in the CH3 circuitry or in the ADC sampling procedure. I took a half depleted alkaline cell and started a test on each of the channels and took the steady voltage. Since this is the same test and each test took no more than about 10-seconds or so, we can expect the steady voltage on all the channels to be about the same, but they're not. Using two different batteries and reversed sequences, these are the results:-

CH1 0.929V 1.041V
CH2 0.090V 1.024V
CH3 0.978V 1.099V
CH4 0.908V 1.018V
CH5 0.865V 1.011V

As you can see, the various channels do not show the same voltages though some were close. Typically CH3 showed significantly higher voltage. I was expecting the voltages to be at least close. This could mean several things - it could mean that we have a fault in our design although that is rather unlikely at this point of time since full conduction tests seem to verify our coefficients. Furthermore, the way CH3 varies suggests is totally counter-intuitive to what we are measuring in our calibrations. CH3 measures with the lowest resistance and highest current, which would suggest that it should indicate the lowest voltage as well. What we observe, though, is the opposite.

It could also mean that our ADC sampling is somehow skewed or that our PWM rate is too high and exceeds the MOSFET slew rate. This is highly unlikely because the datasheet suggests response times far exceeding 1MHz and our PWM frequency is only 1kHz.

It could mean that the battery chemistry has some sort of hysteresis in the recovery cycle that doesn't respond linearly to our PWM modulated load. In this particular instance, the end result should still be correct although the discharge curve would be skewed. This, I think, is a plausible scenario and is a side effect of using PWM to vary the load. This would account for why the CH3 curve tends to terminate more quickly despite showing higher terminal voltage throughout most of the test cycle. Fortunately, where the end-result is concerned, this is basically a zero sum game. Whatever gains you seem to have at the start will get wiped out by the early termination. This is especially clear in the last chart posted above. We want, however, to have comparable curves but this is becoming increasingly challenging given the variations and the component tolerances we are seeing along with this hysteresis effect.

In order to address this issue, we cannot actually change the load that's presented unless we change the divisor as well. However, that won't solve the problem. One possibility is to change the PWM frequency to something higher. Another possibility is to use a different MOSFET to see if that makes any difference. We can't, however, go changing every MOSFET until we get the perfect match. We could try a different resistor, a better matched one though but that will have to wait till I make a trip to the shops.


Re: Battery Performance Tester

Posted: Sat 12 Sep 12 2009 7:08 pm
by Daniel Wee
Well, setting the PWM frequency to 2.5kHz just didn't work due to aliasing issues but 2kHz is working pretty good since it is a round divisor. In fact, at 2kHz, it appears that CH3 is not as exaggerated as at 1kHz. The only thing is that at 2kHz, we lose some resolution. At 1kHz, our resolution was 0.02% whereas it is now 0.04% at 2kHz. We can probably live with this if it really does address our problem. A battery cell measured across the five channels yielded the following voltages:-

CH1 1.087V
CH2 1.112V
CH3 1.117V
CH4 1.115V
CH5 1.068V

There will be some voltage sag from CH1 to CH5 bu you can see that CH3 is still higher than the rest, but not by as much. The question is if things will be better at 5kHz where we only have 0.1% resolution. We got the following with 4kHz:-

CH1 1.089V
CH2 1.107V
CH3 1.111V
CH4 1.113V
CH5 1.042V

This seems somewhat inconclusive but going to 500Hz and a 0.01% precision is definitely the wrong way:-

CH1 1.113
CH2 1.102
CH3 1.157
CH4 1.116
CH5 1.094

It seems like CH2 and CH4 are the most stable of all channels, regardless of the PWM frequency used, whereas CH1, CH3 and CH5 seems to be very much more sensitive to PWM frequency changes. It is quite possible that part of this problem is due to the lack of PWM precision. As such, we're going to use a different divisor to give us much higher precision. Preliminary tests pretty much confirms that high PWM frequency will help smooth out the variations in terminal voltage. If we can do that without loss of PWM resolution, that may just be our ticket out of this mess.

We de-fluxed the board extensively and seem to be getting a slightly better match on CH1 to CH4. There seems to be a sweet spot with a PWM frequency of 2kHz and ADC frequency of 10kHz so we're going to leave it there for a while to make fresh measurements for resistance after cleaning. Take the average of four sets of readings each, we get:-

CH1 1.070673628 ohms
CH2 1.077114235 ohms
CH3 1.049091134 ohms
CH4 1.077499497 ohms
CH5 1.056440669 ohms

Somehow, I'm not real happy with this set so we repeated this test and got:-

CH1 1.070984739 ohms
CH2 1.078590515 ohms
CH3 1.048785781 ohms
CH4 1.077335052 ohms
CH5 1.061522629 ohms


Re: Battery Performance Tester

Posted: Sun 13 Sep 13 2009 1:15 am
by Daniel Wee
After fiddling for ages with the duty-cycle coefficients, it seems that the miniscule changes I get from re-calibration isn't making any significant impact on the terminal voltage of the cell at all. With the same cell and different coefficients, the terminal voltage for a particular channel is remaining fairly constant by and large. It seems quite immune to the core settings.

I also discovered that CH5 has a problem matching the resolution of CH1 to CH4 due to the use of the PWM output instead of the OCx output. We're going to ignore this for the moment since we don't really use CH5 anyway.

Now, as I get thinking about the test results, I found a rather odd thing. With a sampling rate of 5kHz, I am getting 1.127V for CH2, but when I use 4Khz, I get 1.035V from the same cell, only 10-seconds between measurements. This could be a clue to where our problem is. We have five ADC channels in use so the question is if the ADC is sampling at 1kHz or at 5kHz. This depends on the sampling sequence since we are scanning. I was assuming that upon each trigger, a complete scan would be performed for CH1 to CH5. A check with the datasheet seems to suggest that this was an erroneous assumption and in fact, the individual channel rate is actually 1kHz. So, with a sampling rate of 1kHz and a PWM frequency of 1kHz, we could be losing considerable resolution. However, if we wish to increase the sampling rate, it should be by a multiple of five. So, 10kHz could become 50kHz, for example.

What seems to work best so far is to use a very low PWM frequency (which also has the side-effect of increasing resolution) and a very high ADC sampling rate. We had to take the RK4 filter out in order to achieve this kind of speed but we kept the MA filter.

*update: We were trying a sampling rate of 50kHz (10kHz per channel) and a PWM frequency of 100Hz but this didn't quite work out. I think it's either because of timing/phase error, or simply miscalculation somewhere. So now we're at 500Hz PWM frequency with 0.01% resolution.


Re: Battery Performance Tester

Posted: Sun 13 Sep 13 2009 2:55 am
by Daniel Wee
Upon reviewing the ISR operation, it looks like we might be processing the interrupt in the wrong place. The ADC interrupt happens every timer interrupt which is at the full sampling rate - once for each channel. This explains our earlier confusion about the sample rate because the scope was showing that the ADC interrupt was called at the full sample rate, leading us to think that interrupts occurred every complete scan. As it turns out, this is not the case.

The DMA interrupt is the one we should be using since it is the one that is being called for each sample frame. This means that we have one-fifth the amount of work to do compared to previously, not to mention the over-decimated RK4 and MA filter as a result of this error. The ADC interrupt should just clear the flag and nothing more. In fact, it looks like we may not even need to enable the ADC interrupt.


Re: Battery Performance Tester

Posted: Sun 13 Sep 13 2009 8:20 pm
by Daniel Wee
The Sanyo2700 test was quite interesting and more matched than any of our previous tests. These came off the charger as having taken the following charge:-

BATT1 2063mAh
BATT2 1928mAh
BATT3 1942mAh
BATT4 1865mAh

I had to terminate the test after a few minutes due to the voltage fluctuating up and down so we probably lost some capacity that way, I'm estimating less than 10mAh probably. Here are the results:-
Sanyo-2700-1234ABCD-5.jpg (63.93 KiB) Viewed 7749 times
Reported capacities were:-

BATT1 1686mAh 1835mWh
BATT2 1326mAh 1529mWh
BATT3 1615mAh 1778mWh
BATT4 1441mAh 1578mWh

Notice how all the lines are closer than ever before, with the exception of BATT2. I'm not exactly sure what this means right now but close is good. There is also correspondence between the charge taken and the reported capacities, which is also reassuring.

We have managed to correct a major error in our coding arising from the ISR operations and, hopefully, things will work even better than this but we will need the next few test sets to verify the improvement. Fortunately we've not started out on actual battery tests just yet.