85

I just replaced my scroll wheel in my mouse, a one minute repair. But now I've seen something that can't be unseen.

Logitech scroll wheels apparently function using magic.

It freely rests on three buttons that detect left, right, and straight down presses. But the wheel itself is not electrically connected to anything whatsoever. It's plastic resting on a spring.

How does the mouse know when I'm scrolling? And why was it affected by dust and gunk?

Edit: and how does it detect which direction you are scrolling?

enter image description here

Steve Hanov
  • 851
  • 1
  • 6
  • 9
  • I don't know if this is the same for this mouse, but in the past, it was a laser that shines through the wheel, and inside the wheel were sparks (or whatever the word is, it has areas that are open and areas that are closed). If the laser was intercepted it could sense that it was scrolled and in which direction. – LPChip Nov 23 '17 at 21:30
  • 3
    [Look here](http://www.explainthatstuff.com/computermouse.html). Each mouse setup is different, but based on the fact the pic you have posted shows clear mounts on the wheel implies there is an optical encoder at play. – Giacomo1968 Nov 24 '17 at 02:58
  • 6
    This might surprise you, but the old ball-mouse (not the modern laser-mouse) works exactly in the same way, except that it has 2 wheels -- for X and Y directions. If you manage to find and open one, you'll see that the ball is not attached to anything. Here's a pic: https://38.media.tumblr.com/7d0bb30a71fba01f9c191fc48ca457f5/tumblr_inline_mlrx4d0kts1qz4rgp.jpg – dr_ Nov 24 '17 at 13:27
  • 2
    The answers cover the way it's actually done; another possibility would be to use a [Hall effect sensor](https://en.wikipedia.org/wiki/Hall_effect_sensor), which basically counts electrical pulses generated by a magnet in the wheel passing a coil. Those are often used in power tools, car engines and other things that rotate quickly. – David Richerby Nov 25 '17 at 14:25

4 Answers4

104

There's a diode (probably infrared) and a receptor, one on either sides of the wheel, soldered directly into the green PCB. Wheel is SPOKED, and by turning it you interrupt light travelling from the diode to the sensor. No magic there.

Oh, and dust sitting in there can permanently block sensor from any light coming from the diode, so there's no way for it to register interruptions, that's why the wheel appear to not work.

location of light transmitter and receiver, don't know which is which

dreamcatcher
  • 103
  • 3
Kitet
  • 2,047
  • 1
  • 19
  • 23
  • 21
    now you just need to explain how it detects which direction you are scrolling – Sampo Sarrala - codidact.org Nov 24 '17 at 01:17
  • 123
    *Two* receptors, spaced 1.5 spokes apart so that their interruption patterns are 90deg out of phase with each other. The technical term for this is a `quadrature encoder` if you'd like to google it. Combining these two on/off signals gives 4 unique "symbols" that appear in a specific order for one direction and reverse order for the opposite direction. – AaronD Nov 24 '17 at 04:16
  • 1
    I've had more issues with the lubricant getting into the spokes. – ratchet freak Nov 24 '17 at 12:07
  • 10
    If you miss the good old days of cleaning off your mouseballs, cleaning off these spokes when scrolling gets slippy is a good replacement. – Doug Kavendek Nov 24 '17 at 17:12
  • 10
    As stated this answer is incorrect since it specifically states that there are a singular pair of optical components, when in fact as AaronD points out, two are required. The edit to repair it would be simple, but as a *factual* change only Kitet should make it. – Chris Stratton Nov 24 '17 at 19:35
  • 4
    @ChrisStratton That's a pretty minor quibble. A quadrature encoder is undoubtedly sold as a single integrated component. [Example1](http://www.robotshop.com/ca/en/lynxmotion-quadrature-motor-encoder-v2-cable.html), [Example2](http://www.robotshop.com/ca/en/cytron-simple-rotary-encoder-kit.html) – Mike Ounsworth Nov 25 '17 at 19:57
  • 3
    @MikeOunsworth - it might be a single package, but it's not the singular diode and receptor falsely claimed in this posting. There's no evidence that the answer's author even understands that quadrature is involved, and **there is no statement contained here as to how the directions are distinguished**. – Chris Stratton Nov 26 '17 at 04:57
  • Which suggests that Steve didn't need to replace the whole wheel, just blow out the dust. – Isaac Rabinovitch Nov 29 '17 at 22:19
  • any idea if sun exposure can affect the normal scrolling ? – ombk Apr 24 '21 at 16:28
42

To answer your edit and expanding AAronD's excellent comment, the direction is sensed by a microcontroller by the sequence of the codes when the wheel is turned.

For example, the two diodes, when turning the wheel, let's say, counter clockwise will translate to the following sequence:

    A B
    0 0 
    0 1 
    1 1 
    1 0 

For the clockwise direction, the inputs will be shifted in the oposite direction.

An excellent graphic illustration is also available here: http://www.creative-robotics.com/quadrature-intro

Clonkex
  • 1,067
  • 3
  • 13
  • 23
Alex C
  • 521
  • 3
  • 3
7

I did some research and found out that there are many types of scroll wheel types. It is not just Logitech , but almost all mouse manufacturers use this type of scroll wheel.The one here is optical scroll wheel. This uses a light shining onto a photodiode through slits in a metal or glass disc. Reflective versions also exist. This is one of the most common technologies. Optical encoders are very sensitive to dust.

The optical encoder's disc is made of glass or plastic with transparent and opaque areas. A light source and photo detector array reads the optical pattern that results from the disc's position at any one time. The Gray code is often used. This code can be read by a controlling device, such as a microprocessor or micro-controller to determine the angle of the shaft.

The absolute analog type produces a unique dual analog code that can be translated into an absolute angle of the shaft

Vedant
  • 226
  • 1
  • 13
  • Logitec doesn't use a Gray code, it uses simple quadrature modulation. This only gives angular velocity, not position. – Mark Nov 24 '17 at 19:01
  • 2
    @Mark - quadrature *is* a 2-bit gray code, but yes, given that there are only two bits and many cycles around the wheel, you are correct that it gives only an incremental result and not angle as claimed. – Chris Stratton Nov 24 '17 at 19:38
  • @Mark thank you, I will study the matter and upset the answer . Thanks again – Vedant Nov 24 '17 at 19:48
  • Unfortunately, many manufacturers still use mechanical mouse wheels and not optical ones. Sometimes their design is ridiculous - they have optical switches for buttons and advertise long life because optical switches serve longer... and at the same time the mouse has a mechanical scroll wheel that will wear out in a year or two, and you'll have to throw the mouse out anyway, so what's the point of having durable optical switches in a mouse with a mechanical scroll wheel. – JustAMartin Jul 19 '23 at 08:05
0

I faced this problem last week and after opening up the unit and toying around a bit I was able to fully repair it.

The main problem is the slimy liquid that reaps out of the ageing rubber, the scroll wheel is wrapped around with this rubber grip. Scroll wheel with spikes If you see carefully the wheel has spikes that allow the optical sensor unit to kind of see through it and it is due to these variations while rolling the wheel the sensor is able to detect if you are performing a scroll or not. Now the slimy liquid will reap into these spikes and block the sensor's view entirely which will make the firmware unable to detect the scroll action.

The solution is simple just remove the scroll whell and the rubber grip, and clean it with a soap solution, dry it and make sure you are able to see each spike clearly when put against the light source.

And you will find that it will be as good as brand new.

Ish Kool
  • 1
  • 1