Not getting required frequency from SimpleAudioFrequencyMeter circuit

Hello All,

I have made Arduino circuit as mentioned in SimpleAudioFrequencyMeter example.

I have a MKR-Zero board with me.

I am using VCC pin instead of IOREF pin shown in the example as MKR-ZERO does not have an IOREF pin.

On hardware side, I am connecting microphone of a headphone to 3.5 mm audio jack. ( hope this is fine ).
{ What else can be used here for Audio input, I am little confused here. }

When I run the program, I get -1 as frequency output and not the actual one.

What might be an issue in this ?

Thanks in advance for your help.

Regards,

Vinay

I am connecting microphone of a headphone to 3.5 mm audio jack. ( hope this is fine ).

If this is an electret condenser mic it has to be powered. A regular soundcard provides 5V from the microphone jack. Handheld electret condensers usually have a battery.

There is also not enough gain for a microphone.

You might try plugging-in the headphone-out from your computer (or phone, etc.) to see if you get "better readings"

Also, run the code from the [u]Analof Read Serial Example[/u] to check your signal levels. Silence should read around 512 (half of the range). Very-loud sounds should jump around "randomly" between around zero and around 1023. Of course, that's amplitude, not frequency, but it will tell you if you have a good signal or not.

[u]Here is a schematic[/u] of an electret mic amplifier with more gain and power provided through a resistor. (The resistor is required because you can't "short" the mic output to +5V or 3.3V.)

...I don't know how the "simple frequency meter" works or what you're trying to do, but real-world sound contains many simultaneous frequencies. So, unless you're generating sine waves (with your computer or with an audio signal generator) you may not get useful results.

Hello,

I could run sample analog programs and get proper input and output.
The program and circuit is failing for getting sound data from Mic in case of Frequency meter program.

I am doubting the IOREF pin connection , as I don't have it on MKR Zero board.

Regarding sound detection, I am focusing on fundamental frequencies of humming sounds.

Regards,

Vinay

I am doubting the IOREF pin connection , as I don't have it on MKR Zero board.

That's not the problem. That's just the power for the preamp.

The program and circuit is failing for getting sound data from Mic in case of Frequency meter program.

Try a sine or square wave. [u]Audacity[/u] can Generate sine/square wave files at a frequency of your choice that you can save (export) and then play-back on your computer (or you can play directly from Audacity without saving).

Try a direct-electrical connection from the headphone output first (no microphone). That way, you'll have a pure signal at a constant level with no room noise. If that works try the pure-tone through speakers to the microphone.

Also, if you have a pair of powered computer speakers you can use those test your microphone & preamp. (But, don't put the speakers too close to the mic because you'll get feedback.)

Try putting your sound into Audacity and see what you get.

vjirgale:
Regarding sound detection, I am focusing on fundamental frequencies of humming sounds.

If you can post a WAV file of the sound, I'll try running it here with the YIN algorithm (the advanced but CPU intensive way).