How Does a Computer Mouse Work?
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
- Buttons — for clicking on things.
- Scroll wheel — for moving up and down a page.
- The sensor — the part that works out movement. This is the interesting one, and it has changed completely over the years.
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.
Step through what happens between moving your hand and the pointer moving.
- An LED shines light down onto the surface under the mouse.
- A tiny camera photographs the lit patch — thousands of times every second.
- The sensor compares each new photo with the one before it, and finds how far the pattern has shifted.
- 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
- Keep the cable where nobody will trip over it, and tuck any slack away.
- Take breaks if you have been using it for a long time — your hand will thank you.
- If the pointer jumps about, turn the mouse over and wipe the little window clean. Dust in front of the camera blurs every photo it takes.