speed from counter


Thread Starter


Hi there,

I have an incremental encoder that produces 5000 ppr, two signal in quadrature and an index signal. Also I have 24-bit counter clocked at 6.67MHz. The counter can be operated in single to quadruple counting, frequency or pulse width measurement mode. The rated speed is 10 rps and the machine spin fluctuates between 0 to 15 rps.

What is the best mode for this situation ?
How can you obtain the speed but not using derivative of the position ? Can you give the formula please.


Steve Myres, PE

What I've done in a similar situation is to create a timer which recycles at some interval, say 0.05 sec. I then create a shift register of approximately the last 10 values which is activated on the timer output pulse to push the present value into the register and clear the running count value. Then total the last 10 samples, divide by 10 times the time interval, the encoder line resolution, and you have velocity.

You can balance the averaging tendency vs sensitivity by adjusting the length of the time interval and the number of samples.

Curt Wuollet


Speed in RPM = (frequency X 60)/5000 or simply count the index pulses per second and multiply by 60.