Hi,
I need a bit of help to fully understand how ADC works on nRF52832.
I am using a Thermistor sensor like the following to measure temperature: Epoxy Thermistor - 3950 NTC
I have followed this setup to connect Thermistor sensor to AIN0(GPIO2) of nRF52-DK:
So, I have connected one leg of Thermistor sensor to GND and the other leg to AIN0(GPIO2) of nRF52-DK, with a 10K(0.1% accuracy) pull-up resistor connected to VSHLD(VDD).
Questions:
-
When I was calibrating my Thermistor sensor I noticed the VDD on nRF52-DK is 2.85V rather than 3.3V! is that normal?
-
Does that mean my usable ADC resolution is the following, considering
.gain = NRF_SAADC_GAIN1_6
?
- ADC value at 2.85 V – 10 bit setup: 2.85V * (1/6) / 0.6 V * 1023 = 810
- ADC value at 0 V - 10 bit setup: 0V* (1/6) / 0.6 V * 1023 = 0
- Usable ADC resolution - 10 bit setup: 810 - 0 = 810
- Can I increase my usable ADC resolution by making
.gain = NRF_SAADC_GAIN1
?
I started with saadc_pca10040 example and after a bit of modification to the example code I managed to measure temperature.
- How can I change the example code to create a 12 bit setup?
The example code seems a bit complicated for a simple ADC project.
-
Do I really need PPI and timer_handler() function to perform ADC or I can get rid of them? If it is OK to remove them, how can I do it without breaking the code?
-
Also, Can I use the internal pull-up resistor on the nRF52-DK instead of an external 10K resistor? If yes, what's the disadvantage of using the internal pull-up resistor over an external one?
-
To apply such change, do I need to change the
NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(PIN_P)
in nrf_drv_saadc.h file?
from:
#define NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(PIN_P)
{
.resistor_p = NRF_SAADC_RESISTOR_DISABLED,
.resistor_n = NRF_SAADC_RESISTOR_DISABLED,
.gain = NRF_SAADC_GAIN1_6,
.reference = NRF_SAADC_REFERENCE_INTERNAL,
.acq_time = NRF_SAADC_ACQTIME_10US,
.mode = NRF_SAADC_MODE_SINGLE_ENDED,
.pin_p = (nrf_saadc_input_t)(PIN_P),
.pin_n = NRF_SAADC_INPUT_DISABLED
}
to:
#define NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(PIN_P)
{
.resistor_p = NRF_SAADC_RESISTOR_PULLUP,
.resistor_n = NRF_SAADC_RESISTOR_DISABLED,
.gain = NRF_SAADC_GAIN1_6,
.reference = NRF_SAADC_REFERENCE_INTERNAL,
.acq_time = NRF_SAADC_ACQTIME_10US,
.mode = NRF_SAADC_MODE_SINGLE_ENDED,
.pin_p = (nrf_saadc_input_t)(PIN_P),
.pin_n = NRF_SAADC_INPUT_DISABLED
}
- What other changes do you recommend to
NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(PIN_P)
profile for better and faster ADC? like can I make.acq_time = NRF_SAADC_ACQTIME_3US
?
Thanks in advance