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

What is the pin for the battery voltage on nRF52pca1040 DK?

Hello,

I would like to instruct my application to read the battery voltage on my nRF52pca1040 DK, I am intending to do so through the SADC.

I will feed the board with the battery that is on its botton side, so I was wondering what is the PIN to read the battery in such a case, looking into pca1040.h doesn't say that pin.

Thanks in advance,

Regards before after

Parents
  • Hi,

    You can configure the SAADC channel with VDD as input. You don’t have to use a GPIO for this.

    nrf_saadc_channel_config_t channel_config =
        NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_VDD);
    

    The SAADC result can then be converted into volts, and further calculated into percentage based on a linearized version of the battery's discharge curve. Take look at how this is done in the saadc_event_handler() function in the e.g. the ble_app_proximty example in the SDK.

    Code snippet from the example:

    batt_lvl_in_milli_volts = ADC_RESULT_IN_MILLI_VOLTS(adc_result) +
                              DIODE_FWD_VOLT_DROP_MILLIVOLTS;
    percentage_batt_lvl = battery_level_in_percent(batt_lvl_in_milli_volts);
    
  • Thanks Sigurd, I have followed your tip and used the nrf_saadc_channel_config_t channel_config = NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_VDD); command, however I don't know while execution my SAADC seems to lose the pin referece to VDD. I have attached two images on the main post

Reply Children
No Data
Related