Testing a Rotary Encoder module controlling an LED 8x8 display
Here’s a quick video of the circuit in action:
This project is similar, but uses a rotary encoder “module” that includes switch functionality. The module I am using is this one from seller on aliexpress. The module has built-in 10kΩ pull-up resistors on the signal lines, and external connections as follows:
|CLK||Trigger rotational read on falling edge|
|DT(DAT)||When CLK triggered, DT pulled low for counter-clockwise, DT pulled high for clockwise|
|SW||Switch output - pulls the output low when pressed|
|+||Upper supply rail (5V)|
Note the CLK/DT nomenclature is just a simplification of the underlying workings of the rotary encoder. These pins are actually just the regular two quadrature output phases of the encoder. Treating one as a clock and the other as the direction indicator is a workable analogy though.
This sketch uses the rotary encoder to control the position of a single enabled LED on an 8x8 LED display. This makes the accuracy of encoder input quite obvious, as it is very easy to single-step the LED position backwards and forwards.
The rotary encoder module includes a switch (press on the encoder shaft). This is hooked up to clear/reset the display.