Building a Better Rotary Encoder with Inexpensive Microswitches
When you’re designing an interface for your project, it can be tempting to use one of the many cheap rotary encoders on the market for control. If you haven’t used one before, you’re probably envisioning it working like the nifty click wheel that was found on older iPods. Unfortunately, those rotary encoders don’t actually work very well, and are a pain to wire up and program for.
If you want a better—and probably cheaper—way to get that nice clicky feel, Miroslavus has a fantastic tutorial that’ll show you how to build your own rotary control with microswitches. All you’ll need is two lever-style microswitches (which are just pennies whe purchased in bulk), a bearing, and a few small 3D-printed parts. Other than a single M3 screw, everything is just glued together.
The design works by using notches on the underside of the wheel to push an arm in one of two directions. That arm, in turn, pushes against one of the microswitches to trigger a click in that direction. The built-in spring action of the microswitch then forces the wheel past the notch and into a resting position.
Miroslavus doesn’t provide code for the design, but it should be easy to setup on an Arduino or any other microcontroller dev board. Just wire the microswitches as buttons, and program it so that each time it reads high (or low if they’re normally-closed switches) the code registers a single button press. As Miroslavus demonstrates, this method has both a high accuracy, and a nice, satisfying feel.