2
\$\begingroup\$

I want to design a simple LED audio spectrum analyzer kinda like this.

Which method would be less expensive to do:

  • Use many filters for each frequency band, depending on how much bands and LEDS I want to use
  • Use a microprocessor to do FFTs

Clearly, doing FFTs will have a certain lag, but would that lag be significant enough to overcome the expensive of the many filters of the first bullet? Which method would be most power efficient? Or is this extremely dependent on the hardware? Any input is much appreciated. This is the first time I am taking on such a project, and I want to get as much feedback as possible. Thank you!!

\$\endgroup\$
  • 1
    \$\begingroup\$ googling AVR FFT turns up some promising results. The LEDs will draw far more power than your spectrum analysis. \$\endgroup\$ – Ben Jackson Apr 3 '11 at 4:03
  • 3
    \$\begingroup\$ Keep in mind that FFT uses a linear frequency axis, while a spectrum analyzer typically has a logarithmic frequency axis. \$\endgroup\$ – stevenvh Apr 3 '11 at 9:38
  • 1
    \$\begingroup\$ @Stevenvh Correct. Still can be done, just needs a longer FFT and some averaging of bins to turn it into sorta log scale. \$\endgroup\$ – Kellenjb Apr 3 '11 at 21:51
  • 1
    \$\begingroup\$ electronics.stackexchange.com/questions/10371/… \$\endgroup\$ – endolith Apr 4 '11 at 21:06
6
\$\begingroup\$

Well, most people are good at analog circuits, or MCU/DSP stuff. Not many people are good enough at both. So... Do what you know better.

The DSP approach will be more flexible, and would allow you to do cool things like: change the decay time, do both a peak and RMS reading at the same time, etc. The response time will be slower than an analog approach, but still faster than what your eye could perceive.

As Ben Jackson pointed out, the LEDs will draw more current than the rest of the circuit. Assuming that you're driving each LED with 20 mA, and you have 31 bands with one LED on for each band then you're pulling 620 mA just for the LED's.

As for which approach would be less expensive, that all depends. If this were a commercial product then the DSP based approach is by far the cheaper one. But the economics of working in your basement changes the whole equation. For example, if you need to spend $100-500 on DSP/MCU development tools then that's an issue. So in the end, we can't say which is cheaper-- only you can.

So this brings me back to my original point: do whatever you do better. Do whatever one makes sense for you-- and just know that might not be what makes sense to others.

\$\endgroup\$
4
\$\begingroup\$

Since FFT is linear in frequency and you most probably want a logarithmic display you may also check the Goertzel filter algorithm. It may be faster if you only need the values of several frequency bins.

\$\endgroup\$
  • \$\begingroup\$ Never heard of the Goertzel filter algorithm before but it looks very worthy to check out. Thanks for the link! \$\endgroup\$ – O_O Apr 5 '11 at 8:51
  • \$\begingroup\$ It is not very well known but works really nice and is fast, even on the AVR. \$\endgroup\$ – jpc Apr 5 '11 at 10:53
3
\$\begingroup\$

Microchip supplies an FFT library with their C compiler for the dsPIC 16-bit digital signal controllers. The free version of the compiler is suitable, and the chips are quite inexpensive. The on-chip ADC could be used for this application, all that needs to be added are the drivers for the LED array. The Microchip Explorer 16 board has an audio spectrum analyser using the LCD display, it's supplied as part of the demo software. You should be able to use the low-cost Microstick for this; the dsPIC33FJ128 that can be used with it should have enough memory.

If you don't have any DSP experience you are likely to find this a challenging project, however.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.