4 Replies Latest reply on Oct 5, 2015 6:01 PM by CMata_Intel

    How to obtain unifrom ADC on Edison/Arduino board?


      I am trying to sample a microphone signal through the analog port A0 on the Edison/Arduino board. I noticed that the sampling is not uniform and slower than I need it to be. Below is a test code I found at (http://www.microsmart.co.za/technical/2014/03/01/advanced-arduino-adc/) and when I run it I get the output below. How can I force the ADC to sample uniformly and at a higher rate? Thanks


      // Arrays to save our results in

      unsigned long start_times[100];

      unsigned long stop_times[100];

      unsigned long values[100];


      // Setup the serial port and pin 2

      void setup() {


        pinMode(2, INPUT);




      void loop() { 

        unsigned int i;


        // capture the values to memory

        for(i=0;i<100;i++) {

          start_times[i] = micros();

          values[i] = analogRead(0);

          stop_times[i] = micros();



        // print out the results

        Serial.println("\n\n--- Results ---");

        for(i=0;i<100;i++) {


          Serial.print(" elapse = ");

          Serial.print(stop_times[i] - start_times[i]);

          Serial.print(" us\n");