![]() ![]() That means there are five terminals to hook up: three for the knob part (A, B, and ground), and two for the button part (common and ground). This one also lets you push the knob in and treats it like a button press, so I’ll use that control to toggle “mute” on and off. I picked this one up from Adafruit, but any will do. It just says “louder” or “softer.” If we’re already at maximum volume and it wants us to go louder, we can just ignore it. On a 24‐step knob, if you turn it clockwise ¼ of the way around, it’ll report “six pulses to the right.” So the encoder won’t get confused if the volume gets changed by another means without its involvement. All it knows how to do is report clockwise pulses and counterclockwise pulses. That’s why the rotary encoder suits us so well: it can be turned in either direction as much as you like. Hence the volume knob and its absolute scale got replaced with the relative scale of “volume up” and “volume down” buttons. ![]() When TVs started including remote controls, suddenly volume needed to be changed from two different places. There’s no way to change the volume other than turning that knob. And the position of that knob acts as the single source of truth. Consider your grandparents’ TV again: if you keep turning the volume knob clockwise, it’ll stop turning when it reaches its maximum volume. The feeling of turning the knob on a rotary encoder makes clear that this is a digital operation: there are a certain number of increments on the knob (called steps or pulses), and if you turn it slowly you can feel each one “click” by. Rotary encoders, as the name implies, turn rotation into information, but in a far different way from your ordinary analog knob. They don’t take up much space.īut because we need a knob that speaks digitally, we’ll be using a rotary encoder. They allow for fast, precise adjustments. But knobs are great for physical interfaces! People understand them. Knobs are less ubiquitous in this age because of the whole analog‐to‐digital shift, and because knobs don’t really work well on remotes. For instance, if you’re old enough to want to build an arcade cabinet, you probably remember your grandparents’ TV and how it didn’t have a remote, which meant you had to twist a knob on the set itself to control the volume. The hardware A rotary encoder without a knob. Surprisingly, we’re off the beaten path here - though I’m certainly not the first person to need this, my searching didn’t turn up a canonical “how to put a volume knob on your Pi” guide. Instead I resolved to solve this with my own hardware. The ones that support libretro will allow me to set a universal key binding for controlling volume, but (a) that requires me to learn and remember an obscure button combo, and (b) not all of RetroPie’s emulators support libretro, and the ones that don’t each have a different hotkey for setting volume. The emulators themselves keep their own volume setting. Somewhere in the EmulationStation menu system, perhaps three levels deep, there’s a way to launch a utility that lets you set the system volume. Though I’m quite satisfied with the speakers I got, they don’t have their own volume knob, so if I want to change the volume I need to do it in software. ![]() If you don’t yet know how to solder or splice, you may want to postpone this project until after you learn. Like last time, today we’ll be covering a topic that will be useful to Pi users in general, not just those who’ve built arcade cabinets: how to use a rotary encoder to control your Pi’s system volume. ![]() Fixed a tiny error in the monitor-volume script. ![]()
0 Comments
Leave a Reply. |