Best way to filter audio for frequency dependant actions?

Hey frens,

I'm new to Arduino and programming so I'm a bit overwhelmed by the volume and variety of stuff here haha.
For a project I'm looking for the necessary sensors/opamps needed to trigger frequency dependant actions. So say a low frequency of say 90hz picked up by the mic sensor would trigger x while a higher frequency of say 12k would trigger y.
The majority of microphones I found are just voltage dependant (=volume) and not frequency based. I have the explore IoT Kit.

Also are there any codes regarding this type of project I could use as a basis?

Thanks a ton guys!

the Kit does not include any microphone so you'll have to get one (or build a circuit that cuts frequency and trigger a pin).

if you go the audio route, the MKR WiFi 1010 board is probably fast enough to perform an FFT with the Arduino Sound library

I would use an LM567 chip for each frequency you want to detect.
Here is the first project link I found but there are plenty more

Software tone detection is not a simple thing to do. When the sound source has a complex waveform it is practically impossible.

1 Like

Of course, a microphone picks-up both otherwise recordings would sound pretty terrible! :smiley:

But yes, it is a lot easier to read/analyze the amplitude than it is to analyze the frequency information.

It is not the microphone it is the circuit after the amplifier. A module that gives just the peak amplitude level is followed by an "envelope detector" circuit, a typical one is shown here.

Most microphone modules I have seen have both, but you can always modify any board by connecting direct to the amplifier's output, or by removing the envelope detector circuit.

1 Like

Thank you Mike. I'm just reading up on the available modules and that seems to be right. There are some with analog and digital connections one can hook up to.

To do the audio processing on the Arduino in software, you're going to have to tackle two problems:

(1) capture a sample of sound using a microphone input -- maybe a MEMS direct digital microphone

...or an analogue microphone with an audio sampling program. Google found me some examples.

(2) Look for your target frequencies. There are several ways to do this. There are Arduino FFT and FHT libraries
Look into the Goertzel algorithm, which is a good deal faster (maybe not using floating point like this example) that allows you to measure the audio power just at specific target frequencies:

All of this is possible on a 16MHz AVR. You're not going to get continuous processing, but sampling of 20ms samples every 200ms or something on that order.

Well you are not going to use an I2S bus on a Uno or other ATMEGA chips to get sound into it. You need something that supports that bus, like a BNE nano.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.