read frequency

Hi!

it is somehow possible to read the frequency of the input signal in one anolog PIN? Bcs I know that analogRead gives me a response of the input signal voltage. I have a sinusoide that goes from 20mV to 2.7V and I really like to detect is frequency with arduino. I have seen some question similar to mine but the answer where more about the componet to have a positive voltage that about the effective way of how to do it.

Anyone know it?

How high is the frequency?

If it's very slow, you can do it with analogRead() and the intuitive methods.

If it's higher, I'd use a comparator to turn the peak into a pulse, turning the problem into simple frequency counting, so you can detect it with an interrupt (on some atmel chips, you can do this internally with the on-chip analog comparator).

If it's too high for that, use a sufficiently fast comparator and take over timer 1 and clock it off the output from the comparator, then you can count how high timer1 counts within a given length of time (based on other timer/millis()), and derive frequency from that. You'd have to take over the timer. Atmel has an app note with a demo of frequency counting.

2.7 volts should trigger an interrupt, if you just need to count the peaks

A couple of instructables on the topic, if you want a more reliable / precise solution: http://www.instructables.com/id/Arduino-Audio-Input/?ALLSTEPS

http://www.instructables.com/id/Arduino-Frequency-Detection/?ALLSTEPS

And a simillar topic on this forum: [url=http://forum.arduino.cc/index.php/topic,64219.0.html[/url]http://forum.arduino.cc/index.php/topic,64219.0.html

Thank you all! excatly what I needed! and I wasn't able to find!!!