Go Down

Topic: Detecting and Responding to High Frequency Audio (Read 3 times) previous topic - next topic

grizzlby

Would you expect just swapping out the current LM386 for an LM358 would increase the distance from which the mic picks up audio? Or could this extremely short range be a byproduct of the circuit i chose to construct?


Magician

Quote
Would you expect just swapping out the current LM386 for an LM358 would increase the distance from which the mic picks up audio? Or could this extremely short range be a byproduct of the circuit i chose to construct?
You can't swap one IC for another, as they belongs to different classes. Better to build from scratch with LM358.

MarkT

Be careful about the choice of frequency - especially with a phone there may be a very agressive low-pass filter in its audio-out chain, so a tone that's properly out of human hearing may be filtered away. Start with a tone you can hear (easier to debug that way) and then try higher frequencies once the principle is proven.

The standard setup for the Arduino A->D converter allows sample rates up to about 9kHz, which is a problem.  There are ways to configure it to go faster (but less accurately), using some of the control registers.  Other approaches would be to make the opamp
circuit a resonant filter at the frequency of interest and then use envelope detector to measure the amplitude of the response.

Yet another approach is to amplify the audio signal then pass it through a comparator to turn it into a logic signal - this can then be read much faster with digitalRead or pulseIn, and the zero-crossing count method easily employed.  So long as the frequency of interest is the loudest signal this ought to work.
[ I won't respond to messages, use the forum please ]

grizzlby

I took a break from working on this project, but am back now. I twiddled with the pots on my previous circuit until i got the best "on/off" signal based solely on sound amplitude. I then went searching for some method of tone detection and found what seemed to be a very handy Arduino Goertzel library here: http://citizengadget.com/post/25868921072/goertzel-arduino-library.

However, as you pointed out, MarkT, even with the best possible results the detection peaks at 4.5kHz which is way below what my ultimate goal is. For what it's worth, the circuit i've been using gave far too many false positives with this library and its sample code (even after modifying the "magnitude" level).

I'm very interested in the comparator idea, but I will have to search for a documented circuit to test.

grizzlby

I've already found some new promising documentation:
http://www.fanjita.org/serendipity/archives/22-Instrument-Tuner-Audio-Input-Stage.html
is a post detailing a transistor amplifier circuit and

http://www.fanjita.org/serendipity/archives/23-Instrument-Tuner-Zero-Crossing-analysis.html
is a follow-up post on using that circuit in conjunction with ATmega328 (Arduino) chips' built in analog comparator to determine the frequency of a sine wave.

Does this look like a potential solution to my problem? I will try and digest the info and then try the circuit + code for myself soon.

Go Up