Help with computing correct SAADC output value

I am using an Nrf52840 and sdk V14.2.0.

My question is how to compute the battery voltage based on my hardware.

The hardware uses AIN0 to measure.

The hardware has a resistor divider: GPIO output pin >---806K---X---->2M------>GND.

AIN0 is connected at point X above. The GPIO pin is configured as an output and set to a logic 1.

How would I scale the reading taken this way to represent a supply voltage of 3V?

With 3V as VDD AIN0 would see 2V I believe.

I use default config so gain is 1/6.

Battery has no protection diode in series.

Thanks.

Parents
  • Hi,

    If you have GAIN set to 1/6 and use the internal 0.6V reference, you will have a input range from 0-3.6V (0.6V/(1/6). 

    With your voltage resistor, the input will be around 2M/(2M+806K)*VDD = 0.71*VDD. With VDD=3.0V, this corresponds to 2.14V.

    The sampled voltage will be represented as a digital output, depending on the configured resolution. With 12 bit resolution, the digital output of your input voltage will be (2.14V/3.6V)*4095 = 2432.

    Best regards,
    Jørgen

Reply
  • Hi,

    If you have GAIN set to 1/6 and use the internal 0.6V reference, you will have a input range from 0-3.6V (0.6V/(1/6). 

    With your voltage resistor, the input will be around 2M/(2M+806K)*VDD = 0.71*VDD. With VDD=3.0V, this corresponds to 2.14V.

    The sampled voltage will be represented as a digital output, depending on the configured resolution. With 12 bit resolution, the digital output of your input voltage will be (2.14V/3.6V)*4095 = 2432.

    Best regards,
    Jørgen

Children
No Data
Related