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
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
Hello,
Yes, you can set it to measure the VDD input directly.
To see this done you could either check the BLE Peripheral Proximity application, or the Peripheral SAADC example. For the latter, you will need to change the input from AIN1 to VDD in order for it to measure the VDD directly.
Alternatively, if your device is powered by a Li-Po battery it could be helpful to see this guide as well.
Best regards,
Karl
Dear Karl,
Thanks. Could you provide an example with code?
With kind regards,
Gaosheng
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);
....
nrf_saadc_channel_config_t channel_config =
NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_VDD);
..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);
....
nrf_saadc_channel_config_t channel_config =
NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_VDD);
..