Rotational (or linear) measurement using an optical mouse sensor
This Design Idea utilizes an optical computer mouse's sensor for measuring rotation of a disk which can be mechanically connected to any sort of rotating apparatus. One feature is to allow adjustment of the pulses per revolution by changing the sensor's position along the disk radius.
The CMOS optical sensor of the mouse chip provides a non-mechanical tracking engine. Inside the chip, images are captured, digitized, and digitally processed.
For instance, let's consider the simple and low cost OM02. The sensor measures position by acquiring surface image frames and mathematically determining the movement direction and value. The sensor is mounted in a polystyrene optical package and is designed to be used with a high intensity LED. It provides a complete and compact tracking engine. It has no moving parts and requires no precise optical alignment. The OM02 produces a quadrature output for both X and Y directions of movement. The resolution is about 0.0025 inches, and the motion speed, up to 16 inches per second.
The IC generates a quadrature X-direction output signal which emulates an ordinary encoder's output. Both X & Y can be used for a 2D system. X1 and X2 quadrature signals are generated at a maximum frequency of about 25kHz. The following diagrams show the timing for positive X motion (to the right direction). The quadrature output can be used for direct stepper motor control if needed.
According the IC datasheet, we can use the internal oscillator, in which case COSC may not be needed. ROSC defines the frame rate: lower values correspond to higher rates.
Connecting the X1 and X2 outputs to an XOR gate, we can double the data rate, though losing directional information.
The sensing disk or other surface must have some texture, pattern, scratches, or a brushed finish to get good results for the optical recognition of its surface patterns.
The construction below was successfully applied to provide synchronized movement on assembly lines, and for transporters, labeling equipment, and printing on moving objects. Over 100 units were made, and all continue to work well after several years.
Other sensor ICs are available which will handle different light sources, outputs, speeds, etc. For instance, the PAN3101 CMOS optical mouse sensor uses SPI, and the PAN101B CMOS optical navigation sensor has both SPI & quadrature outputs.
Example schematics for SPI interface
The sensors with SPI (or USB using one more IC) interfaces don't allow us to track every pulse separately as they send packets of data. For hard real time applications, the sensors with the quadrature output are preferable.
It would be interesting to build an encoder from a wireless computer mouse; and perhaps even more interesting, using the sensor from a digital caliper, as most of them have an I2C interface. But that's another story.
- Adaptive rotary encoder distinguishes fine from coarse
- Rotary encoder mates with digital potentiometer
- Rotary encoder with absolute readout offers high resolution and low cost
- Decode a quadrature encoder in software
- Preprocessor for rotary encoder uses PAL
- Using edge count to decode an encoder