# How do I calculate sampling rate of external ADC?

I am wondering if someone could explain this to me.

I want to calculate sampling rate of external ADC. I am using ADS8320 which has max sampling rate of 100kHz, with Arduino MEGA 2560. SPI divider is set to 128, which makes SPI frequency 125kHz. Baud rate is 115200 (I am not sure if this is important).

Thanks a lot!

• If you have the ADC then you can write a little sketch to time it yourself. So you will know for sure.
– user31481
Aug 31, 2017 at 14:49

To get an idea of the sampling rate write a loop that takes 10,000 measurements and time how long it takes. You have your sample rate, not perfect but gives you some idea.

``````long start = millis();
// the loop

Serial.print( 10000000/(millis() - start) );
Serial.println(" samples per second");
``````

Easy.

1. Based on your set up, figure out the spi speed.

2. Take a look at the adc datasheet, figure out it's frame of transmission . Aka how many pulses per frame / sampling.

3. The product of the numbers in 1 and 2 gives you the minimum time per frame. The inverse of it is the maximum transmission in your application. That speed is cap by the devices own max sampling rate (100ksps).

4. Your actual sampling rate will depend on your specific application but it should not go above the number obtained in 3.

5. You may need to factor in other timing requirements as well so read the datasheet carefully. But the gist is the same.