Cool Motor Encoders
Hey I have a motor encoder connected to the javelin, the motor encoder provides a square wave with frequency corresponding to the speed of the motor, can anyone tell me how to accurately measure the frequency of the square wave?
Thanks
Thanks
Comments
Add the 2 results together to get the timeperiod in 8.68 usec units.
Then F = 1/T = 1 / (count*8.68usec) = 57600 / (count/2) = 28800 / (count/4)
so F = 28800 / (count >>> 2)
Edit:
if you know the squarewave always has a 50% dutycycle, you can do with
just one CPU.pulseIn() and use
F = 28800 / (count >>> 1)
regards peter