FFT Library for Arduino
I am planning to make a slightly more complex but fun project which is visualizing music with LED. There are couple of ways of doing it. VU meter is display amplitude of sound. Fancier way of visualizing music involve frequency analysis of music. Think of your old music component or music visualization of Winamp and etc. The frequency of signal can be analyzed by FFT. Fast Fourier transform (FFT) is rather a complex math which I don’t clearly understand. It is quite difficult to do with 8 bit microcontroller like Arduino.
I tried some FFT code for Arduino and found fixed point FFT from ELM Chan works best for me. The main problem with Chan’s code was written by Assembler which is difficult to make it as a Arduino library. Luckily, AMurchick from Arduino forum make it work as a Arduino Library. I modified code little bit and add Processing application (modified from boolscott’s) to visualize data. All credits should go to where it belong.
DownLoad FFT Library : http://code.google.com/p/neuroelec/downloads/list
Code : http://code.google.com/p/neuroelec/source/browse/#svn%2Ftrunk%2Fffft
Of course, I want to show you how well it works. Compare FFT results from Oscilloscope and Arduino.
This entry was posted by neuroelec on March 23, 2011 at 2:57 pm, and is filed under arduino. Follow any responses to this post through RSS 2.0.You can leave a response or trackback from your own site.
-
Hey,
I’ve been wanting to make this spectrum analyser for a long time. But the problem is I’m a newbie and dont know jackshit about any of this..ive been reading stuff on the internet which tels me ill need multiplexers, arduino and leds to get this going. The problem is that with this little knowledge , i have to complete this in 1 and a half week..as i am doing this for a microcontroller credit course….if its not too much can help me make it? give me the guidelines as to what is required to make this and what codes ill need to do etc etc. I would really appreciate if you can help. I’m running short on time..so if i can help ite be awesome!
Cheers -
#4 written by neuroelec 2 years ago
@Suren,
I need to know what you want to make to help you. You want to decide what kind of sound source you want to use. You can use line in or mic as a sound source. Take a look at example code of FFT library. Visualizing frequency data can be achieved by array of LED or LCD in general. If you use a array of LED, you need multiplexer. 10 days is too short time to make whole thing unless you already have everything you need. If you don’t have parts you need, order them as soon as possible.
-
Hey
I plan to make something like this for examplehttp://www.youtube.com/watch?v=sPxQ8j3nSx0
I Will be using a line in and an array of LEDs.. everything I think I’l need is readily available at nearby stores…still I’d like if you can give me a list of things I may need? That’d be really helpful. Also is the TLC5940 something i should buy?
Thanks a ton for helping out!
Cheers -
#6 written by neuroelec 2 years ago
@ Suren
If you make something like in the video, you can use tlc5940. Simpler one would be 8×8 led matrix like here http://www.youtube.com/watch?v=WdwSnZ8dMLw.For sound feeding, you need a opamp to amplify the line-in or mic signal. You can buy something similar as this http://www.sparkfun.com/products/9964 or make your own circuit with any opamp.
-
Yea exactly, I am not asking you to do the work for me…I need guidance. So yeah help me out with the circuit please?as that is something i have no clue about that i mean none. so a basic idea of what will be connected to what? i know programming and since i can modify the code that you have used i can use a litlle help on that…
Now, help me with this please…using the fft library and a specific code i use a line in to the arduino and proccess the fft on the arduino itself and then use that to make the LEDs glow right? Once i burn the code for the fft related calculation on the proccessor, i dont need a computer to proccess the data or do i?
-
#10 written by neuroelec 2 years ago
@suren
If you use 8×8 led, you can find circuit and code from http://www.arduino.cc/playground/Main/DirectDriveLEDMatrixThe fft library is run on Arduino, you don’t need computer. Processing code is just for demonstration.
-
Great work! I was working on a similar project earlier this year and was playing with Welch’s Power Spectral Density Estimation function to get a simple spectrogram (https://ccrma.stanford.edu/~jos/mdft/Power_Spectral_Density_Estimation.html).
What do you think about your FFT vs Welch’s method in terms of efficiency and feasibility for Arduino?
Cheers!
-
#14 written by neuroelec 2 years ago
-
No, I haven’t. I tried my “numerical recipes” version of the standard DFT is too taxing. The Minim library has a DFT routine, but I don’t know how to implement it for other frequencies (non audio). Heres a video of it working http://vimeo.com/1601790
I really wish I could get a routine up, but Im considering dealing with the post processing on an android for now.
-
-
-
-
-
-
#27 written by Shaun 1 year ago
Hello,
Thanks for sharing.
I am currently having a problem with the compilation of the code.
The error is : In file included from visualizer.cpp:15:
C:\Users\Shaun\Desktop\arduino-0022\arduino-0022\libraries\fft/ffft.h:25: error: ‘prog_int16_t’ does not name a typePls can you help me and suggest to make this operational
-
#28 written by Learner 1 year ago
-
#30 written by neuroelec 1 year ago
-
-
Done.
http://pastebin.com/VaKYGdiEif you want to drive 512,1024points, you should use arduino MEGA(8KB RAM).
when you use ordinary arduino(2KB RAM), you can drive up to 256 points.
-
-
-
#33 written by mark 1 year ago
here is the set up for our project.
we are proposing a wireless noise detection and PC-based monitoring system. This will identify the level of sound inside the library using a sound level sensor circuit. As soon as the sound level exceeds the acceptable and allowable level of sound for library, as verified by the sound level meter, signals coming from the detector circuits will be transmitted wirelessly and will be received by a tuned-radio frequency receiver. The receiver is interfaced with the librarian’s computer to monitor the table and with the warning system to display the table which creates the noise.
How are we going to interface the receiver with the computer and warning system? pls help us. tnx tnx
-
-
#36 written by Frudah 1 year ago
-
-
#40 written by Jcote 1 year ago
-
#41 written by DGP 12 months ago
Hi, really nice work!
I’m new to this Arduino stuff I’m hoping you could help me out because this analyser it’s just what I need.
When I run the FFTvisualizer in processing I get this error “java.lang.ArrayIndexOutOfBoundsException: 1” and it high lights me this command
“myPort = new Serial(this, Serial.list()[1], 57600);”
I don’t know that I’m doing wrong. Thanks a lot!-
go google.
https://www.google.co.jp/search?q=java.lang.ArrayIndexOutOfBoundsException%3A+1I supporse
bad: myPort = new Serial(this, Serial.list()[1], 57600);
good: myPort = new Serial(this, Serial.list()[0], 57600);”
maybe.
-
-
#43 written by moses 7 months ago
Hello, I’m trying to do the same thing, but i’m trying to combine ShiftPWM + FFT. I’m using a MSGEQ7 (7x Band Grpahic Equalizer IC) and I want to use 7x columns of RGB LEDs for each of the 7 different frequencies. I just want to know If i will connect all the RGB LEDs via the same CLk, DATA, and LATCH pins on Arduino (Leonardo) without having to worry about hardwiring each column of LEDs to different digital output pins for the different frequencies… Please help on this… I will be using 74HC595 Shift Registers which will be connected in series, but i dont know if the 74HC595′s from all the 7 columns will be connected all together… or seperately…
-
#44 written by omoses 7 months ago
Hello, I’m trying to do the same thing, but i’m trying to combine ShiftPWM + FFT. I’m using a MSGEQ7 (7x Band Grpahic Equalizer IC) and I want to use 7x columns of RGB LEDs for each of the 7 different frequencies. I just want to know If i will connect all the RGB LEDs via the same CLk, DATA, and LATCH pins on Arduino (Leonardo) without having to worry about hardwiring each column of LEDs to different digital output pins for the different frequencies… Please help on this… I will be using 74HC595 Shift Registers which will be connected in series, but i dont know if the 74HC595′s from all the 7 columns will be connected all together… or seperately…
-
#45 written by Matias 7 months ago
-
#47 written by FrydDog 7 months ago
Hello,
I wish to apply your code to a led matrix with the spectrum split into approx 20 columns with the frequency amplitude being the rows. What I want to know is how to create 20 different frequency groups each with an integer amplitude value that I can apply to each different column. My problem is that I am having a hard time trying to understand how to use the FFT library. Driving the matrix is no problem for me I just need to know how to create the column values I need from the FFT library.
I’d appreciate any help you can provide.
Thanks! -
#49 written by Aviran Malik 6 months ago
-
#50 written by Aviran Malik 6 months ago
-
-
#51 written by Petrus Botha 4 months ago
Hi there, I am using the ffft.h library to do analysis of audio on an Analog port but wish to do so with an array of analogRead data. How can I change the code to accept the values from an analogRead instead of straight from the ADC or change my analog Read values to represent the the same value types as in the capture{} array before sending it to the fft routine.
I know that direct port access does not work together with AnalogRead commands and will thus remove the direct Port ADC initiate function and replace this with FAST ADC functionality
Any help please
-
#53 written by Reza 1 month ago
-
- Comment Feed for this Post
- mois-Blog – Lauschen statt wiegen?
- [DIY] Arduino + PaperToy + Micro + LED – Adrien Baptiste
- 60439 – Advanced SIS: Hybrid Instrument Building » sound sensing and arduino
- NEW PRODUCT – Electret Microphone Amplifier – MAX4466 with Adjustable Gain « adafruit industries blog
- BACK IN STOCK – Electret Microphone Amplifier – MAX4466 with Adjustable Gain « adafruit industries blog
Didn't find any related posts :(
How to connect to arduino board ?