You’ve probably used a computer mouse for thousands of hours, and yet, have you ever stopped to wonder how it works?
Well, essentially, the modern computer mouse is a merger of seven different technologies and some rather ingenious engineering. So here, we’re going to focus on just one, the image sensor, and find out what exactly happens when you move your mouse around on a mouse pad.
To start with, I’ll be talking about optical mice, which are pretty much the only kind that are still in use today.
Table of Contents
Types of optical mouse.
There are two types of optical mouse – reflective and infrared.
The reflective mouse uses an LED light source and a special coating on the top of the mouse to redirect the light at the surface and make the device more sensitive.
An infrared mouse has an LED that emits infrared light, which is not visible to the human eye. A photodetector senses the light reflected from the surface. The LED on an infrared mouse does not need to be visible; it can be placed under the body of the mouse to make it more ergonomic by lifting the nose of the mouse slightly off the surface.
How it works?
If you hold the mouse slightly above the surface it’s on, you might notice a little red glow, and even if you don’t see that, you can still see that your mouse has a little hole in it like mine does right here. Inside that hole there’s an optical sensor that is essentially just a tiny little camera with an extremely fast frame rate. That is to say, it takes a ton of pictures per second. There’s also a small illuminating light, usually an LED, that illuminates the surface beneath it that the mouse is placed on. This little camera in your mouse constantly takes pictures of the illuminated surface it’s on and then compares that picture to the previous one. By comparing these two images, the computer has all the information it needs to figure out how far your mouse has been pulled along the surface and in what direction. The resolution and frame rate of the camera in your mouse determine how accurate, smooth, and reliable the cursor movement is.

If the mouse took only 100 pictures per second and you moved your mouse really fast, it might have a completely different image than the one it had just before with no overlap. And as a result, it’ll have no way of knowing where the mouse is in relation to where it was beforehand. As a result, it won’t be able to properly replicate that movement onto your screen. Now likewise, if its resolution were too low, let’s say only 50 dots per inch, it might have trouble comparing the features that define the surface that it’s placed on and will get confused. You’ll see here that the mouse has actually moved further than the camera realizes, but because it has such a low resolution, it basically has to make assumptions about how specific that movement actually was. It’s for this reason that in most optical mice, the camera actually has a frame rate of at least 2,000 pictures taken each second. Though some can have as much as 6,000, and they have a resolution of about 1600 pixels per inch and can have as many as 4,000. While 2,000 images per second might seem mind-blowing,
keep in mind that neither your mouse nor computer have to store these images. Once one frame is compared to the previous frame, the previous frame is immediately discarded, so no data storage is needed.
It’s worth noting that the technology in optical mice was actually pioneered by the military for tracking targets from aircraft.

The calculations on how much the mouse has moved and in which direction are all done by very simple processing chips in the mouse itself, and then it sends that information to your CPU. Your computer does the rest of the work from here with that data and translates it into the actions you see on your screen. These calculations in your CPU occur in what’s known as the kernel, which is one of the lowest levels of operating systems in your computer. This handles all the fundamentally important instructions that keep your computer functioning, including being able to receive control inputs such as the mouse.
This is why sometimes when your programs freeze up for a moment, you can still move the mouse just fine. That process is given priority over all else because, without it, you couldn’t even interact with the computer to begin with. While optical mice are the norm today, there was a time when ball mice were the norm.
Now these mice instead of using a small little camera and LED had a rubber ball placed in the middle of them, which rolled around as you pulled the mouse across the surface. And as this ball rolled, it caused these 2 little adjoining wheels to turn as well, which gave your mouse all the data needed about how it was moving on a 2-dimensional x and y plane.
You may also have seen some of the mice that are controlled by actually rolling a big ball around with your fingers. And these mice use the exact same mechanical system, but have the advantage of being able to be used in situations where you didn’t have access to a large flat surface. And that concludes this video. If you’re interested in more videos on the topic, liking and sharing is a good way to let me know that. And feel free to leave a comment with any questions you may have.
Hope you get that How optical mouse work?