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
};