Sound frequency Reader

Hello,

I’m trying to build up a system that measures the frequency of sound with a Duemilanove. I am using the FreqCount library and it is working pretty well with a single microphone. However, I have to use two microphones but there is only one compatible pin with the FreqCount library (pin 5).

I have few questions. Firstly, do you know what is the reason of “the necessary digital 5 pin usage” ? Secondly, is there any other pin to use on the same processer? And the final question, what other alternatives do you recommend for such an application?

turgutdaeagle: Hello,

I'm trying to build up a system that measures the frequency of sound with a Duemilanove. I am using the FreqCount library and it is working pretty well with a single microphone. However, I have to use two microphones but there is only one compatible pin with the FreqCount library (pin 5).

Please consider that working with two channels might require computational power the Arduino is unable to provide: you will need to sample twice. It would not be a huge problem though in case you lower your frequencies and switch to FreqMeasure library.

I have few questions. Firstly, do you know what is the reason of "the necessary digital 5 pin usage" ? Secondly, is there any other pin to use on the same processer?

The pin5 reason is the pin is hard coded within the library for faster access: instead of reading the pin using a library (life the analogRead function) the author has used direct access to the Atmega register. The pin is indeed changeable, but you need to open up the library and update it yourself.

I'm unable to tell you which other pins you can use on a Duemilanove because I don't have the library code at hand, but I believe you can use almost any other pin, providing you correctly update the library code.

And the final question, what other alternatives do you recommend for such an application?

It really depends what you are aiming at and which frequencies are you interested into: the full audible spectrum ranges between 20Hz and 20kHz, but you might have a different target...

The pin5 reason is the pin is hard coded within the library for faster access: instead of reading the pin using a library (life the analogRead function) the author has used direct access to the Atmega register. The pin is indeed changeable, but you need to open up the library and update it yourself.

http://www.pjrc.com/teensy/td_libs_FreqCount.html I've obtained the library from the website written at the left side. I tried to change the library, as you said, but I could not figure out what should I change in the code. Do you have a chance to help me about it? What should I change?