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

How to measure Lithium battery voltage with low-power mode 1.8V

Hey everyone. Found this thread about measuring the voltage on lipo battery: devzone.nordicsemi.com/.../how-to-measure-lithium-battery-voltage

  • Hi Michal

    When using low-voltage-mode, supply voltage is ~1.8V. You should not expose higher voltage to GPIO or AIN pins than the supply voltage. More information on the ADC input voltage limitations are on this thread.

    The voltage-divider setup for lithium battery is valid for low-voltage mode because the maximum voltage exposed through the voltage divider to the ADC AIN input pin is V_AIN = 2200 / (2200+10000) * 4.2 = 0.76V.

  • Ok, let's says I'll use this combination: VDD 1.8V, prescaling 1/1 then AIN_MAX is 2.1V

    V_AIN_MIN = 2200 / (2200+10000) * 3.0 = 0.54V V_AIN_MAX = 2200 / (2200+10000) * 4.2 = 0.76V

    And I'll use 8 bits resolution. So I get: (0.76 - 0.54) / 256 = 0.00086

    It's quite small number, will I be able to determine at least 10 different battery levels?

    Or should I change the divider, so it has bigger "spread"?

    Sorry for probably very basic question. I'm quite new to this :)

  • Hi Michal

    Thank you for your question.

    Actually, with 1/1 prescaling and reference voltage set to VBG = 1.2V, the range of the ADC is 0V - 1.2V.

    If you choose 8-bit resolution, which is 256 bits, you get 1 bit output change when you change the input voltage with 1.2V/256=0.004688V. If you choose 10-bit resolution, which is 1024 bits, you get 1 bit output change when you change the input voltage with 1.2V/1024=0.001172V. When the input goes above 1.2V, the ADC output will saturate and show value 255 for 8-bit configuration, or 1023 for 10-bit configuration.

    For the Lithium battery setup and 8 bit resolution, ADC will output following value when the battery is flat: 0.54/1.2255=115 For the Lithium battery setup and 8 bit resolution, ADC will output following value when the battery is fully charged: 0.76/1.2255=161 Result is that you will have 161-115=46 bit resolution in the Lithium battery voltage range when using 8-bit ADC configuration. So you could in principle utilize up to 46 different battery levels. However, I assume that the discharge curve of the Lithium battery is not linear between 3.0V and 4.2V, so you would most likely need to implement a transfer function to convert the ADC output to battery level percentage.

    For the Lithium battery setup and 10-bit resolution, ADC will output following value when the battery is flat: 0.54/1.21023=461 For the Lithium battery setup and 10-bit resolution, ADC will output following value when the battery is fully charged: 0.76/1.21023=646 Result is that you will have 646-461=185 bit resolution in the Lithium battery voltage range when using 10-bit ADC resolution.

    Let me know if you have further questions on the topic.

  • Ooooh, yes, sure.. stupid me :) Thank you Stefan for your awesome and VERY useful advice. Those 46 or 185 levels are probably more than enough. I guess changing the voltage divider would consume more power and we don't want that :)

Related