How does your Mouse work? Explained!!

Hey friends, Happy Wednesday!

Let’s look at how an Optical mouse works this week. I aim to write my newsletter issues in a way one can follow them while traveling on a bus, having a coffee, waiting for food, etc. Let's jump in!

How it works: 15-second answer

A mouse directs infrared light at the mousepad. Light reflects off the mousepad surface, thus capturing this image through a sensor. Ridges and valleys on the mousepad (uneven surface) affect reflection, allowing the sensor to detect the X and Y movement of the mouse just by analyzing consequent images using a microchip. It calculates cursor motion by comparing pixel values of the consequent images. This movement is then translated to on-screen cursor motion.

Answer to the question I posed last week

Last week, I asked about snake-arm robots and if they are the same as arm robots. Yes, basically they are arm robots composed of multiple smaller arms & joints that make it look like a snake.

Shoutout!

Thanks to each and every one of you for reading my newsletters. As promised, I’m showing you what’s inside gadgets through pictures and taking 2 weeks at a time. I have crossed 50+ newsletters and it wouldn’t have been possible without your support. Thanks again, always grateful for your time… :)

Clicking the Mouse buttons

The microswitches marked in red in this figure are what get activated when you click the right and left buttons. Notice the scroll wheel in between them.

PS: I wrote this newsletter using this mouse after taking it apart. It wasn't as difficult as I thought. Yes, it still works :)

Figure 1: Mouse left and right button switches

How does an Optical Mouse work?

  1. The typical red light that you see shining underneath your mouse is basically an infrared light that is directed to a very small section of the mousepad surface at an angle. This light gets reflected from the mousepad surface and goes through a second lens smaller than the size of a water droplet as seen (Figure 2 Top Left) to finally reach an image sensor in the mouse - to capture an image of the surface below the mouse lens. The light hits and reflects from a very small surface area of the mousepad (lens within oval-shaped slot on Figure 2 Top right).

  2. A mousepad looks smooth but has a lot of ridges and valleys (uneven surfaces) that you can’t see with the naked eye as seen (Figure 2 Down). So the infrared light ray that falls at an angle on the valleys depicted in red does not reflect the light, unlike the same infrared light (depicted in green) towards the lens due to the angle with which the light falls.

Figure 2: Infrared falls on the mousepad surface and some falls on the secondary lens (Top Left); The two lenses where light shines and reflects back (Top Right oval shape); Light ray reflection on an uneven mousepad surface (Down)

3. Now these reflected images are detected by the image sensor several thousand times every second. A microchip constantly keeps analyzing the two images taken at a gap of ~60 microseconds to see how much the mouse has moved in X and Y directions.

4. Notice the following gif Figure 3. The two images are basically pixels with data on how dark or illuminated the region under the mouse is. The algorithm in the microchip finds out how much the second image must be moved in the X-axis and Y-axis to match the key pixel values in the first image. Thus by doing this, we can find the difference between X and Y the mouse actually moved in the real world. Now this change is translated to a motion in the cursor on the screen through USB or Bluetooth. This is how the motions of a mouse are translated to the motion of the cursor.

Figure 3: Visual representation of two images collected by the mouse sensor being correlated by the microchip to find the shift in X and Y direction by the mouse. Source: Branch Education

How does the scroll wheel of the mouse work?

Figure 4: Scroll wheel with spokes in them for LED light to go through from one side (Left); Optical sensor with two detectors to catch the light from the other side of the wheel (Right)

  1. The scroll wheel of the mouse has multiple spokes as you can see in Figure 4 (Left). There are many methods to detect the amount of rotation of the scroll wheel. The most popular one is using optical methods.

  2. Basically, infrared LED light is targeted through the spokes of the scroll wheel from one side and an optical sensor as seen in Figure 4 (Right) collects the light on the other side. This optical sensor has two sections (right and left) where the light can fall. Based on the direction of the rotation of the scroll wheel, the different sections of the detector detect the light first. Thus we can find the direction of the rotation of the wheel.

  3. The number of pulses of light that the detector detects in a second determines the angular rotation of the wheel. As we rotate the wheel faster, the spokes cut the LED light going through it and allow it to fall on the optical sensor on the other side faster. Thus we know how much the scroll wheel is rotated and this information is then translated to the screen.

Question of the week

Why do you think a mouse doesn’t work when the table surface is super smooth? Reply to this email with your thoughts, and we’ll have a discussion.
Hint: It has to do with the images collected by the sensor and their pixel values.

Learn the how, what, when, and why of this Newsletter

Refer just one friend using your unique link below to read how I work behind the scenes along with my time and finance management techniques. It’s a fun PDF with cool pictures and a ton of in-depth information right from the pen I use to the tools.

Thank you for reading!

Have an amazing rest of the week, and take care!
Until next Wednesday,
Chendur

Previous
Previous

How do Touch screens work?

Next
Next

How do Arm Robots work?