361Views4Replies

Author Options:

I need a way of measuring a 0-1000kHz signal (50% duty cycle square wave from a TSL237) with an arduino. Answered

I'm willing to use external hardware if it is cheap.I've tried using an interrupt base pulse accumulator but when the frequency becomes high the counter increments so fast that it stops the arduino from doing anything else (like stopping counting).

Does anyone know of a nice easy solution to count frequency? Perhaps a fancy 8 pin DIP that talks i2c? I need to be senstive to the very low end of the frequency scale too, so just throwing a prescaler on will not solve this (afaik).

Thanks.

Comments

The forums are retiring in 2021 and are now closed for new topics and comments.
0
steveastrouk
steveastrouk

Best Answer 8 years ago

Oh yeah
http://interface.khm.de/index.php/lab/experiments/arduino-frequency-counter-library/

0
quatch
quatch

Answer 8 years ago

Nice! That looks exactly perfect. I should have checked my email sooner :) I was busy reading the datasheet and dreaming.

0
steveastrouk
steveastrouk

8 years ago

Don't forget, it'll only work on pin 5.

0
steveastrouk
steveastrouk

8 years ago

Arduino's have native counter hardware, which isn't used in the standard code. See if you can find a library that lets you use it.

Then you can either gate the input for a certain period and take the count, or you can time how long a pulse takes.

Page 108 of this link explains the real hardware.

http://www.atmel.com/Images/doc2545.pdf

Another trick would be to prescale the input by dividing it by say 8 or 16, to reduce the clock at the chip by 8 or 16.