Add Physical Volume Control and 16 Macro Keys to Your PC for Cheap!
by CHWTT in Circuits > Arduino
3983 Views, 70 Favorites, 0 Comments
Add Physical Volume Control and 16 Macro Keys to Your PC for Cheap!
Hello there and welcome to my Instructable! In this Instructable, I will show you how to build an inexpensive device that will allow you to add physical, per-app volume controls to your PC alongside 16 fully programable macro keys. This device is designed to be compact, super easy to build, and most of all, cheap, as I've done similar projects to this in the past, but they've all been prohibitively expensive for many people.
Supplies
Electronic Parts:
Since for the potentiometers I point to a Mouser link, I will point to Mouser for most of the rest of the components as well, as it'll be easiest to get the necessary components for cheap from an actual components dealer like them. Plus, might as well purchase as much as you can through them if you're going to have to pay the shipping fee anyway.
4x Bourns PTA6043-2015DPB103 Slide Potentiometers
16x 1N4148 Diode
16x Keyboard Switches (Feel free to pick your favorite kind, I used Gateron Blacks)
1x Male micro-USB to Female USB-C Cable
Mechanical Parts:
11x M3x4 (or M3x6) Socket Head Screws
Enclosure/Keycaps:
16x Keycaps - These can be 3D printed using a model like the one available here, or they can be purchased if you want a nicer feel. They can also be made/bought in multiple colors, for the sake of color-coding your macro buttons.
4x Fader Caps - These can be 3D printed. The STL file is provided below, and for the sake of providing proper credits, the file I provide is a modified version of the original model by Sijmen Janssen which you can find here.
3D Printed Enclosure Parts - The STL files for the two parts are provided below. These parts can be 3D printed out of practically any material, and if you don't have a 3D printer, feel free to check out the 3D printing service that PCBWay (my YouTube sponsor) offers.
Custom PCB:
This build relies on a custom PCB to be the base for all of the components to be soldered to. Here is a link to a PCBWay shared project where you can download and order the Gerber files for the boards. If you choose to buy the boards using the button to do so on this page, I will get a small kickback from your purchase that will help the channel out a lot.
Watch the YouTube Video!
As always, the first step in this project is to watch the YouTube video on it (assuming you aren't coming here from the YouTube video). This video will give you a good idea of what you're in for if you choose to pursue this project, and it should also show you what this project will be like to use and work with after the build process is done. So, I highly recommend watching it first!
Desolder the ICSP Header
The Arduino Micro comes with the 6-pin ICSP header soldered to the top of it if you order the version that comes with headers (which strangely is usually cheaper than the version without). So, the first step will be desoldering the 6-pin header from the board, because if we don't do this, it will hit the case when installed and stuff won't fit.
This can be done by adding solder to the area and moving the big blob of solder around until all 6 joints are molten at the same time, at which point you can pull the header out. I'm also realizing this just as I write this Instructable, but using some flush cutters and cutting the 6 pins off right at the plastic base of the header will also likely get you enough clearance if desoldering the header turns out to be difficult.
Trim Potentiometer Shafts
Now, we need to trim the potentiometer shafts because they're a little too tall. Don't use a hacksaw or rotary tool for this, as you'll likely damage the wiper assembly of the potentiometer and you also risk getting metal dust stuck inside its track. Instead, use some large pliers or cutters to chop the tops of the shafts. The distance between the top of the notch in the shaft and the new end of the shaft should be about 5mm. This needs to be done for all four potentiometers.
Solder the Parts to the PCB
Now it's time to do arguably the largest part of the build, which is soldering everything to the PCB. This is a really simple step, honestly, and the only thing to pay attention to is the order in which you solder things on to the board. Here's the order I recommend:
- Arduino Micro (note that this goes on the back and the orientation for the USB port is marked on the board)
- Slide potentiometers
- Capacitors
- Diodes
- Keyboard Switches
If you go in this order, it should work out pretty easily. A couple of notes to guide you as you begin, don't socket the Arduino using female headers, as that will make it too tall to fit in the case. It has to be soldered directly to the PCB. Then, the capacitors need to be folded down after they're soldered into place, so they won't hit the lid.
Insert USB Cable Into Enclosure
Next, take the micro-USB male to USB-C female cable and feed it through the hole in the back panel of the main enclosure piece. Once the cable's USB-C end is tightly fitted in the rear of the chassis, use some hot glue to secure it so that it can't be pulled out when unplugging a USB-C cable from it.
Mount PCB Into the Enclosure
Now you can mount the PCB into the main enclosure. First, plug the micro-USB end of the cable into the Arduino Micro, and tuck the excess length up inside the chassis so that it rests under the circuit board. Then, use all 11 of the M3x4 (or M3x6) screws to mount the PCB to the chassis. I strongly recommend using all 11 screws for maximum stability. If you're looking for the screw holes and not finding all of them, there are 5 screw holes in an X pattern placed in between the keyboard switches.
Mount the Lid
Use the four M3x8 screws to mount the top lid over the enclosure. Ensure that the lid isn't interfering with anything on the board that needs to be adjusted so that everything clears.
Press the Keycaps and Fader Caps On
This is the final step for the hardware! Mount the fader caps by pressing them onto the faders and then mount the keycaps by pressing them onto the switches.
It's Software Time!
This next section is going to revolve around the software for this little box. There are two main parts to this: The code in the Arduino IDE for the macro button functions, and the Deej setup for the per-app volume controls. Let's get into it!
Arduino Code and Programming Macros
The Arduino code for this project is attached to this step. Download the code, ensure that the HID-Project library is installed on your Arduino IDE, and then upload the code to the Arduino in the project after connecting the USB-C cable to it.
This will put the default code onto the Arduino. This code is ready for integration with Deej, but has no macros programmed for any of the keys except key 16 (bottom right). This has a demo macro programmed in it, which when executed when your cursor is in a blank notepad document, will type in the doc, save the doc to the default filepath, and then open a new doc and continue typing. Do note that this macro (for some reason) doesn't work well in the Windows 11 notepad, so use the classic Windows notepad for this.
To program your new macros, scroll to the bottom of the code and look for the commented tutorial on how to do this. I'm not going to repeat what was said in those comments here so as not to be redundant, so read the comments in the code for info on what to do. Once you program your macros, reupload the code to send the updated code to the Arduino, and test them out!
Downloads
Deej Download
Head over to the GitHub Page for Deej. Here, you can follow the directions to download the latest release of Deej.
Once you've got your Deej.exe and config.yaml file in a folder together, we can move on to the next setup steps for Deej.
Deej Setup
Open the config.yaml file for Deej. I've screenshotted the default file and color coded some sections, here's what to do in each section:
Red - Delete what's in here
Yellow - Swap "master", "chrome.exe", and "spotify.exe" with the programs you want to adjust. Note that slider 0 will be the leftmost fader and slider 3 will be the rightmost
Green - Set the COM port of your Arduino. You can find this in the Arduino IDE when you go to upload the code and have to select the board and port
Blue - This device works fine with the "low" setting instead of "default".
You're Done!
That's it! You're done! You should have functional per-app volume control now, as well as 16 programmable macro keys for your computer in a compact, easy to build package. If you built one of these, please share an "I Made It!" because I'd love to see it!