Accuracy of ADC at higher rate on E - Series

I have been trying to get accurate ADC reading at 16KHz sampling rate. I am using SparkIntervalTimer library to get the sampling rate. Due to higher sampling rate, I have set the ADC sampling time to 56 Cycles.

Here’s the code I used to get the data.

#include <SparkIntervalTimer.h>
#include "Particle.h"
#include <math.h>

IntervalTimer ReadADC;

volatile uint16_t raw_data[8000], i = 0, ADCSample = 0;
volatile bool SampleFlag = true;
const int PIN_AIN = A1;


void Toggle(void) 
		raw_data[ADCSample++] = HAL_ADC_Read(PIN_AIN);    
    if(ADCSample == 8000)
		  SampleFlag = false;

void setup() {

  pinMode(PIN_AIN, INPUT);  
  ReadADC.begin(Toggle, 61, uSec); 

void loop() 
        for(i = 0; i < 8000; i++)
			raw_data[i] = 0;
        SampleFlag = true;

Note: Ignore the code error if found. I pasted the code without testing but this is the same code(logically) I have used to get the data.

Hardware used:

  • E series development board
  • Powered with stable 5V VIN instead of USB or battery.
  • 1.24V stable DC applied to the A1 Pin.
  • Internal 3.3V as a reference voltage.

I logged approx 15000 samples and plotted on the graph which helped me find that ADC does fluctuate a lot. I have no idea what is causing this fluctuation. Power supply is for sure stable as it was from a lab power supply.

Here’s the data:

Is this the limitation of ADC? All suggestions and help are welcomed.


It looks like a variation of 10 out of a scale of 0-4095. That’s +/- 0.004028 volts, which doesn’t seem like that big of a variation to me. However, this application note explains how to get the best performance out of the ADC:


This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.