# Increasing analogread speed on the Arduino Uno

I want to transfer data from my smartphon to the Arduino by using the audio jack of my smartphone. For this I need verry high reading frequencys.

I have used

``````bitClear(ADCSRA,ADPS0);
``````

to boost analogread to ~10microseconds, which would be enough. But somehow I am still wasting 5.4 ms at the beginning of the transmission.

The only thing between signal start and first analogread is a start of a for loop:

``````while(analogRead(A0)<50) (true); //wait for start of transmission
for(i = 0; i<500;i++){
}
``````

But does starting a for loop take 5.4 ms? Do you have any ideas?

• Before we spend any more time on this, what conversion speed/rate do you require? – Ignacio Vazquez-Abrams Jan 23 '15 at 3:24
• Currently recieving a 40 bit packet takes about 10ms. I would consider 5ms a good value. – gorilla Jan 23 '15 at 11:14
• An Instructable on audio sampling got 125us per sample using analogRead(), down to 26us per sample by bypassing analogRead, reading straight from the register, and clipping to 8-bit resolution. See sections 5 and 6. I suspect that's pretty much as fast as it gets. instructables.com/id/Arduino-Audio-Input/?ALLSTEPS – j-g-faustus Jan 23 '15 at 12:27
• I am allready at 10us. But between seeing the first signal and saving the next signal 5.4 ms pass. – gorilla Jan 23 '15 at 12:56
• So only the first cycle (i==0) takes 4.5ms, all the others (i>0) take 10uS? From the datasheet; `A normal conversion takes 13 ADC clock cycles. The first conversion after the ADC is switched on (ADEN in ADCSRA is set) takes 25 ADC clock cycles in order to initialize the analog circuitry.`. Try doing a dummy analogRead in the setup function. – Gerben Jan 23 '15 at 16:39