Hi everyone,
I am working on a project to detect frequencies from 0 to 2700Hz on the arduino. The output should be stored on a 10bit variable
Can someone give me a few ideas to start?
Hi everyone,
I am working on a project to detect frequencies from 0 to 2700Hz on the arduino. The output should be stored on a 10bit variable
Can someone give me a few ideas to start?
Have you heard of Google ?
raschemmel:
Have you heard of Google ?
Never hear of it, is it German?
I have a few frequency libraries installed such as freqmeasure. None does exactly what i need.
For this particlar project I am looking at something a bit more low level that allows me to select the timer to be used and most importantly it has a timeout to detect zero frequency
At your max frequency of 2700 Hz there would be about 6000 clock cycles between peaks so the processor has more speed than is needed which is a good thing.
If the peaks are well-defined like a square wave input you could attach the signal to one of the interrupts and increment the counter every time the interrupt is triggered. Use a comparator with a variable threshold if the peaks are not well defined and then attach the output of the comparator to the interrupt pin and count them as defined above.
Hope this helps,
wade
wwbrown:
At your max frequency of 2700 Hz there would be about 6000 clock cycles between peaks so the processor has more speed than is needed which is a good thing.If the peaks are well-defined like a square wave input you could attach the signal to one of the interrupts and increment the counter every time the interrupt is triggered. Use a comparator with a variable threshold if the peaks are not well defined and then attach the output of the comparator to the interrupt pin and count them as defined above.
Hope this helps,
wade
Thank you.
The peaks are well defined, but duty is not 50%. There is also noise along that line, so I would need some sort of filter.
Lastly, I need to have a timeout if no pulses are received to indicate 0 frequency
Lastly, I need to have a timeout if no pulses are received to indicate 0 frequency
You chould easily add code to do this. Start a timer if no change for X milliseconds trigger time out code.
Here is some code you can use/modify to your needs.