Detect a tone

I’m trying to make a simple arduino based tone detector…

the block diagram is as under

The input is through the speaker. when it detects a specific tone (a simple sinewave tone which sounds like Tuuuuuuuuuuuuuuuuu), it switches on the red led…

for testing purpose im generating this tone input sound via a arduino+voice codec+speaker
left_out is the left channel of audio output.
temp2 is a sine wave signal
counter ensures that the tone is produced for roughly 3 seconds duration

 //sine wave output

  left_out = temp2; // put sinusoid out on left channel
  right_out =0; // put inverted version out on right chanel

at the receiver end… i need to trigger an event (like led switch on) when this tone is heard.
I know in theory what to do…
detect the frequency of inputsignal. when frequency matches the frequency i want to detect, trigger an alarm/event.

I dont know how to write this in code !!! :blush:

First question is what frequency do you need to detect?

Assuming its within range I think you need to google search "Arduino Fast Fourier Transform" if the signal is not clean (with other noises). If it is clean then there are several hardware/software options like using comparator, schmitt trigger to convert to digital or just reading analogue and finding peaks.

Another possibility: add a discrete bandpass (LC) to an Analog input and switch the LED above given threshold

I would use an LM567C tone decoder chip:-