Sound Frequency-based power switch

wswarrior

Nov 12, 2014
2
Joined
Nov 12, 2014
Messages
2
I am working on a project and really don't know where to begin. Wondered if you might point me in the right direction.

What if I had a microphone of some sort, a power supply, a switch and 2 LED banks (red & blue) and I wanted the power to flow to one LED bank (red) or the other (blue) based on sound frequency? So any sound below 146.8Hz directs my power source to the red LEDs and anything above 146.8Hz powers the blue LEDs. No sound = no power to either.

Any thoughts where I might start looking to develop a solution? Would even be willing to pay someone to help me or to simply design it and give me schematic and parts list.

Thanks in advance.
 

wswarrior

Nov 12, 2014
2
Joined
Nov 12, 2014
Messages
2
Great! This is going inside a guitar to power some internal led panels. Thanks for the directional guidance.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
Be aware that accuracy will be an issue. Getting the circuit t switch at precisely 146.8Hz, and having this stable over time, temperature, power supply voltage, and a heap of other variables will be prohibitive. Also if the input signal is other than a pure sine wave (worst case is probably music) then you will need to allow for the fact that the source has a variety of frequency components and the sums and differences of these may also cause issues.

Also be aware that at a frequency near the switching frequency (say ±1Hz) the device may switch back and forth, or be slow to respond to change, or even both.

I mention these things because you specify an accuracy of 0.07% (assuming ±0.1Hz based on the precision of your nominated frequency) which is *really* tight. An accuracy of 2% (±3Hz) would be more easily achievable. Do you need that precision?
 

hevans1944

Hop - AC8NS
Jun 21, 2012
4,968
Joined
Jun 21, 2012
Messages
4,968
You have specified a particular audio frequency to four significant figures: 146.8 Hz, which happens also to be musical note D3 on the equally tempered chromatic scale used in America (and elsewhere). Is there some reason for selecting this particular frequency?

Please realize that there is likely to be a range of frequencies picked up by your microphone simultaneously, some above and some below 146.8 Hz. What do you want your LEDs to do if this occurs?

What is lacking is hysteresis in your specification of 146.8 Hz. In the real world, almost nothing is exact, but what if the sound frequency picked up by your microphone was exactly 146.8 Hz? Would the red LEDs or the blue LEDs light up? Or would both light up? You mentioned in a later post that the LEDs are to be an effects panel built into the guitar. That probably means there is a lot of latitude in their operation, so long as you achieve the "desired" effect!

If you want exclusivity in the LEDs, then the circuit needs hysteresis. There must be an "error band" of plus and minus frequencies centered on 146.8 Hz. The last sound frequency that was less than 146.8 Hz, minus the lower "error band" frequency, results in the red LEDs illuminating. The last sound frequency that was more than 146.8 Hz, plus the higher "error band" frequency, results in the blue LEDs illuminating. If the current sound frequency is within the "error band" then the previous state of LED illumination does not change. This is hysteresis and it is necessary for stable operation of the LED readouts.

Hysteresis can be as small as you like but never zero. Extremely small hysteresis is difficult to obtain, and may not be useful for your purpose. A reasonable hysteresis might be +/- 0.10 Hz. That means any sound frequency greater than 146.90 Hz lights the blue LEDs while any sound frequency lower than 146.70 Hz lights the red LEDs. Any sound frequency between 146.70 Hz and 146.90 Hz results in no change of the previous LED illumination condition.

So, how do you achieve your goal? I think I would use two active filters, one a high-pass and the other a low-pass, with a corner-frequency of 146.8 Hz. From there it can get a lot more complicated. You need some way to compare energy coming from the low-pass filter to energy coming from the high-pass filter and decide which is greater than the other, so as to select the LEDs (red of blue) to light. Since this is a guitar effects display, a simple full-wave rectifier on each filter output could be applied to a comparator to perform the selection, but you would also need a threshold comparator ahead of the filters to blank the LEDs if there are no strings being played.

The roll-off characteristics of the filters could be important, but this is determined by the type of filter and the filter order. See this Wikipedia article. I would tentatively suggest a second-order Butterworth filter with 12 db per octave roll-off to start with. These are fairly simple to implement with a few op-amps and a handful of resistors and capacitors. I am probably too old to mess around with musical stuff anymore, and it would behoove you to keep this gadget as analog as possible, so I am going to suggest that someone in this forum, @KrisBlueNZ for example, chime in with a circuit you can try.
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
Good advice from Steve and Hop there.

A semitone or half-step, or one fret on the guitar, is a frequency change of about 6%. I'd guess that accuracy to ± half a semitone, and hysteresis of ± half a semitone, would be appropriate for the application, so it might be achievable with good-quality capacitors and resistors and a tone decoder.

I agree with Steve and Hop that anything more complicated than a single note is not going to work with a simple tone decoder. Even a guitar tuner, which has a micro inside it (at least, modern ones do) can't make head or tail out of a polyphonic source. Some kind of fast Fourier transform, with logic to find the lowest note, might be workable, but that's a LOT of work!

Perhaps if you describe what you want to do, instead of how you think it can be done, we may be able to suggest something.
 

Arouse1973

Adam
Dec 18, 2013
5,178
Joined
Dec 18, 2013
Messages
5,178
Yes the tone decoder I mentioned should achieve less than 1Hz resolution with no problems, the data sheet states it has 0% to 14% bandwidth, don't know about 0% :) but they are quite good. We used to use these for carrier wave detection at 27 KHz, once calibrated, even over reasonable temp ranges they worked well.
Adam
 
Top