ADC reading stability with nRF52840

I am trying ADC readings for connecting my sensors. To better understand and see the values, I have made a simple connection with 4 10k Resistros in series, VCC on top and GND at bottom. Now I have connected ADC pin at 3rd Resistor with 12 bit resolution configured. 

Some how, I am not getting stable readings and its fluctuating a lot. Any suggestion ? 

Some of the configuration details are as below (and Graph of values are also pasted - 7 days 30Min Average)

#define ADC_NODE DT_NODELABEL(adc) ///soc/adc@40007000/

#define ADC_RESOLUTION 12
#define ADC_CHANNEL 0
#define ADC_PORT SAADC_CH_PSELP_PSELP_AnalogInput0 //AIN5 P0.29 for ISC/ For Dongle AIN0 -P0.02
#define ADC_REFERENCE ADC_REF_INTERNAL //0.6v
#define ADC_GAIN ADC_GAIN_1_5 //ADC_REFERENCE * 6

struct adc_channel_cfg ch0_cfg = {
.gain = ADC_GAIN,
.reference = ADC_REFERENCE,
.acquisition_time = ADC_ACQ_TIME_DEFAULT,
.channel_id = ADC_CHANNEL,
#ifdef CONFIG_ADC_NRFX_SAADC
.input_positive = ADC_PORT
#endif
};

struct adc_sequence sequence = {
.channels = BIT(ADC_CHANNEL),
.buffer = sample_buffer,
.buffer_size = sizeof(sample_buffer),
.resolution = ADC_RESOLUTION
};

 

  • Hi ArunRuchir,

    There could be a couple of factors at play here.

    1. How is VCC provided? If it is a battery source, then over the course of a few days, battery drain, temperature changes, and the circuit's load all can affect the voltage.
    2. Is SAADC recalibrated regularly? Over the course of a few days, temperature could have changed, making recalibration necessary.
      For more information about the need to recalibrate, refer to the SAADC documentation.

    Hieu

  • Thanks Hieu,

    1) The VCC is provided via external Power source. No Battery. 

    2) SAADC neevr recalibrated, though temp change is indeed more than 10 Degree at our site. 

    However, I don't think this still justify the large amount of changes taking place in the values. 

    If you can guide me towards any sample Code, for Temperature monitoring or Battery Voltage monitoring with SAADC calibration, I will try tht and see if it helps. 

    I am using OpenThread to pass the values to an external data logger - just FYI. 

    Regards

    Arun

  • Hi Arun,

    ArunRuchir said:
    If you can guide me towards any sample Code, for Temperature monitoring or Battery Voltage monitoring with SAADC calibration, I will try tht and see if it helps. 

    Please take a look at the Battery Voltage Measurement sample.

    For a reference on how to setup the voltage-divider node, please refer to the Thingy:53 board file and its schematic.

    Regards,

    Hieu

Related