Embedded Eye

Give your gizmo the gift of sight

Why an optical mouse does not work when you hold it up

I get this question a lot: Why is it that an optical mouse works fine on a desk, but when you lift it up and move it around it does not pick up anything. This question typically gets asked by experimenters trying to make a visual odometer using an optical mouse. A related question is about our smaller sensors- "How far can they see?" The answer is pretty simple to explain using image formation principles in elementary optics. There is a good Wikipedia page on lenses that goes into detail, but I'll touch on the very basics here, which can be explained with one equation.

Referring to the figure above, the focal length "f" of a lens is essentially how far from a lens rays of light converge when incoming light is parallel, e.g. from an infinitely distant object. The convergent point is essentially where an image of the infinitely distant object is formed. If you hold a sheet of white paper at that location, an image of the object will form on the paper. If the object is bright enough, or if you prevent stray light from reaching the paper, you should be able to see the image. An image sensor (or a piece of photographic film for that matter) will detect the image. If you move the image sensor to the left or to the right, the image will get blurry.

Now suppose the object brought a finite distance r1 from the lens. An image of the object will still form, but at a new distance r2 from the lens on the other side. The relationship between r1 and r2 is defined by the equation:

For example, suppose the lens has a focal length of f=10mm. If you are imaging something r1=20mm away, then the equation yields r2=20mm- You'd have to put the image sensor 20mm away from the lens to grab an image of the object. If you are imaging something r1=100mm away, then the equation yields r2=11.1mm. If you are imaging something r1=10m=10,000mm away, then the equation yields r2=10.01mm. Essentially as the distance r1 to the object increases, the value of r2 drops to approach f. The "infinite distance" case first discussed is simply the case when r1=infinity, which yields r2=f.

So how does this relate to the optical mouse? The lens that typically comes with an optical mouse is designed to image the desk, which is just a few millimeters away. This short distance is r1. The lens is similarly placed r2 = just a few millimeters away from the optical mouse chip. So the focal length f of the lens was designed to work with these values of r1 and r2. (Notice how the data sheets that come with an optical mouse chip and lens pair specify how far the lens must be from the desk.) In order for the optical mouse chip to see objects further away, you need to either change f (get a new lens) or move the lens closer to the chip. (For those of you who are trying to make a visual odometer using an off-the-shelf optical mouse sensor, I recommend getting some lenses and lens mounts from Sunex and experimenting with those.)

As for whether our smaller sensors can see objects "far away"- Most of these sensors use a focal length on the order of f = a millimeter or two. So from the perspective of the above equation, this makes 1/f very large. Any object r1 = a few centimeters to infinitely far away will have little impact on the optimal value of r2. Thus objects at all of these distances are for all practical purposes in focus.

Views: 4382

Comment by Randy Mackay on January 6, 2012 at 7:25pm

I used lenoptec to make the lens mounts.  The main guy I talked to was "Oswyn".  I was pretty forgiving about what the final product looked like as long as the spacing of the mounting holes, length and thread spacing was correct.  I think this allowed him to mostly reuse an existing design but I'm not completely sure.

Comment by Arthur Retana on January 11, 2012 at 6:21pm



Thanks for your help this was very informative. I am working on this as part of my senior project but I will not be able to take the project any further because my professor decided where I am at is a good stopping point. However, she is going to continue to pursue this and the plan is to design and print a lens mount at school so hopefully they can get the threading correct. I will let them know about this post that way they may use your insights and take the project one step further. Once again, thank you for all the information.



Comment by Jeff K on April 5, 2014 at 9:48pm

Thanks for this explanation article. I have a question regarding this part:

 In order for the optical mouse chip to see objects further away, you need to either change f (get a new lens) or move the lens closer to the chip.

I may be failing horribly to follow the math (have a history of doing that) but is it possible to have an additional lens placed at about the desktop distance (r1?) under the mouse that would extend the distance that the mouse sensor is focused at by 2-3cm? My goal is slighting extending the range without altering the mouse.

Thanks again.


You need to be a member of Embedded Eye to add comments!

Join Embedded Eye

© 2017   Created by Geoffrey L. Barrows.   Powered by

Badges  |  Report an Issue  |  Terms of Service