BrightKidz Library
Subjects
A mouse works out how far it has moved by photographing the desk A computer mouse seen from above, with its two buttons, its scroll wheel and its cable running off to the left. Beside it are two photographs of the same patch of desk, taken a moment apart. Every speck of grain in the second photograph has shifted by exactly the same amount, and one speck has its earlier place ringed with a small arrow across to where it is now. Measuring that shift is the only thing the mouse ever works out.

How Does a Computer Mouse Work?

About 7 minutes

A mouse has no idea where it is. It cannot see your screen and it does not know which corner of the desk it started in. All it can work out is how far it has moved since a moment ago — and that turns out to be enough.

The Parts

The Old Way: A Rubber Ball

Older mice had a heavy rubber ball underneath. Rolling the mouse rolled the ball, the ball turned two little wheels inside — one for side-to-side, one for forwards-and-back — and the mouse counted how far each wheel turned.

It worked, but the ball picked up dust and grease off the desk and carried it inside. Every few weeks the pointer would start sticking, and you had to open the mouse and scrape the fluff off the rollers.

The Modern Way: A Very Fast Camera

Almost every mouse today has no moving parts underneath at all. Instead it has a light and a tiny camera, and it works by taking photographs of your desk.

How an optical mouse senses movement Four stages, shown one at a time. First an LED under the mouse lights a patch of desk. Then a small camera photographs that patch. Then two photographs taken a moment apart are compared and the pattern is seen to have shifted. Finally the measured shift is sent to the computer and the pointer moves by the same amount. LED 1. A light shines on the desk camera 2. A camera photographs it photo 1 photo 2 3. The pattern has shifted left 4. The pointer moves the same way

Step through what happens between moving your hand and the pointer moving.

  1. An LED shines light down onto the surface under the mouse.
  2. A tiny camera photographs the lit patch — thousands of times every second.
  3. The sensor compares each new photo with the one before it, and finds how far the pattern has shifted.
  4. That shift is sent to the computer as a direction and a distance, and the pointer moves by the same amount.

That comparison in stage 3 is the whole trick. The mouse is not measuring the desk. It is measuring the difference between two pictures of the desk, taken a fraction of a second apart.

Try This

Move your mouse across three different surfaces — a wooden desk, a book cover, and a mousepad. Then find a sheet of plain glass or a very shiny table and try that.

The pointer will misbehave on the shiny one. Now you know why: two photographs of a surface with no pattern on it look identical, so the mouse cannot tell whether it has moved at all.

Looking After It