Rotary Encoder Detent Types

Setting the correct encoder type in the plugin

Just assigning encoders in the configurator is not enough to get them working correctly

You should use the plugin menu to set the correct type and other options for every connected encoder, testing how it works right away. After connection with the board is established, open the "Input Options" menu in the plugin and rotate the connected (and configured!) encoder.

Options for this encoder will appear. Select the correct encoder type (if you know it) and click "Save/Reconnect". The selected type and acceleration will now be saved in the plugin for this encoder (based on the board pin number).

Selectable options:



How Encoders Work, detent types

Rotary encoder has two output terminals (A,B) and one "common" C. Each output is cyclically connecting to the "common" terminal when the shaft is rotated, and the encoder generates a shifted sequence of On/Off signals on its two outputs.

b58img

This 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 state change and its direction.

The number of phase changes in 360 degrees of rotation can vary for different encoders. For example, having 20 full phase cycles per rotation, or 20 PPR, the program can detect 80 state changes ( 80 combinations of "On" to "Off" states on A and B outputs).


Usually the encoder shaft has several fixed positions (switch effect) in full 360-deg range, that define the "touch-feel resolution" for you when you rotate the knob. An encoder may have 8,12,16...20,24,32 detents, and a smaller detent number may give you more sensory control when entering parameters which need fine step-by-step change. On the other hand, large number of small steps (or even complete absence of detents) is mostly usable in consumer electronic as volume regulator, etc.

Encoder types by detents position

An encoder phase state in detent position is defined by encoder construction that may have one of the main 3 types, described below.

On the program side, within one physical "click" 1 to 4 phase changes may occur, depending on the detent type. The program should be able to detect all the phase changes between detents to determine the direction correctly, making only one step per detent to avoid excessive value change or step skipping.

Type 1 - full cycle per detent (very good for SimVim)

Encoder of this type has one full cycle per detent (4 phase changes), 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 what allows the program to reliably detect an encoder direction and speed.

encoder_wave
1) All detents are in 00 state - Both A and B outputs are in the same open state.

encoder_wave
2) All detents are in 11 state - Both A and B outputs are in the same closed state.

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



Type 2 - 1/2 cycle per detent (good for SimVim)

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.

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

encoder_wave
2) - 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 ( good only for one-step mode )

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.

encoder_wave 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 these encoders may not have detents at all, but they don't have tactile feedback because of it.

Not quite usable for "accelerated" input, can be used for one-step data entry.


Common ("C") pin location on some encoders, examples


Notes about breakout boards with encoder

Often you can find and buy some sort of breakout board with encoder soldered in it, but it only increases the price for you. If you have bought such board, and you are going to connect it as you have read somewhere about its connection, don't do that, don't connect it to 5V! The marking (+Vcc, GND, SW, DT and CLK) on this encoder board has no practical meaning in relation to SimVim connections. All you need is only encoder itself.

Just desolder the encoder and throw away the PCB, use encoder as we described. Or, you can make changes as on the picture below:

ioio

Note: All encoders I have (a lot of encoders of different types) are cheap and any of them can be perfectly used with SimVimX firmware, Here are some examples:

- LINK1 - $0.25 / piece, no button
- LINK2 - (about $0.5/pc, with button)
INPUTS
KEY MATRIX INPUTS
Key Matrix Board Pre-set Matrix
Support the project by subscribing to our Patreon

dwn dwn
1-5