Nrf9160: Battery ADC measurement off by ~100 mv

I'm getting a strange amount of error when trying to measure the battery for a custom PCB based on the nrf9160.

Details

  • My VCC_IO is 1.8V
  • My max battery voltage is 4.2V
  • I am using a slightly modified version of the battery sample from zephyr/samples/boards/nrf/battery.
    • I'm using a switch controlled voltage divider, where R1 is 3.01k and R2 is 2.0k

    • I am measuring the analog levels on adc line, the battery voltage going into the divider, and the battery voltage going into the switch.

    • I am using the internal reference of 600 mv.
    • I am using ADC_GAIN_1_3 
      • 600mv * 3 = 1800 mv (Within VCC_IO + 300 mv)
      • An analog value of 145 mv should result in a value of around 3630 mv to be reported from the device.
    • The device is reporting battery voltage of ~3570 mv. 

     This isn't necessarily useful information, but I have another custom PCB with an almost identical measurement circuit but VCC_IO is 3.0V. The device always reports an acceptable value.

    Am I missing something here?

    Parents Reply
    • Hello,

      Sorry for the late reply. It was a bit much to do the week after Easter. 

      I tried to build your project, but I got a lot of build errors. 

      Where did you find the sample with the vbatt module? And what board do you build it for? And does it need to be built from some specific location? Can you try to build it in an unmodified SDK to check that you didn't change any SDK files that are outside the project folder?

      Best regards,

      Edvin

    Children
    Related