The standard optical mouse contains all of the hardware necessary for tracking X/Y movement on a flat surface. With a bit of modification, you can tweak the illumination and focal length of the device to create a compact motion tracking module for your robotics projects.

Mac A. Cody has done a really nice job of documenting a couple different configurations using the common Agilent/Avago ADNS-2610 Optical Mouse Sensor that powers a lot of cheap optical mice. The motion sensor pictured above has been hacked to sit further above the surface than a stock mouse, and he’s included some fairly simple example code for reading the X/Y movements from the sensor.

The cool thing about using something like this, aside from the cheap cost, is that the motion detected by this system isn’t dependent on your gearing, traction, or relative speed between wheels or tracks. If you are moving, the camera detects it. If you aren’t, it can tell that as well. This is pretty difficult with standard wheel encoders, where you can tell that a wheel is spinning, but not that the robot is moving.

Cody’s Robot Optical Motion Sensor #1 – Link
BTC Optical Mouse Hack – Link
Interface to Optical Mouse Sensor (PDF) – Link