Go Down

Topic: 16-bit FFT Code Tweaking (Read 1 time) previous topic - next topic


I'm having trouble figuring out how to take 16-bit FFT code work from say 0 - 400 Hz in 64 bins. The default frequency range is around 0 - 4.5KHz (1/2 the 9KHz default sample rate). Not yet sure exactly what I want for upper freq and # bins but would like to know how to use the FFT and interrupts to tailor the freq and # bins.

So a few questions...
What is the sinewave array and how does it relate to FFT size (# of bins)?
How do I use the interrupt timer to change the default 9KHz sample rate to something lower?
Is there a good tutorial that describes tailoring an FFT on the Arduino?


First off, based on your questions, I would recommend learning what the FFT actually is and how it works on a fundamental level if you want to try to control it.  Read Appendix C of my master's thesis which is on my website under software, or the appendix of the computer music tutorial by curtis roads.

If you want 64 bins spaced from 0-400, you would need to have a 128 sample window for the FFT, and the sampling rate would have to be 800 Hz.  Remeber, window length needs to always be a power of 2, and your bin spacing is Sampling Rate / Number of Samples per Window. You could also use a higher sampling rate, a longer window, and just use the output of the lower bins where the cutoff is closest to 400Hz.

As far as interrupts, the Interval_Timer library is a pretty good route to write your own interrupt/ADC routine, and then you need to store your samples in blocks of size N for processing by the FFT. If you're clever you can double buffer and overlap your windows so that while one block is being processed, you're still collecting samples for the next block.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131