How to measure the input voltage value by ADC?

Hi Team,

Can I measure the input voltage by ADC on nrf52840 chips without the help of other peripherals? 

If can, could you provide me with some examples?

With best regards,

Gaosheng

Parents Reply
  • Hello Gaosheng,

    lgs said:
    Could you provide an example with code?

    If you just would like to sample the VDD of the device using the SAADC you may do so by opening the peripheral/saadc example, and changing the line:

    ..
        nrf_saadc_channel_config_t channel_config =
            NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_AIN0);
    ..

    To
    ..
        nrf_saadc_channel_config_t channel_config =
            NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_VDD);
    ..


    This way, the example will log 5 VDD measurements every 2 seconds.

    Best regards,
    Karl

Children
No Data
Related