The Mouse's Tale
Written by Sue Gee   
Thursday, 06 August 2020
Article Index
The Mouse's Tale
The Inner Workings

Mouse balls

There have been a number of different designs for converting movement into a signal that can be transmitted to a computer and for many years the most common and most successful was the ball mouse which used a small ball and a pair of rollers to convert the movement into a signal. As the ball was rolled over the surface it turned the horizontal and vertical rollers, thus converting the motion into separate horizontal and vertical rotations.


Balls and rollers –  the ball mouse uncovered


As the rollers went round they turned a small wheel with slots in it. This was used to generate the digital signal that tells the PC how far the mouse has moved by interrupting the light from a small LED. Each time a slot moves through the beam the result is a pulse.


Rotation to pulses


All this is simple enough but there is a mystery here. How does the PC know which direction the wheel is moving in? The answer is that there are in fact two LED sensor pairs and these are positioned such that they see the slots at slightly different times. As the wheel rotates the electronics in the mouse detects the direction by noticing which pair of LED sensors sees the light first.

The interface

As well as the motion detectors the mouse also has some buttons. These are just standard switches and the main argument is about how many a mouse should have. The standard joke is that a Unix user needs three mouse buttons, a Windows user only two and for a Mac a single button will suffice.

The joke is that the number of buttons is supposed to be related to the IQ of the user! In practice things have moved on beyond these simple comparisons because now we have the "wheely" mouse which has buttons and an additional wheel between the buttons. Historically, the standard interface for a mouse is the PS/2 standard, introduced by IBM as part of its PS/2 (now almost forgotten) range of machines. More modern USB devices are simply upgrades on the basic serial design.

The plug wiring is, for the record:

 2 No connection
 3 GND
 4 +5V
 5 CLK
 6 No connection

Each time the mouse is moved, or the user clicks a button, it sends three bytes of data to the PC. A PS/2 connection works at roughly 1200 baud so that makes it possible for the mouse to send about 40 blocks of data per second.

The problem is that most users want the impossible. They want to be able to point with the mouse accurately – which means big mouse movements should correspond to small screen movements – and they want to point quickly – which means small mouse movements should correspond to large screen movements.

Interestingly it is possible to do the impossible and Apple was the first to work out how. The trick is to vary the sensitivity of the mouse according to how fast it is moved. If you move a mouse slowly then the sensitivity is set to high so that you can position things accurately. If you move a mouse faster then the sensitivity is set low so that the on screen cursor moves a bigger distance. This is the default behaviour in all PC mouse drivers since Windows 3.1 and is still the way the mouse works.

Opto mouse

The ball mouse was simple, cheap and reasonably reliably. It had just one flaw –  a tendency toi get dirty. As you roll the mouse around the desk the ball picks up bits of yuck that wrap around the rollers and eventually stop it working accurately. The yuck makes the rollers slip against the ball and mean that the cursor moves erratically.


You can see the dirt on the rollers that stopped this mouse in its tracks


As a result people have been in search of the dirtless mouse for many years. The first attempt was the fully optical mouse. This used a pair of LEDs and sensors to detect movement over a specially ruled mouse mat. The electronics simply counted the number of flashes reflected back from the mat. This worked well and didn't get dirty but users didn't like the requirement to use a special mouse mat.



A pure optical mouse needs a special mouse mat


Now we come to the most remarkable part of the story and one that really gives you some idea how far we have come since the first mouse.

The most modern design of mouse is a pure optical mouse that doesn't need a ruled mat. It works by essentially taking photos of your desktop and comparing them to derive movement information. It works by recognizing the texture of the surface and working out how far it has moved under the mouse! Every 1/1500th of a second it takes a flash picture of your desktop which is stores in its memory. If the mouse is moved between pictures then this movement will show as differences between the pictures which a digital signal processor chip works out to derive motion vectors giving speed and direction.

This new breed of mouse is reliable, accurate and can work on any surface – with the possible exception of a mirror or a highly polished surface. What is more the response rate is higher than a mechanical or old style optical mouse can manage. All this may well be true but you should pause to think, as you use your new desktop-recognizing mouse, that it now has more computing power in it than the first PCs that the earlier generations of its kind were built to serve!

These days, as a desktop computer user who hasn't upgraded to a touch sensitive screen, you can choose between a corded USB optical mouse or a cordless one, that generally requires a dongle to be plugged into the USB port. Personally I prefer the corded variety so that when I knock it off my desk - usually twice or three times a day, I can use its wire to retreive it by pulling it up by its tail.

Related Articles

Bill English - The Master Behind The Mouse 

Doug Engelbart's Mother of All Demos 50 years On 

Douglas Engelbart - The Man Who Invented The Future 

Doug Engelbart and the mouse (video)

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.


IP Addressing and Routing

Every programmer should understand how the Internet works and this means understanding IP addressing and routing. It's a good time to find out about such things with DOS attacks on the rise and IPv6 t [ ... ]

Advanced Hashing

Hashing is arguably one of the great ideas of computing and it has hidden depths. Extensible hashing and perfect hashing are ideas that are worth exploring.

Other Articles

C book



or email your comment to:



Last Updated ( Saturday, 15 August 2020 )