Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Detecting a specific audio frequency

Status
Not open for further replies.

chantling

Newbie level 3
Joined
Sep 20, 2009
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,361
I'm trying to find the best (simplest/cheapest) solution to detect a specific audio frequency embedded within an audio file. Basically, I'm looking to make an Audiostrobe decoder, but one that I can control the outputs of for various experiments. Audiostrobe embeds a signal at 19200Hz into an audio file; the decoder detects this signal and activates an LED when the signal is present, using the amplitude of the signal to determine the brightness of the LED. The embedded signal is usually a sine wave oscillating between ~7-30Hz; the Audiostrobe glasses usually accompany auditory stimulation and are used for brainwave entrainment.

Several years ago I built a simple decoder and posted my results here on instructables. I've used these glasses for years with decent results. I'd like to experiment with magnetism, though, something similar to the Koren helmet, and I'd like to address one of the shortcomings of my design: I can't detect the amplitude of the Audiostrobe signal. Although my circuit does change in brightness to some extent with varying Audiostobe brightness levels (I can't figure out why, as the LM567 used seems to be a simple on/off switch), it's neither linear nor smooth. A sine wave test signal does not result in a smooth transition between on and off, and some of the studies I've read indicate that an accurate reproduction of amplitude is important, i.e. a triangle wave has a different effect on the brain than a square wave.

What I specifically need to do:
  • Detect a specific (19200 Hz) frequency embedded within a noisy background
  • Bandwidth is probably around 400 Hz. Shouldn't be too much audio up around this frequency, so if that's unrealistic, might be able to loosen that up a bit
  • Determine the amplitude of the embedded signal so that I can vary the output accordingly. Was planning to use an ADC input of a microcontroller to do this

I've searched and searched online, but almost everything I find involves either audio spectrum analyzers (usually too large of a passband to be of use here) and guitar tuners (which don't usually distinguish between the target frequency and harmonics). I can't seem to come up with the right terms to search for.

It's probably fairly obvious, but I'm not well versed in electronics, and I know nothing about signal processing. I'm ready to do the research necessary to design the circuitry involved, but I'd like some suggestions as to which route I should be looking into before I waste days or weeks on a dead end. I originally planned to just use a microcontroller to analyze the signal; I figured surely an mc running at 20Mhz should be able to detect a 19.2khz frequency. But after finding this PIC-based frequency detector, with a top range of 2148 Hz, I see I was apparently mistaken. I thought about using an analog bandpass filter to only pass a narrow band around the target frequency and simply vary the output based on the total signal level within that band, but my requirements (very steep rolloff, narrow bandwidth) make that seem unlikely. Would digital filters do the trick? Any that aren't too pricey? Are there any specialty ICs that already do what I need but don't cost a fortune? I'm looking into Schmitt triggers, but from what I understand, they suffer from the same limitation as my circuit; either on or off.

A friend suggested that DSP is the best solution to my issue, but while I'm willing to learn what I need to get this going, DSP's seem like a significant investment of time and effort to learn to program for just this one project, not to mention a hefty cost when factoring in development tools. If it comes to that, I'll probably just stick with my existing circuit and live without the ability to alter output magnitude.
 

Hi Chantling,

A good solution is to detect the output of an "N-path filter" fed by the audio signal. There are several toplogies, but i think that the switched-capacitors type can be optimum for your need.
These passband filters allow a very narrow bandwidth with precise central frequency and bandwidth.
Please let me know if you need some advice.
Regards

Z
 

I made a narrow passband filter using biquad topology. A state variable filter was an alternate choice.

I used an inexpensive 324 quad op amp. I tested capacitors in my parts bin until I found 3 matching values. Same for 3 resistors. Matching is necessary if you want to achieve high Q.

My filter had high Q and a narrow passband. It could extract a single morse code signal amid other keyers a few hertz away.

There is a formula for calculating what components are needed to yield your chosen frequency.

Your passband window is 1 percent to each side of 19200 hz. This is achievable with a few other types of filters besides the ones I mentioned.

I've experimented with the 567. Its output is high or low as you state, with a tendency to alternate rapidly between the two states when the incoming signal is (a) slightly off frequency or (b) borderline amplitude or (c) competing with noise.
 
@zorro: I don't suppose you'd have any links to examples of actual applications of n-path filters, would you? I searched and searched for n-path filters, and pretty much all I found were white papers with high level theory on places like ieeexplore.ieee.org or google patents. Switched-capacitor filters give more returns, but I'm unsure as to whether all switched capacitor filters are n-path or not.

@BradtheRad: I'll have to look into the 324. When you say "matching values", how close? Would 1% resistors and caps do the trick? I tried building an analog filter a while back using a filter design tool provided by one of the major IC companies (Maxim?) and one of their dedicated filter ICs. I used 1% resistors, as I had those on hand, but I tried matching the caps from standard 20%, I think they were. Unfortunately, my capacitance meter is just the one built into my multimeter and is not, I suspect, terribly accurate. All I got from the filter was random garbage output.
 

I agree, that an analog bandpass, as suggested by BradtheRad is easiest and not needing special, possibly hard-to-get components. LM324 isn't optimal for a 19 kHz filter, because the low OP GBW causes considerable deviations of real filter parameters unless your filter software doesn't account for amplifier bandwidth. It should be still possible, but a 4 MHz OP like TL08x is better. It also needs some correction for the center frequency. In any case, you should have at least an inexpensive variable frequency function generator to test the filter and adjust resistor values, if necessary.

Some PIC18 processors provide up to 100 kHz ADC sampling rate, with a thoroughly designed simple digital filter (e.g. 2nd order bandpass) you should be able to achieve the specification. Using a PIC24 or dsPIC would be easier.

LM567 isn't designed for linear output, as you mentioned. It may be possible to achive a better amplitude range at the output filter pin. But you can expect a threshold effect with hysteresis at low signal levels.
 

I'll have to look into the 324. When you say "matching values", how close? Would 1% resistors and caps do the trick?

1% tolerance is the amount you have to aim for if you want a passband of 1% (or 2%). Anyway it's the figure usually quoted for critical applications.

The goal is to get the same time constant on each capacitor. (For the filter topology I used.)

My chosen frequency was not critical. I wanted it to be in the range of 600 to 1000 Hz. I wanted high selectivity. The book said matched components are needed to obtain the highest Q.

The book said resistor values of 1000 ohms work well most of the time. I used my DMM to pick out 3 that were within 1 or 2% of each other.

I don't have a capacitance meter. I tested capacitors one by one in an oscillator made from two inverters and a resistor (as commonly used).

I wrote down the frequency each capacitor yielded, and laid the capacitor next to the number. I tested a whole bunch. Eventually I had 3 caps that seemed close enough.

If necessary I could have hooked up two lesser values in parallel, to obtain the desired value.

Or if one capacitor is a few percent less than the other two, it seems like it would be possible to 'bend' the time constant on a capacitor by adding a resistor inline. (Although it must not be so much additional resistance as to spoil the steepness of the rolloff curve.) For instance if effective resistance in neighboring wires is 1000 ohms, then adding a 50 ohm potentiometer will let you adjust the RC time constant on that cap by up to 5%. That will make the cap behave more closely to the other two, to enhance Q. Ordinarily adding resistance degrades Q but in this instance it's made up for by the advantage of being able to adjust time constants.

Come to think of it, it could work to put a 50 ohm pot inline with all three caps. Adjust them carefully to get as close as possible to your desired frequency, and the narrowest passband.
 
Last edited:

Hi,

I learned about N-path filters from the book "Modern filter theory and design" edited by Temes and Mitra (1973), that had a chapter devoted to this type of filters, and from some papers appeared in the Bell Sytem Technical Journal in the sixties or seventies.

N-path filter of the switched-capacitor type (NPF-SC) are very different from the the "switched capacitor filters" (SCF) usually implemented in monolithic IC. They share the fact that both use capacitors and switches, but the main differences are:

Topologically:
SCF use switched capacitors instead of resistors as dissipative elements; accuracy depends of ratios of C values rather than absolute C and R values
NPF-SC use the same topology of low-pass RC filters, but replacing each capacitor by a bank of switched capacitors converts the low-pass characteristic into a band-pass one

Behaviour:
In SCF, changes in switching frequency expand (or contract) the frequency axis
In NPF-SC, changes in switching frequency shift the filter characteristic in the frequency axis

Many years ago I used succesfully NPF-SC in practical applications similar to yours. Specifically, for separate out-of-band signalling tones in telephony systems.
I saw also a modem that used NPF-SC for digitally tune one among several channels in a frequency-multiplexing voiceband system.

Central frequency in NPF-SC is very accurate (determined by the switching frequency, that can be digitally derived from a Xtal oscillator). Bandwidth can be as narrow as you want, and there are no stability issues.

The problem in using active (biquad, variable state, etc) filters is that high Q means high sensitivity to component values, and possibility of unstability.
Some topologies reduce sensitivity by pole-zero cancellation, but nevertheless achievable Q has practical limits.

Regards

Z
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top