Measuring frequencies on two separate pins??

Status
Not open for further replies.

gatheround

Well-known member
Hey everyone,
I'd like to use my Teensy 3.2 to measure the frequency of two separate audio signals. I see that the FreqMeasure and FreqCount library are hard-coded onto a single pin.. (the LED pin??). Is there any way to use these libraries on different pins at the same time? Or can anyone recommend any other way to measure frequency on other pins?

Here's some details that will hopefully help:

- The audio I'm trying to measure is a clean sine or triangle wave, direct input. Not a guitar and not picked up from a microphone.

- The range of the audio I'm trying to measure is between 100Hz and 4000Hz. For accuracy, I'd love to see +/- .1Hz accuracy @ 100Hz and +/- 1Hz accuracy @ 4000Hz.
 
Then, look at the FreqMeasureMulti library. It can work on up to eight pins (5,6,9,10,20,21,22,23) if I remember well.
BTW: The FreqCount library works like a “classic” frequency counter, which means that you need a gate time of 1s for 1Hz Resolution and 10s for 0.1Hz... The FreqMeasure and FreqMeasureMulti libraries work differently: They measure the period duration in ticks of the 48MHz bus clock and do some math afterwards to get the frequency. This makes that you get much more precise results much quicker, as long as the input frequency is smaller than 5000Hz.
 
Then, look at the FreqMeasureMulti library. It can work on up to eight pins (5,6,9,10,20,21,22,23) if I remember well.
BTW: The FreqCount library works like a “classic” frequency counter, which means that you need a gate time of 1s for 1Hz Resolution and 10s for 0.1Hz... The FreqMeasure and FreqMeasureMulti libraries work differently: They measure the period duration in ticks of the 48MHz bus clock and do some math afterwards to get the frequency. This makes that you get much more precise results much quicker, as long as the input frequency is smaller than 5000Hz.

Oh perfect, thank you! I didn't even see FreqMeasureMulti listed on the main page. It's on the FreqMeasure page, but easy to pass by.

Is FreqMeasureMulti rolled into teensyduino? Maybe just get rid of the old FreqMeasure and turn FreqMeasureMulti into the new version?? If it's exactly the same function but you're able to specify the pin, why keep the old one around??
 
If you have an ongoing project measuring those 2 signals using FreqMeasureMulti, or even start selling commercial product (which is allowed)... and then we come up with an even better library that does even more than FreqMeasureMulti, how would you feel if we just get rid of the FreqMeasureMulti you're still using in your product's code?

Thousands of people have indeed used FreqMeasure in their projects over the years.
 
If you have an ongoing project measuring those 2 signals using FreqMeasureMulti, or even start selling commercial product (which is allowed)... and then we come up with an even better library that does even more than FreqMeasureMulti, how would you feel if we just get rid of the FreqMeasureMulti you're still using in your product's code?

Thousands of people have indeed used FreqMeasure in their projects over the years.

Totally, I understand Paul. I'm not suggesting getting rid of any existing Library at this point, I'm just suggesting that in cases like this the extended functionality could have been incorporated into the existing library instead of an entirely new library that requires a separate help page and examples just to handle one additional parameter. Like if FreqMeasure operates as expected unless a pin# is specified then it acts like FreqMeasureMulti? Do it however you want Paul, I'm happy to enjoy the product and code.
 
Status
Not open for further replies.
Back
Top