<<<      Rotary Encoders

In a real cockpit not every rotary knob is an encoder. Often it's a mechanical knob geared with instrument card or needle (which itself can have absolute rotary sensors on the other side). Real encoders are used in most of radio equipment displays and autopilot.

Here are the examples of typical controls for which you can use encoders in your cockpit, including instrument card knobs:

For your home cockpit you can use any incremental rotary encoders that can be found on AliExpress or Ebay. No need to buy expensive ones , any cheap encoders ($0.3 ... $1 for a piece) work just fine with SimVimCockpit Interface. There is no difference in work between $0.5 encoder and $25 "brand" encoder in your home cockpit!

Depending on usage in your cockpit it can be just a single encoder or double (coaxial) encoder, or encoder with built-in push-button, so that you can switch modes to control different parameters with a single encoder.

Video - Encoder Demo


Encoders technical data

Rotary encoders have two output terminals (A,B) and one "common C". Each output is cyclically connected to the "common" with 90 degrees out of phase when the shaft is rotated, i.e. the encoder generates quadrature signal (2-bit Gray Code sequence).


The code sequence can be processed by the controller (or hardware circuit) as direction and velocity. Commonly, in relation to the simulator, we need to get the moment of status change and the direction it was changed.


For every 360 degrees of rotation the number of full quadrature cycles ( 00-10-11-01) determines resolution of the encoder. Having 20 full cycles (or 20 PPR), for example, the encoder generates 80 changes of state. I.e. we can register up to 80 parameter changes per full turn using appropriate code for that (resolution = 80 units per rotation). But whether the full resolution could be used or not, depends on such encoder parameter as detents.

Detents and resolution

encoder_wave In detent position the encoder shaft is fixed between rotation steps (switch effect) and eventually this can limit the "fixed" resolution, because within one click of an encoder from 1 to 4 code changes may occur, depending on the number of detents per quadrature cycle - 1, 2 or 4 detents/cycle ( or 1/4, 1/2, 1 cycles or pulses per detent).

If you have an encoder with 1 cycle/detent (or one detent per 4 state changes - see encoder #1 below), and in the code each state change is processed with maximum resolution, we can discover that our controlled parameter increments/decrements for 4 units in one click (e.g. 4 degree course stepping)!

It may be acceptable for such parameters as lighting brightness but unusable for course adjustment. For this type of encoder we need to program it to reading states between detents, for determining direction, but take in account only one change per detent (i.e. the whole cycle). Say, using an encoder with 80 state changes resolution (or 80/4 = 20 PPR), and having 20 detents we can actually control HSI OBS by 20 deg/rev. (not 80).

Type 1 - full cycle per detent

Encoder of this type has one full cycle per detent, it differs in that it is always in the same phase state at each detent and when encoder is rotated by one "step", its outputs phase changes 4 times between two fixed positions.

All detents are in 00 state - Both A and B outputs are in open state.

All detents are in 11 state - Both A and B outputs are in closed state.

All detents are in 10 state (or 01) - A and B outputs are in opposite state.

Type 2 - 1/2 cycle per detent

Encoder of this type has a half cycle per detent, when encoder is rotated by one "step", its outputs change 2 times between two fixed positions.


(detents 10,01) - A and B outputs have an opposite state in one fixed position and inverted state in the next position alternately

(detents 00,11) - Both outputs A and B have a closed state in one fixed position and an open state in the next position alternately

Type 3 - 1/4 cycle per detent

Encoder with detent in each phase position (detents in 00,10,11,01), when encoder is rotated by one "step", its outputs change by one phase state and provide full resolution.

Encoders with 1/4 cycle per detent have full resolution. For example, if an encoder has full 9 cycles per revolution (9 PPR), it can generate 36 state changes, i.e. one per each detent. Some of such encoders may not have detents at all but thus they don't have tactile feedback.

Common pin location on different encoders:

Encoders substitutes


As an option you can use a simplified way to emulate encoders - use two buttons or two-way switch - this will be working the same way as clicking areas of the screen in a virtual cockpit. I've made it for my transponder knobs, using two-way springed micro switches taken from old CD-ROMs.


Another way that could be useful for such instruments as Radio Altimete is using a potentiometer connected to analog input. It lets you properly emulate the real knob, when the arrow is rotating correspondingly with the rotating knob.

© Copyright 2012-2018 - SimVim Design