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

Using ADC to measure battery voltage

I am attempting to measure battery voltage through the ADC, but am getting inaccurate results. In my setup, I have a 4.2 V battery divided down to the bandgap range using a 274k and 100k resistors, so the voltage at the ADC input is 4.2 * (100/374) = 1.12 V.

I've configured the ADC to convert at 8 bits, to use no prescaler, and to use the bandgap as reference. Additionally, I am not concerned with polling the battery voltage at a high frequency.

The result i get is 0xc4, or 196, which translates to a measured battery voltage of: (196/255) * 1.2 * (374 / 100) = 3.45 V

My questions:

  1. Is my ADC result to battery voltage equation incorrect (i.e. I am not compensating for something)?

  2. I see in the other examples that larger resistors are suggested--how important is this?

  3. I've scoped the ADC conversion, but did not notice a significant voltage dip. The voltage moved approximately 20 mV, but nothing near the amount that would result in this sort of error.

Thanks in advance.

Related