arduino ADC and FFT

Hello everybody

I'm giorgi Jambazishvili developing a spectrum analyzer using arduino. This isn't to hard tic but it depends on frequencies I want to analyze. For audio frequencies I used FFT library of open music labs and sender buffer to serial program written by me using C#.

Then for now I want to analyze frequency spectrum and max frequency I want to be 50 kHz. I modified ADCSRA register and decreased prescaler and thought that everything would work but its maximum frequency is the same- about 20khZ.

My main question is how I can increase frequency range and convert it to spectrum to send to my program via serial.

Need to see the code to see where it is going wrong.
Have you seen this thread: Faster Analog Read? - Frequently-Asked Questions - Arduino Forum

Unlikely you can get 50 k on UNO (you haven't say what board).
Here is math: UNO doesn't have DMA, it's max sampling rate 140-150 kHz, with 100 % load CPU.
You may get 100 k. sampling for your 50k input, but whatever cpu time left wouldn't be enough to do FFT or serial transfer.

Let us do the numbers!

  1. The ADC takes 112 us to convert 10 bit sample (approx 10 K samples per second @ 16 MHz F_CPU). Selecting a lower resolution gives higher sample rate; 56 us at 9 bit (20 K). 30 us at 8 bit.

  2. The processor can work in parallel with the ADC. That gives approx 1800 instructions (@ 10 bits per sample) to do ISR, incremental filter calculation, send data, and other background tasks.

  3. Send data (UART) is also in parallel with the processor but you need to have the corresponding baud-rate. Converting to text will take at least 100-200 us so that is not an option. Two bytes raw data per sample over UART will require at least a baud-rate of 200 Kbps for 10 K, 10 bit samples. Simple compression can reduce this by 1.5-2.5.

  4. Buffering data to SD or Flash is also an option but this depends on the application logic.

Cheers!