Analog Input / DAQ

ATmega:

"To get full resolution you need to run the ADC at 15,000 samples per second or slower."

""By default, the successive approximation circuitry requires an input clock frequency between 50 kHz and 200 kHz to get maximum resolution. (at 10-bits)"

 

Measure the performance of analogRead() & the ADC

void setup()
{
  Serial.begin(9600);
  pinMode(A0, INPUT);

  Serial.println("analogRead() performance:");
  Serial.println();
}

void loop()
{
  long t0, t;

  t0 = micros();
  for(int i=0; i < 1000; i++) {
    analogRead(A0);
  }
  t = micros()-t0;  // calculate elapsed time

  Serial.print("Time per sample: ");
  Serial.print((float)t/1000);
  Serial.println(" us");
  Serial.print("Frequency: ");
  Serial.print((float)1000*1000000/t);
  Serial.println(" Hz");
  Serial.println();
  delay(2000);
}

The free running sampling frequency is 16Mhz/128/13=9846Hz for UNO

Very useful project link:

Arduino sound level meter and spectrum analyzer

GitHub ArduinoSoundLevelMeter


 


Do you need help developing or customizing a IoT product for your needs?   Send me an email requesting a free one hour phone / web share consultation.  

 

The information presented on this website is for the author's use only.   Use of this information by anyone other than the author is offered as guidelines and non-professional advice only.   No liability is assumed by the author or this web site.