Please help me calculate Arduino analogRead() speed, and deMUX/MUX speed

First, a question concerning the speed at which we can read Arduino analog input pins. In the analogueRead() reference ( it says:

It takes about 100 microseconds (0.0001s) to read an analog input, so the maximum reading rate is about 10,000 times a second.

If the Arduino is a 16Mhz chip, wouldn't that means 16,000,000 cycles / 100 microseconds (100 cycles) for the analogRead(), thus giving 160,000 reads a second and not 10,000 reads a second? I'm missing something big, but I'm not sure what it is!

The Atmega datasheet also cautions against switching analog pins in close temporal proximity to making A/D readings (analogRead) on other analog pins. This can cause electrical noise and introduce jitter in the analog system. It may be desirable, after manipulating analog pins (in digital mode), to add a short delay before using analogRead() to read other analog pins.

What does short delay mean? 1 microsecond, 10 microseconds, 10 milliseconds, 100 milliseconds?

Let's say the delay is 100 milliseconds, a pin takes 100 microseconds to read, and we can read 1 pin at 10,000 times a second, how do we calculate how much time it would take to read all 6 analog inputs? Using my above formula, I would have guessed 16,000,000 / 600 (100 microseconds for each pin) = 26,666 reads a second. Obviously, that's wrong!

Now, let's say I use the CD74HC4067 to add more analog inputs. This chip provides 16 inputs for 1 input on the Arduino. So, the total analog inputs could be 96. How much slower would this be? Would it slow down linearly from one CD74HC4067 to two, to three, etc... Or would the slow down be exponential?

Finally, let's say I multiplex 3 inputs for a total of 48 analog inputs, what type of sampling rate can I expect? What about multiplexing to the full 96 analog inputs?

wouldn't that means 16,000,000 cycles / 100 microseconds (100 cycles) for the analogRead(),

Don't understand your arithmetic there.

Don't understand your arithmetic there.

total CPU events per second / time of 1 analog input read = number of possible analog input reads 16Mhz (16,000,000 microseconds) / 100 microseconds = 160,000

Obviously this doesn't work since the manual says there's a maximum of 10,000 readings per second and not 160,000... Why?

No, still don't understand your arithmetic.

1 / 100useconds = 10 000.

The processor clock speed doesn't enter the calculation like that.

The ADC is a successive approximation device, and each iteration is clocked by a divided-down processor clock.

The ADC takes 13 ADC clocks to convert. The standard prescaler divides the system clock (16MHz) by 128 to give 125kHz ADC clock. Thus conversion time is 13 x 8us, or 104uS.

For 10 bit resolution it is recommended that the ADC clock be set between 50kHz and 200kHz. Faster clocking means more noise / less accuracy.

The prescaler can be set to any power-of-two factor from 2 to 128. The ADC clock should not exceed 1MHz. Setting the ADC prescale to divide-by-16 would give a conversion time of 13us, but perhaps only 6 bits of accuracy, and a low impedance source (1k or so) might be needed

total CPU events per second / time of 1 analog input read = number of possible analog input reads 16Mhz (16,000,000 microseconds) / 100 microseconds = 160,000

It takes 100uS to do an A/D conversion. This figure already takes into account the running speed of the processor so it is a mistake to include it in any calculations again.

100 microseconds (100 cycles) for the analogRead(),

No 100uS is only 100 cycles if the clock speed is 1MHz, at 16MHz clock rate will get you a 0.0625 uS cycle time so it will take 1600 clock cycles to take a reading.

I Think what is missing here is the Time / Frequency relationship:

T = 1/F and F = 1/T ( TSECONDS ) ( FHZ )

Each CPU Clock = 62.5nS 1/.0625uS = 16 MHz


While I realize that this isn’t the question asked, bear with me and I will tie all this together…
I think after using the A/D inputs on the Arduino, that IF I wanted high speed low noise A/D measurements I would use an external A/D conversion device. There are several Phillips devices that offer 12 - 14 bit A/D conversion accuracy, low noise and low drift and I2C data transfer from 1 to 8 inputs. I have a couple of 4 channel 14 bit devices I bought on Ebay that can convert to 2 chan Differential measurement @ ($2.00 Ea). Sadly for some the combined noise and Aref accuracy of the Arduino will allow no better than about 7 to 10% total accuracy from source to indicator (LED, LCD or software (this includes divider resistance accuracy @ 1% and Vref tolerance). With 10 bits and +/- 1 bit accuracy @ 1.1V Arefthe smallest signal the the analog to digital converter capable of is ( 1.1 / 1024 ) or about 1070 uV @ +/- 1 bit / +/- 5? - 10? % Aref accuracy. With an LM113 1.25V Ref diode and a 10K pot the Aref could be set to 1.024V yielding a 1mV step +/- 1 count… however I have measured noise in the 1 to 5 mV range from input power ground to the nearest ground for the analog inputs… with no sketch loaded, with “Blink” operating the noise is 15 - 25 mV on the ground bus. While I didn’t bother to measure the actual AVss noise I am sure after looking art the PCB layout that the noise will be a very significant part of any really low level A/D measurements. There are several important reasons for this OPINION. 1. Setup and hold Spec’s for an A/D measurement are RARELY MET in any Arduino A/D measurement I have yet to see 2. FACT the most common complaint is that Analog Measurements are “Noisy” “The Value needs to be filtered/averaged”, AC measurements are inaccurate… etc, etc, etc… I have seen a great deal of time spent here in Fixing minimal hardware with software “Patches” for a board that was NEVER intended to be a precise analog metric device of any kind. I have seen here (and elsewhere with other products much the same complaints) on one forum I was advised that a .5% (LM34 @ 10 - 30 Deg C) device was no good… That I SHOULD USE a DS18B20… with a +/- 1.5% accuracy because “It’s the Modern Method”. The reasons why the poorer quality device was to be preferred are simple it’s accuracy is not a function of the Vcc / Vref variance and the processor switching noise (I am deliberately excluding temperature effects). The final thought is in the method of A/D conversion itself… A small internal capacitor is “Charged” from an analog input and the value is “Stored” and converted to a digital value. If “Setup” and “Hold” requirements aren’t met the accuracy of the measurement is drastically degraded. I am specifically leaving out the subject of AC measurements due to the nature of periodic measurement of a periodic waveform as that is a completely different subject. Measurements I have made on the Arduino Uno R3 indicate that uncorrected/calibrated measurement accuracy is approx 5% with the Arduino doing nothing for 100 uS prior and post measurement and that a high quality Op-Amp (Low noise/drift) voltage follower is required for accurate ( > 5 - 10% ) and a minimum of 50 uS pre measurement time be allowed for the A/D measurement to “settle”. These conditions for a 0 - 1V input using the 1.1V Vref. The “normal 5V Vcc” Vref isn’t even CLOSE due to loading, wire resistance, ground noise and choice of PSU (USB OR Ext Power). So in conclusion the question about how fast can the “native” Arduino measure voltage is really irrelevant as there are several highly relevant specifications missing from the question. If the desire is to make 96 A/D conversions with CD4067BE devices it would take an estimated 1 mS per measurement for addressing the Mux, allowing for settling time, making 10 or so measurements/channel for averaging and storing/using the measured data unless it were stored to an external static ram for later processing. I should point out that this opinion relies on stable (relatively) dc values to be measured… if the input is noisy and I assume it is then it might well take several mS / measurement to return a small window of what an analog input is really doing. So in the end one would have a very small aperture of a very big piece of relative time. With proper measurement technique and calibration the Arduino would make a Fine battery monitor for any chemistry battery but a poor somewhat noisy, relatively inaccurate measurement device for real world dynamic voltage measurement unless it was a dedicated measurement device rather than a Very Fine General Purpose Microcontroller Educational Device as I believe it was intended… IMO