Spectrum Analyzer, Arduino project with FFT algorithm

The basic idea was to create color organ / spectrum analyzer on arduino board, trying to minimize quantity of external components, like analog filters, LED display drivers, etc.
Spend a lot of time in search on internet I was able to find only two ! project ,  which implemented FFT in order to solve a problem. One of them is:

http://elm-chan.org/works/akilcd/report_e.html

in a few days it will celebrate 6-th anniversary.  The obstacle, at least for me, was to compile / adapt his software for Arduino IDE platform, as it written in assembly and C.  So, I’ve moved on, and was lucky to discover an excellent chunk of code dated back to 1989! They didn’t have floating point co-processor or “blue deep” around at that time, so mathematical skills were in high demand.

Arduino Spectrum Analyzer

FFT algorithm could find application in wide variety of projects, for example, musical note recognition, voice recognition, sound localization etc. It could be done in Arduino, or in combination with PC. In this project all functionality implemented in Arduino.  Sampling, FFT processing and visualization of music, everything done by single arduino Uno board alone!.  The same time, after each stage data could be extracted via serial link to PC. To use the the data provided by Arduino in different application on PC (like interactivity / processing),  you can just pull data over serial link, as it was done for debugging purposes with “f” command.  After FFT-processing input data array x, generated output array fx with  32 elements, “bins”, each representing a range of frequencies. The width of a bin equals: D = 1 / T, where T is input array sampling timing, in our case T = 14.6 millisecond.

D = 1 / (14.6 * 10^-3) = ~ 70 Hz.
So, the value of fx[0] is amplitude DC offset up to 35 Hz;
fx[1] is amplitude in a range   35 <—> 105 Hz;
fx[2] is amplitude in a range 105 <—> 175 Hz;
fx[3] is amplitude in a range 175 <—> 245 Hz;
fx[4] is amplitude in a range 245 <—> 315 Hz;
………………………………………………………..
fx[31] is amplitude in a range 2135 <—> 2170 Hz;
Upper limits could be extended up to 76 kHz.(*)

Sum up first 10 fx bins, I’m getting 35 <—> 735 Hz frequency range for red LED’s, from 11-th to 20-th consequently provides me 735 <—> 1435 Hz  for green LED’s, and from 21-st to 31-st 1435 <—> 2170 Hz range for blue LED’s.

Now hardware part.

I was considering two way to build display, using PWM or BarGraph. In my opinion, PWM is not quite suited with LED, due nonlinearity in their current-brightness response. Probably, PWM approach would be O’K with incandescent lights.

Arduino Spectrum Analyzer
BarGraph design gives better impression, when higher sound volume   highlighted bigger area. Just imagine, how beautiful Fireworks are!
I’ve used Christmas LEDs, that left over since last holiday  :) This is why I put 3 of them in each string, and have to use ULN2003 with 12V power source. Basically, all you need is 12 Leds ( 4 – red, 4 – green and 4 blue ) and 12 resistors, connect led+resistor between output of arduino board  and ground.

For sound input I used a kit MK136 ( 2 mic’s + amplifier IC NE5532 ), powered up from arduino board +5V. Why kit? It provides a board and components. Next, you can easily reconfigure input circuitry for different sound sources as:

[box color=”#985D00″ bg=”#FFF8CB” font=”verdana” fontsize=”14 ” radius=”20 ” border=”#985D12″ float=”right” head=”Major Components in Project” headbg=”#FFEB70″ headcolor=”#985D00″]Arduino[/box]

For more detail: Spectrum Analyzer, Arduino project with FFT algorithm


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top