# How does the rotary control button of Forgotten Worlds/Lost Worlds encode rotation?

How does the rotary control button of Forgotten Worlds/Lost Worlds encode motion? How does it create a binary signal for game software to know how far and which direction to rotate the player's game character?

Here is a video showing the rotary control button: https://www.youtube.com/watch?v=0V9eNfil_dwt&t=5m45s

• The man in the video disassembles the machine seconds later and mentions ‘there’s the optic [sensor] here’. So I’d assume it works on the same principle as an opto-mechanical mouse. I can’t see the whole mechanism clearly, but I did notice a familiar-looking wheel with holes in the video. So it’s most likely that. Commented Feb 19, 2021 at 7:29

As @user3840170 said, it looks like the mechanism is similar to the wheel mechanism in a mouse, which would make it a type of rotary encoder... basically a bigger, more robust version of the infinitely-rotatable volume and/or tuning knobs in modern car radios or the rotary encoders you can buy on eBay to use with an Arduino.

(Though that'd have been my first guess as soon as someone said "a knob that you can spin infinitely in either direction"... especially when you can also press it as a button.)

They come in both absolute or relative versions, with the relative versions having two output pins and only telling you direction and distance.

For example, if the controller sees the pins go through this sequence of states...

Pin A Pin B
0 1
1 1
1 0
0 0
0 1

...then it knows it's turning in one direction and, if it sees that sequence in reverse, it knows it's turning in the opposite direction.

Here's a public domain GIF from Wikimedia Commons which visualizes how that works:

It's called quadrature encoding and it's basically a quantized version of having two sine curves, 90° out of phase. You can tell which direction it's turning by looking at which pin takes the lead in the "rise1, rise2, fall1, fall2" pattern.

Here's another public domain diagram from Wikimedia Commons which helps to visualize that better:

The number of times it sees the pattern repeat tells it how far the knob has turned.

In the ones I've taken apart, it's accomplished by having a spoked wheel or a disc with black printed stripes and two light sensors. The sensors are then positioned so the spoke/stripe passes over one sensor just before the other, producing that "rise1, rise2, fall1, fall2" pattern.

That said, bear in mind that those steps don't correspond to the physical detents you feel when you turn a stepped rotary encoder. Rotary encoders can be smooth-turning or stepped. It's just a spring popping into the gaps in a toothed or divoted surface to add some feel to the motion for your benefit and the encoder will emit however many steps per detent its designers felt were necessary to get a good read of its output.

• I think volume controls are typically potentiometers, though. (Not to mention ‘optical mouse’ typically refers to the kind in which the optical sensor faces the surface directly.) Commented Feb 19, 2021 at 9:09
• @user3840170 All the volume knobs I've seen in cars in the last decade have been rotary encoders so the manufacturer can add features like having the knob do double-duty or having the volume reset to within a certain safe range on startup without a motor to physically move the knob. I'll admit that I used "optical mouse" to mean "modern mouse" (because I can't speak for earlier mechanisms), so I'll adjust that. Commented Feb 19, 2021 at 9:29
• @user3840170 Pretty much all the signal processing in modern radios is digital, not analog, so if they used analog potentiometers (which are big and fragile compared with encoders) they would need analog-to-digital converters for each pot to make any use of them. Commented Feb 19, 2021 at 11:04