I received a youtube message from a mouser about the encoder of Kojimouse7.
I want to answer the question in this blog
so that we share the technique to estimate velocity of a mouse with other mousers.
Kojimouse7 has two sets of a spur gear with 8 holes and a photo reflector. The processor counts the edges of the holes while the wheel is rotating
in order to measure the speed of the wheel.
It can detect 2 edges for a hole, so, the resolution of this encoder is 16 per revolution.
Since my mouse is controlled based on the 1 milisecond periodic interrupt,
that low resolution encoder doesn't give enough precision for the instantaneous velocity.
It is almost impossible for a mouse to run smoothly only with the encoder.
However, 100 ms average gives a comparatively precise velocity.
In this case, the problem is that the obtained velocity is past information,
which is a velocity of the mouse approximately 50 ms before.
In order to compensate the delay, Kojimouse7 uses acceleration sensor.
Although an acceleration sensor is not good at measuring precise velocity
in the long time scale due to the accumulation of errors with time,
the integral of the acceleration in very short period
gives the velocity change with good precision.
So, accelerometer is very useful to compensate the velocity obtained using the encoder,
which is past information.
The instantaneous and latest velocity of a mouse is roughly obtained by adding the average of the encoder and the velocity change measured by accelerometer.
In short, Kojimouse7 measures the velocity by means of combining the average velocity obtained by the low resolution encoder and the velocity change measured by the acceleration sensor.
I hope you (readers of this article) understand the method above.
Further questions and comments are welcome.