Go Down

Topic: AudioFrequencyMeter for Arduino Mega? (Read 217 times) previous topic - next topic

mrtechnology1312

I'd like to read in a frequency from a small electret microphone and I found this library and tutorial on how to do it:

https://www.arduino.cc/en/Tutorial/SimpleAudioFrequencyMeter

but it only works on the Arduino Zero since it's built for the 'samd' architecture. Would anyone know how to convert the source files to work on an Arduino Mega which uses an 'avr' architecture? This tutorial seems like a really simple way to read an input frequency into an Arduino and it would be great to be able to use this circuit and code. If anyone knows any other good way to read a frequency from the MAX4466 electret microphone (https://www.adafruit.com/products/1063) into an Arduino Mega, that would also be helpful. Sorry if this is a tall order, but any help would be appreciated!

Grumpy_Mike

What do you want to measure? Simple frequency measurements like that will only work on sin waves. For more complex waveforms like real instruments it is a lot harder. The problem is all the harmonics make the measurement of the fundamental frequency hard to spot.

mrtechnology1312

Thanks for the reply! I'm just using the microphone to listen for and detect a certain frequency which will be used to signal for the Arduino to do other stuff upon hearing it played once. Would you know how to change some of those source files to work or even a good way to read a frequency into an Arduino Mega?

Grumpy_Mike

What are you listening to?
Do you know its harmonic content?
How unique is this sound? Is it important that other sounds could give a false trigger?

Measuring a simple electrical is simple. Detecting a specific audio sound is not.

mrtechnology1312

It would just be listening to ambient noise while waiting for a high frequency to be played in close proximity to the microphone which gets played for about 5 seconds. Ideally, the other functions would be triggered after hearing this high frequency for about 2 seconds. It's a pretty unique sound that would just be used to kickoff a lot of other processing on the Arduino.

Grumpy_Mike

Quote
It's a pretty unique sound
It might be to you but to electronics it is just another waveform.

Quote
that would just be used to kickoff a lot of other processing on the Arduino.
Doesn't answer the question as to how important it is to you to miss this trigger or to get a false one.

mrtechnology1312

It's vitally important that the trigger is not missed or falsely detected. I believe by design it will be roughly a 4 kHz tone played for 5 seconds from a close distance to the electret microphone.

Grumpy_Mike

I would use an LM567 tone decoding chip to do this.

Any system no matter what it is, is susceptible to false positive and negitave responses, that is just the way the world is.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy