For the Professional Maker: MakerPro: Custom computer volume control knob and mute button

By Jeremy S. Cook

Freelance Tech Journalist / Technical Writer, Engineering Consultant

Jeremy Cook Consulting

August 04, 2017

Blog

MakerPro: I found that I had hotkeys on my keyboard that worked for mute and volume control functions, but the ergonomics are lacking.

I recently got a subscription to Spotify to help keep my focus on my work, which can involve reading and understanding technical articles, or often doing the same for YouTube videos. Though I’m generally happy with it, this means that in order to switch from reading comprehension to “video comprehension,” I had to go to the Spotify app, pause the music, then switch back to the video and adjust the volume appropriately.

To my pleasant surprise, I found that I had hotkeys on my keyboard that worked for these functions, but the ergonomics still aren’t great. If I just had a button that I could push for pause/play and a volume knob, that would be really excellent. As it just so happens, rotary control can be accomplished with an encoder, and certain development boards that can act as HMI (human-machine interface) devices. I chose to use the incredibly small Trinket ATtiny85 development board from Adafruit, which I talk about here.

As it just so happens, I am not the first person to think of this type of control setup, and after a brief search, I found that Adafruit actually has code and instructions available for almost exactly what I wanted to do. Their schematic only includes control for volume up/down and mute on the Trinket’s limited three inputs, but I thought I could get around this and add in a song skip button by using a network of resistors similar to what’s outlined here on my buttons, one of which is built into the encoder).

[My original interface plan didn’t quite work out.]

Unfortunately, this didn’t work out as I’d planned, as the two inputs needed for the encoder are active-low, meaning that when the encoder pulses it connects pin 0 and 2, which are normally high via an internal resistor, to ground. Pin 1, which would be used for my button, is active-high, and unfortunately pin 2 is the only one that can read analog, ruling out what I had in mind. The trinket does have two other GPIO pins, however, they are shared with the USB connection, making them off-limits for my purposes. Though I’m sure there is some trick to get around this, for now I had to settle for Adafruit’s version instead of the enhanced controller I’d envisioned.

Regardless of my relative lack of buttons it’s actually pretty useful for controlling my music (though I have to disconnect/connect the USB cable occasionally, perhaps due to my shoddy wiring). Though the electronics ended up being largely copied from those Adafruit instructions, my housing, made out of MDF and 3mm thick acrylic, works really well for the purpose. The highlight of the build (in my humble opinion) is actually the knob that I made for the encoder. It has 20 indents on the outside, nearly equal to the 18 steps per 360 degrees of the encoder, and feels very satisfying when scrolling to select the correct volume.

If I make another version, I think I’m going to use something with more inputs, such as the Arduino Micro. This board is based on the on the ATmega32U4 microcontroller, giving it it built-in USB support. Also, if there is another version, perhaps a stained plywood frame would look nice, along with cleaner wiring inside!

Jeremy S. Cook is a freelance tech journalist and engineering consultant with over 10 years of factory automation experience. An avid maker and experimenter, you can see some of his exploits on the Jeremy Cook’s Projects YouTube Channel.

Jeremy Cook is a freelance tech journalist and engineering consultant with over 10 years of factory automation experience. An avid maker and experimenter, you can follow him on Twitter, or see his electromechanical exploits on the Jeremy S. Cook YouTube Channel!

More from Jeremy

Categories
Processing