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

  • 4
    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. – user3840170 Feb 19 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:

Rotary encoder animation

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:

Rotary encoder output diagram

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.) – user3840170 Feb 19 at 9:09
  • 4
    @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. – ssokolow Feb 19 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. – alephzero Feb 19 at 11:04
  • $4.50 from Adafruit – another-dave Feb 19 at 13:18
  • 4
    Easy test for whether you're dealing with a 'positional' device like a potentiometer or rotary switch, or a 'counting' device like a rotary encoder: if you rotate the dial with the equipment powered off, does the setting actually change? – another-dave Feb 19 at 13:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.