This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Inconsistent battery measurement

Hi!

I'm having issues with inconsistent battery readout results. I'll elaborate more below, but in general, I have multiple devices which 'sleep' most of the time, and when they wake up they measure the battery voltage using the SAADC, translate it to battery %, and report it via BAS. My problem is that within a few hours, with nothing major changing, I can get an enormous variance in the battery % values reported. The voltage is read before any peripherals draw current, before advertising starts, the batteries are placed in a control environment so the temperature is constant, the code they run is constant, and there is nothing else I can think of which can affect them.

My devices use: nRF52840, CR2032 batteries (~3V). No relevant peripherals draw current until after the SAADC read is completed.

To get the battery %, I use the SAADC with pre-scaling 1/6, 10 bit resolution, reference voltage 0.6A, I use the linearization formula suggested here for the CR2032 curve. While I understand the curve may be inaccurate in terms of it matching reality for my specific battery, I should still expect it to give me consistent readouts- i.e, that the battery % values given should be ballpark accurate, should not increase sporadically, with minor fluctuations etc.

When I try to read the ADC multiple consecutive times with 1 ms sleep time in between them, I get a small variance between the results, lets say up to 5%. its only between different reads in different wake ups, where I see this large gap between measurements.


I'm not sure what could be causing such a large variance in the measurements, and would love it if someone could point me in any possible direction.
Here is an example of the values I'm logging:

Day0 08:36 - ADC value 849, Bat 90%

Day1 14:55 - ADC value 827, Bat 48%.

Day1 14:56 - ADC value 839, Bat 73%

Day1 14:57 - ADC value 844, Bat 83%

Day1 15:26 - ADC value 802, Bat 30%

Day1 21:27 - ADC value 785, Bat 21%

Thanks!

  • Hi,

    A.P said:
    The 5 multiple samples are there, as you say, to average out any outlier samples. I placed a 1 ms in between them to 'space out' the samples over a bit of time. There shouldn't be any peripherals drawing power before or during the sampling.
    A.P said:
    Yes, we set up the SAADC channel as follows:
    A.P said:
    The channel is set to NRF_SAADC_INPUT_VDD before init and #define HAL_SAADC_VBAT_CHANNEL 0.

    Great, thank you for clarifying.
    The channel configuration seems all right to me, but you might not need the full 40 US ACQTIME. Not that it should matter in this case though, since you are not doing high-frequency sampling.

    A.P said:
    You're right. I copied this code from the example, and indeed we do not have a reverse current protection diode in place. Accordingly, we do not use this value in any of our calculations, it was placed there before we had decided whether to place a reverse current protection diode or not, and we had overlooked removing it from our code. Thank you for that point though, I will make a note of it in case we add a reverse battery protection diode to our PCB.
    A.P said:
    We are using a custom board, not the DK. No reverse current protection is in place.

    Thank you for confirming this. So it sounds like it has not caused any inaccurate readings, which is good. The reverse current protection in place on the DK's is there mainly due to the multiple POWER options with different voltage ranges the DK's have available.

    A.P said:
    I'm afraid I still have not been able to catch this raising battery values while having a debugger attached to the board. I'll try to give you the data as soon as possible. Just so I'm sure we're on the same page, you need the ADC readings as well as the battery% calculated from every sample. Is there anything else you'd need?

    I will take a look at it whenever I get the data, no worries at all! Since I know which linearization scheme you have then I primarily need the SAADC readings and the interval in which they are taken ( i.e if there is 10 min between each sample ).

    Best regards,
    Karl

Related