Quadrature Encoder Rotary Knob with Detent

In order to create a segment map for a salvaged LCD unit, I soldered a rotary knob into my Arduino circuit so I could interactively select which segment to activate. It came from this particular Amazon multipack listing (*) which was the lowest bidder that day. This knob reports rotary motion via quadrature encoding, and it has a mechanical detent for tactile position feedback. (Twenty detents per revolution of the knob, or 360/20 = 18 degrees per detent.) It also responds to push like a button. The segment map project was my first unit from the multipack, and it seems to function properly. Even better, it doesn’t “feel cheap” in its tactile sensation, so I’m happy with this particular multipack. And because it was so inexpensive, I decided to take one apart and look inside.

The entire assembly is held together by folded sheet metal. Bending its four fingers aside allowed me to separate the device into individual subcomponents. The pushbutton mechanism is at the bottom, a very simple construction where the two pins connected to two sheets of slightly separated metal. There’s a slight convex curve to the metal acting as spring. Pushing on the knob pushes these two sheets together. Overcoming the convex curvature gives us the tactile “click” of the button press and gives us electrical conductivity between those two sheets. Usage: tie one of these two pins to ground and connect the other pin to the microcontroller input pin with either internal pull-up or external pull-up resistor so it normally reads high. When knob is pressed, the pin will be shorted to ground so it reads low.

The next layer up is the quadrature encoder to report rotary motion. There are two sets of thin metal fingers that stay in a fixed position, making contact with alternatively conductive/non-conductive portions of a wheel that turns with the knob. Here is an illustration of the electrical conductivity between these fingers and their interface pins:

The center of these three pins connect to both sides. Each of the other two connect to their side of the wheel. Usage: connect the center pin to ground. Connect the other two pins as quadrature A and B signals to microcontroller with internal pull-up or external pull-up resistors.

Above the wheel is the detent mechanism. For this particular device, there is a detent every four quadrature transitions. When it is stopped at a detent neither of the two side pins are connected to ground. (high/high) When turning from one detent to the next, it will quickly cycle through the other three states (high/low + low/low + low/high. Or the reverse order low/high + low/low + high/low if spin the opposite direction) before stopping at high/high again on the next detent.

These quick transitions meant polling would not be fast enough to read this encoder. We require hardware interrupt support to ensure we don’t miss steps. As I did for the Toyota faceplate investigation, I used Paul Stoffregen’s Encoder Arduino library. This time running on ESP8266 Arduino Core instead of ATmega328, it reliably read knob transitions using ESP8266 interrupts.

(Note: at the time of this writing, the latest public release is v1.4.2 which has problems running on an ESP8266. I had to clone the repository directly to pick up at least this fix among others.)

(*) Disclosure: As an Amazon Associate I earn from qualifying purchases

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s