1
\$\begingroup\$

I want to create a circuit that can detect audio frequencies and flash RGB LEDs different colors depending on the detected frequency. The frequency range will be from 20 Hz to 12 kHz, after looking at the chart below.

enter image description here

So my question is: what circuit design should I choose to make a good frequency detector? I suppose I would need

  1. Preamp for the microphone (is it necessary for the ADC?)
  2. Band pass filters (active or passive?)
  3. A microcontroller with an onboard ADC that has a sampling rate of at least 24 kHz.

Before I get too excited, are there any circuits out there that already do this?

\$\endgroup\$
  • \$\begingroup\$ US Pat. No. 4429609 does roughly this. And it's from 1984, so you're free to use it however you want. Might only work for single notes played in isolation. Picking out tones from a complex musical signal is a trickier job. \$\endgroup\$ – The Photon Jan 29 '15 at 5:19
  • \$\begingroup\$ I am thinking this is a DSP problem. I am not an expert, but I would definitely be looking at a DSP for this. \$\endgroup\$ – mkeith Jan 29 '15 at 5:27
  • \$\begingroup\$ Thanks for the patent link. I'll take a look at their design process! And I do think this will heavily involve DSP. \$\endgroup\$ – FullmetalEngineer Jan 29 '15 at 5:41
  • \$\begingroup\$ That shows what you could do with 30-years-ago technology. For current stuff, look at Autotune. \$\endgroup\$ – The Photon Jan 29 '15 at 5:48
  • 1
    \$\begingroup\$ You might find MSGEQ7 helpful, assuming the ranges match your frequencies. \$\endgroup\$ – Roger Rowland Jan 29 '15 at 6:22
3
\$\begingroup\$

You don't need a DSP or other fancy solutions -- in this case a straightforward analog circuit does the trick.

It sounds what you need is a classic light organ, aka color organ. They originated in the 1970's, and were used to drive spotlights instead of LEDs.

Jameco sells a kit for this. They also publish the schematic on-line for those that want to DIY. It takes the audio input, runs it through an op-amp pre-amp, and then divides it into three frequency bands. The outputs are used to drive banks of LEDs.

I've built two these (for stereo) and they work well. I have no connection with Jameco. You can get similar kits elsewhere.

\$\endgroup\$
  • \$\begingroup\$ While I like the light organ as a frequency detector, I also want to use RGB LEDs and different PWMs to control their color, which requires some programming. In addition, how good are light organs at detecting volume changes? For example I want soft audio to result in noticeably dimmer LEDs. \$\endgroup\$ – FullmetalEngineer Jan 29 '15 at 22:51
  • \$\begingroup\$ RGB LEDs should work fine, as long as there are individual leads for each color. Not sure where PWM would be aaplicable, unless you are trying to control volume programmatically; in that case I would use an EEPOT like Analog Devices AD5291 in place of R24-R26 in the schematic I linked to. That circuit is very sensitive and the LEDs are very dim for soft audio. \$\endgroup\$ – tcrosley Jan 30 '15 at 0:23
1
\$\begingroup\$

If you want to play with a canned chip, there's this one (the Mixed Signal Integration MSGEQ7 7-band graphic equalizer), and probably others. Sparkfun sells it in hobbyist quantities. Easy to combine with a micro that has an on-board ADC.

enter image description here

If you want to roll your own, a DSP or dsPIC is certainly one way, but I think I'd also consider an ARM processor.

Edit: Please do not let the chip name "graphic equalizer" confuse anyone- it's the brains of a display for a graphic equalizer, not an equalizer.

\$\endgroup\$
  • 1
    \$\begingroup\$ @tcrosley Oh, please. Did you even glance at the datasheet which I linked to? It's got a peak detector with a multiplexed DC output, so it can easily be used for the required function. \$\endgroup\$ – Spehro Pefhany Jan 29 '15 at 17:37
  • \$\begingroup\$ Yes I did look at the datasheet, frankly I missed the DC multiplexing (I thought it was an analog equalizer) so I withdrew my comment. It does say "Seven Band Graphic Equalizer" in the title of the datasheet. I see you have updated your answer to address this. However, unless the OP wants to drive exactly seven LEDs, it is going to be difficult to combine the seven bands into three or five, for example. Also, there is no provision to adjust the volume of each band, which is usually a feature of this type of circuit. \$\endgroup\$ – tcrosley Jan 29 '15 at 18:02
  • 1
    \$\begingroup\$ Thanks, this seems like a component that a lot of DIY LED Organ projects take advantage of. \$\endgroup\$ – FullmetalEngineer Jan 29 '15 at 22:54
0
\$\begingroup\$

That seems pretty reasonable. You'll want to look in to implementing an FFT or a digital filter bank to figure out what frequencies you're receiving. How many 'bins' you want will determine which method makes the most sense. Perhaps the best idea would be to take an FFT and then find the largest peak and then map the frequency of that peak into a color, then use several PWM outputs to light up the LED with the corresponding color. And you're definitely going to want an amplifier of some sort to drive the ADC.

\$\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.