Electret mic frequency detecting

Hey guys, I really need help on a project here. My robot has to begin its task when detecting a 3.8 kHz soundwave. I've tried bandpass filtering and ampliflying the signal in a circuit to get a straight digital input to the arduino, indicating whether the frequency was detected or not.

Unfortunately it is not working, and I've read some forum posts about using FFT to convert time domain to frequency domain, but I can't make any code work here. Should I send just the amplified electret mic analog signal to the arduino, sample it and do the transformation? Both software sample codes or hardware solutions would be very welcome.


What sort of "soundwave"? How accurate does the 3.8KHz have to be? +/- 200Hz, +/- 2Hz?

If it's fairly pure then just amplifying it so it clips will turn it into roughly a square wave and using pulseIn() to measure average pulse length might be good enough.


Thanks for the tip, Steve! It is a senoidal wave, and the accuracy can be from 3.3 kHz to 4.3 kHz

But the signal is not fairly pure, it may have considerable noise

The Goertzel algorithm is often used to detect single tones. Here is one implementation for Arduino.
Autocorrelation is another.

Are you reading anything? i.e. What do you get with Analog Read Serial Example or the Digital Read Serial Example? (Take the delays out of the example programs, and of course read whatever analog or digital pin you're actually connected to.