External Lens for optical mouse

I’ve seen various suggestions on the web to use an optical mouse as a position sensor. What a great idea: it’s non-contact, so it won’t wear out from use. And it’s pretty accurate(?). And it uses a serial (but synchronous) interface that outputs delta x and y values as 7 or 8 bit values.

And they’re relatively cheap.

One big problem is that optical mice are not designed for the speeds at which FIRST robots move. They work by correlating subsequent snapshots from a very low-res imager (18x18). If the mouse moves so fast that two snapshots are of completely different (non-overlapping) areas, then correlation won’t work.

Yesterday I did an experiment with my computer’s opitcal mouse. I took an old 35mm camera lens and held the mouse behind it so that the lens focused an image on the bottom of the mouse. It was tricky to find the right spot, but when I did, I could point it at a lamp across the room and, as I tilted and panned the lens, the mouse cursor moved very nicely, just like using a mouse pad. Except that the effective mouse position was moving feet, not inches! I had optically reduced the sensitivity of the mouse.

This is very intriguing. One obvious application would be to aim it down at the carpet and track x/y robot motion. Perhaps it could even be used aimed horizontally (at the stands or whatever, focused at infinity?) to measure yaw.

Potential snags: mice work well when there is some “acceleration” or other non-linearity applied. If this is applied by the driver after the mouse sends linear delta x/y values, then no problem. But if this happens inside the mouse, it could be a problem. I think some mice are different than others; I think some can be configured over their bidirectional serial line.

Another snag is that PS/2 mice use a synchronous interface, not async like standard “serial” ports. I’ve heard that the TTL port on the PIC can be used for sync operation, but who knows how??

Here’s the claim that the PIC TTL port can support sync interface:


I have no idea if this is useful or relevant, but Laser Technology is beginning to dominate over Optical Mice.

That’s exactly why our teams have been looking into this technology for the past 2 years. Great minds do indeed think alike! :slight_smile:

Maximum speed of the correlator is about 14 inches per second, if memory serves. Now if that were feet per second, we could just drag the mouse behind the robot to get x-y info.

Very interesting light experiment. We always tried to lens both the light and imager, never tried just pointing it at a lamp. Didn’t have much success with our tests - the image on the correlator must have to be pretty bright for it to work.

Note the mouse could be used as a linear (or 2-d) position feedback sensor.

The PS2 mouse protocol specifies commands to reduce effective resolution, and disable acceleration (scale) functions. Every mouse is different, but some basic commands must be the same for compatibility reasons.

Well, the TTL serial port can do sync serial, but the mouse protocol is more of a master/slave protocol, so our teams found it necessary to use another PIC processor to handle the communcations. See the attached image with a stand-alone board that accumulates and displays the mouse counts on a LCD display. I can post more info if there is some interest in developing the mouse as a robot sensor.

mousedecode (6).jpg

mousedecode (6).jpg

Apparently there are more great minds. Check out this thread, which was recently started as a place for people to share ideas on the subject:


Hmmm…what a great idea. What a great “re-use” of existing proven technology. This is a great example of how good engineering is done. (generally, always on the backs of people who came before them…not always “reinventing the wheel”)