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

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).


Oh yeah
quatch (author)  steveastrouk4 years ago
Nice! That looks exactly perfect. I should have checked my email sooner :) I was busy reading the datasheet and dreaming.
Don't forget, it'll only work on pin 5.
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.


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.