FFT example code for use with Arduino UNO

Status
Not open for further replies.

funfrancis

Well-known member
Hi

Could anyone pls help me with modifying the Teensy FFT codes for use with Arduino code ?

The LineIn in the audio board could be replaced withe the analog port in the audio board.
(i.e.) The output from the pre-amplifier is connected to any of the Analog ports in the Arduino board.
 
Yeah....
But just a simple program that can get Data croon the analog port and represent it as fft data......
 
I need your help in writing the program

Also could you provide me the updated FFT library for the Teensy as I get "missing library errors" as I try to run them.
 
The FFT for Teensy is part of the Teensy Audio Library, which comes with the Teensyduino installer. Just run the installer, and in Arduino select Teensy 3.2 from Tools > Boards. Then you will find the library under File > Examples > Audio.

Please watch the tutorial video. FFT is shown starting at 34:56.

http://www.pjrc.com/teensy/td_libs_Audio.html

All of the code used in the video can be found in File > Examples > Audio > Tutorials.

It only works on Teensy 3.2. Arduino Uno is incompatible.
 
Also here: http://www.dspguide.com/ch31.htm

But really, why? Your scientific calculator has SIN, COS, TAN buttons... do you spend weeks or months studying Taylor series and CORDIC algorithms before using them? The internal details of FFT are horribly complicated.

@funfrancis - You've posted dozens of absolute beginner level questions, both here on on Arduino's forum. Really, it's ok to be a beginner. Everyone has to start somewhere. But this is *not* beginner level material. If you're still struggling with the very basic aspects of programming, like for loops, do not waste your time (and the time of numerous people on forums) with extremely advanced stuff that you have no hope of mastering until you develop your own programming skills much more.
 
Also here: http://www.dspguide.com/ch31.htm

But really, why? Your scientific calculator has SIN, COS, TAN buttons... do you spend weeks or months studying Taylor series and CORDIC algorithms before using them? The internal details of FFT are horribly complicated.
I assume this was for me.

Well, I consider the Fourier decomposition of arbitrary waveforms as one of the fundamental theorems in mathematics and IMO, everyone trying to do signal processing, MUST at least once in their live, programmed a DFT and understand a the implementation of a Cooley-Tukey radix two algorithm. OK, most EE will do that in early curses, but everyone else should not be afraid to try to understand at least the mathematical language behind a Fourier series.

To your question: Yes, I do that indeed, as it was part of my job to improve existing signal processing algorithms or to apply them in areas that differ from the areas they were developed for.

Anyhow, you are correct, to use an FFT one does not need to know the details but only a good cookbook, but funfrancis asked for a formula and even Wikipedia can give the formula plus a lot of references.
 
Hi,

I have Teensy 3.2.
Is there an example of using FFT on Teensy without the Audio shield?
Is the ADC of Teensy capable of doing that? What kind of sampling frequency it can achieve?
 
The ADC as any other ADC just converts an analog value to digital. It does not do FFT.
The Audio shield does'nt do that, too.
Not sure what you're asking.... You can find FFT examples under "examples" of the audio library.
The Audio library works with 44.1 kHz.
 
Also the FFT classes in the audio library simple use the ARM CMSIS library calls, so you might be better off
searching for something like the source of "arm_fast_rfft_f32" or "arm_rfft_q15" and then figure out how
to port that to non-ARM platforms. However that's not exactly trivial, or necessarily useful to you.

Or you could simply look for a generic Arduino FFT library directly.

What are you trying to do? Is a Fourier transform actually what you need?
 
I am making a spectrum analyzer.
It does work on Arduino Uno with a FFT library. But it seems the sampling frequency of the Arduino is around 8 kHz.
The same code works on my Teensy, but the results are not the same.
Using the "Audio library works with 44.1 kHz." implies buying the Audio shield, right? This will take at least two weeks to receive.
So that is why I was asking what is real frequency of the build in ADC. I wan to try without the Audio shield for now. Maybe it is higher than the 8 kHz of the Arduino Uno.
I do not see such an example where the Audio shield is not used. Maybe I am missing it?
 
Status
Not open for further replies.
Back
Top