Quadrature encoder wisdom

[ad_1]

SparkFun rotary encoder

Otherwise called quadrature encoders, they deliver two-bit gray-scale binary on rotation, with the phases of the two square-waves at 90° – hence quadrature.

Being Gray, it is posible to determine which direction the shaft is being rotated by looking at the relative phases of the two outputs.

These come with or without detents – ‘notchy’ tactile feedback.

The potential pit fall is that the detents are either:

one per each full cycle of one of the outputs – ‘full cycle’ – so 24 detents and 24 cycles = 96 transistions

one per grey-count – ‘quarter cycle’ – so 24 detents and 6 cycles = 24 transitions.

There are allegedly also half-cycle types – so 24 detents and 12 cycles = 48 transitions.

Assuming one wants something to happen once per detent, the full cycle type is easiest to count as it is sufficient to check simply check the state of one output each time the other output transistions in one direction – only simple logic or code is needed.

Another advantage of full-cycle types, according to this ecellent blog, is that the detent is at the both-off position when mecanical switching is used, so power consumption (from pull-up or down resistors) is minimised. That said, this SparkFun product does not stop in the 00 position – this is the one in the photo above.

The quarter cycle type requires more complex logic or software to decode every detent – examining the state of the other output on every transition of either output – and 3 out of 4 times at least one pull up resistor will be consuming power.

However, the quarter cycle type has two big advantages – The output transition rate of any given rotation rate is a quarter of the full cycle type – so slower software can cope – and the contact pattern inside the switch is much less complex, increasing reliability and maybe reducing internal wear.

If you miss-match encoder and logic/software, you get four movements per detent click, or only one movement per four detent clicks.

[ad_2]

Source link

Leave a Reply