Arduino Due Frequency Meter?

Hi guys! So I'm new to Arduino and am currently trying to obtain an audio frequency reading from a drum. I decided I would use https://www.arduino.cc/en/Tutorial/SimpleAudioFrequencyMeter this example as a basis but noticed it was for Arduino Zero boards when I had already purchased a Due board. Is there any way I can still do this project but with a Due board instead of a Zero? Or will I have to then buy an equivalent of a Zero board? If I do need a different board does anyone know any boards out there that function the same as a Zero and can still use the Arduino IDE? Thanks guys and I hope someone can help!

...I don't know anything about the library they are using, and I've never tried anything like this, but I know something about audio.

Since you've got the Due, go-ahead and try it. Do you have a microphone & preamp or a microphone board? Or, you can make a bias circuit (2 resistors and a capacitor), connect a headphone-output or line-level audio output and play a recording of a drum (or other sounds).

Now... The problem is, real world sounds contain a fundamental (dominant-lower frequency) frequency and multiple harmonics & overtones. It's the harmonics & overtones that make a Saxophone sound different from a guitar and it's what makes two singers sound different. Drums and cymbals have lots of non-harmonic overtones so they (usually) don't play "notes" and they don't sound out-of-tune when played along with other instruments.

To get an idea of this, you can use [u]Audacity[/u] (free) to look at the [u]spectrum[/u] of a drum hit or other sounds.

Your brain will hear the "pitch" but these harmonics & overtones make it difficult for a computer/processor. Apparently, a few people have made guitar tuners with the Arduino but it seems that most people fail. :frowning:

From what I've read, a method called [u]autocorrelation[/u] works better than [u]FFT[/u] or FHT.

Hi! So I've already gone ahead and made the circuit as shown in the link that I provided so I believe I already have the microphone set up but instead of a headphone jack I'm using the Electret microphone amplifier - MAX4466 with adjustable gain from Adafruit (https://www.adafruit.com/product/1063) so that I would be able to detect the sound coming from the drum. I'll go ahead and see if I can use a different library to try and find a code that might even just detect that there is sound first off and then try and go from there.

I use these Adafruit Electret Microphone Amplifier - MAX9814 with Auto Gain Control [ADA1713], I supply them with 3.3V, they work good. Those modules like to be soldered-in for less noise.

I'll go ahead and see if I can use a different library to try and find a code that might even just detect that there is sound first off and then try and go from there.

That microphone board should work. Try the [u]Analog Read Serial[/u], but take-out the delay. And, try it with silence and something more constantly-loud before trying a drum.

The Due is a little "different" from the other Arduinos, but I assume Analog Read Serial will work...

...You are sampling a wave once every time through the loop, and the serial printing adds some additional delay so you might miss the drum hit. This is just a quick test to see if you're getting "useful" readings.

And, you are sampling a wave that has a positive peak, a negative peak,* and crosses-through zero* twice per cycle, so even with a constant tone the readings will "look random". But, you should see a difference between quiet and loud sounds.

  • The output of the microphone board is biased at half the supply voltage, so with silence you should read about 2048 (not zero) from the ADC and you'll never get negative readings unless you subtract-out the bias. Quiet sounds will jump-around "randomly" near 2048 and louder sounds will deviate "randomly" over a greater range.