As you probably will know, the Fast Fourier Transform was published by James Cooley and John W. Tukey in 1965. And as this algorithm goes with n*log(n) there is hardly no way to improve it. What you can do is replacing the loops by the equivalent number of statements which will nearly explode the size of the code.

With only 32 samples you will fill 25 kBytes of FLASH so it will fit in an ATmeag328.

With 128 samples it just fits into an ATmega1280 which is rarely to find nowdays so you go better for an ATmega2560.

And with the new Serial Plotter you can show the time signal and the FFT without using external hardware.

click to enlarge |

The screenshot shows an input of a slightly distorted sine signal of 7 kHz and the FFT giving you the peak at 7 kHz a small first harmonic (14 kHz) and a strong second harmonic (21 kHz) as well as some ground noise.

contact: nji(at)gmx.de