USB Volume Controller - Potentiometer Based
Intro: USB Volume Controller - Potentiometer Based
In this instructable i will show you how to make simple but effective USB volume controller.
What sets it apart from other such devices is that it is potentiometer based. But what does this mean? That means it has a scale and can be set to, for example, to 50% max volume by rotating it to the middle. As for the encoder based volume controllers, you can only turn them left to decrease volume or right to increase it, which means you never know what volume level are you at.
It also connects to your computer via USB and controls Windows internal sound level. Some other devices connect between the speakers and PC's Jack output. It means that you can have only one device connected and if for some reason your Windows sound level is set to 0 you won't be able to use it.
STEP 1: Parts
Here are all of the parts you will need for this project:
- Arduino Pro Micro,
- 10kΩ potentiometer (like the one in the picture),
- 6mm heatsink - not necessary but I have one left from my Raspberry Pi so why not using it?,
- M3 12mm bolt, washer and self-locking nut,
- some heat-shrink tubing and rubber bands,
- a few bigger nuts - they will add some weight,
- Micro USB cable,
- 3D printed parts.
and various tools (soldering iron, glue, etc.).
STEP 2: Design
The project was designed in Fusion 360 to ensure all parts will fit together nicely. They also don't require support material.
STEP 3: 3D Printing
Now it is time to 3D print necessary components. The .STL files can be downloaded below or from my thingiverse site.
None of the parts require supports, just rotate them in an orientation seen in the picture.
STEP 4: Electronics
Electronic circuit is quite simple. All you need to do is to connect potentiometer to Arduino.
Potentiometer's left and right pins should go to VCC and GND on your board. It's middle pin goes to Arduino analog pin A1.
Firstly solder wires to Arduino pins, than put heat-shrink tubes over them.
Bend them so that they match potentiometer pins order and solder them.
Afterwards heat the tubes to prevent any shortage on solder joints.
Also check out this amazing instructable: https://www.instructables.com/id/Make-Beautiful-Solder-Joints/
STEP 5: Base
Now let's put electronics into it's place.
The first thing is to put one of the bigger nuts to the slot below Arduino board. Secure it with some superglue to prevent any vibrations.
Then use potentiometer's included screw to hold it in place for now and slide arduino in place. It can be secured from the back with one of 3D printed parts. Next put M3 nut from the other side and screw everything together. Don't forget to put a washer below M3 bolt.
Then stick heatsink on top of Arduino microcontroller, be careful because it can't touch any metal parts around main integrated circuit - it may short a circuit. Place a clip on top of it to hold it more firmly - I don't trust this double sided tape!
The next thing will be to put all of big nuts into corresponding slots, glue can be added to them at this point.
When you're happy with it slide the black part on top and screw everything using nut from potentiometer. Also place washer below it and add some superglue so it won't unscrew itself over time.
STEP 6: Knob
Slide in 4 nuts to their slots and fix them in place with some superglue or 2 component epoxy.
Put the knob on the shaft and secure it there with glue. Make sure that it isn't rubbing against the bottom part of the device.
STEP 7: Where Is the Middle?
Determinating the position of the scale (in the bottom piece) and the indicator (in the top cover) is quite simple.
Firstly rotate top half all the way to the left and put on the top cover so that indicators on both parts match but don't push it to the end yet. Then rotate it right and check if the parts match. If not, adjust top cover position. At the end put some superglue underneath the cover and push it to the bottom.
Again, make sure it isn't rubbing against the bottom.
STEP 8: Program
I've made a simple program for the Arduino. It uses HID library to connect to your PC through it's micro USB port.
The only thing you have to download is HID-Project library for arduino. Just open Arduino IDE, select Sketch tab and Include Library > Manage Libraries. Then a window will pop up. Type HID-Project in the search bar and install HID-Project by NicoHood.
Next select Arduino Leonardo board and your port and flash it with the code included in this step.
STEP 9: Done!
Just like that you made nice and reliable usb volume controller!
I encountered some problems with the Windows volume changing but i managed to solve all of them and the final version works very reliable. The addition of steel nuts makes it feel very premium as well :)
I hope you like my Instructable, feel free to leave me a comment!
39 Comments
AtomicCalamari 1 year ago
If you want to know how it works I think I commented it well enough to understand.
prodigyrick 3 years ago
dragme 3 years ago
I would like to know how to set this potentiometer to use it in Lightroom editing to move the fader exposure.
Thank you.
zorigo7575 4 years ago
saadland 4 years ago
I am want to make such volume knob, but I would like it to be wireless, if possible.
Did somebody manage to make it wireless; or though about it.
I am looking for a bluetooth module that can handle HID, to transmit keyboard data, and a battery for it to be owered.
Can somebody recommand some modules please
Thx
ptbuzzcut 5 years ago
Rec'd pot today. Wires are connected to board at A0, gnd and 5V. Center of pot to A0, and left and right to other 2 board pins. Regardless of connection of pots outer pins, not receiving and midi out put. Windows does recognize device as Arduino Leonardo. Sketch (compiled and loaded without error)that I found is:
#include <MIDI.h>
#include <frequencyToNote.h>
#include <MIDIUSB.h>
#include <MIDIUSB_Defs.h>
#include <pitchToFrequency.h>
#include <pitchToNote.h>
MIDI_CREATE_DEFAULT_INSTANCE();
#define expPin A0
int currentVal = 0;
int lastVal = 0;
void setup() {
// put your setup code here, to run once:
MIDI.begin();
}
void loop() {
// put your main code here, to run repeatedly:
currentVal = analogRead(expPin);
currentVal = map(currentVal, 0, 1023, 0, 127);
currentVal = constrain(currentVal, 0, 127);
if(abs(currentVal-lastVal) > 1)
{
MIDI.sendControlChange(1, currentVal, 1);
}
lastVal = currentVal;
delay(5);
}
Is there something else I have to do?( I already have a midi usb expression pedal that is failing. All it has in it is a pot, connected to some kind of pc board with USB connection wires to the board. There is a USB A on the end but that is not used in the setup. Did try to connect to it but got a device error from Windows. The USB cable it sends on is directly soldered to the board. I was trying to replicate this using an Arduino board)
TheSuperSewcio. 5 years ago
ptbuzzcut 5 years ago
ptbuzzcut 5 years ago
ptbuzzcut 5 years ago
TheSuperSewcio. 5 years ago
#define expPin A0
currentVal = analogRead(expPin);
Or shorter:
currentVal = analogRead(0);
The GND should be connected to GND on Arduino board and VCC to 5V pin on Arduino.
ptbuzzcut 5 years ago
"The only thing you have to download is HID-Project library for
arduino. Just open Arduino IDE, select Sketch tab and Include Library
> Manage Libraries. Then a window will pop up. Type HID-Project in the search bar and install HID-Project by NicoHood.
Next select Arduino Leonardo board".
When I open arduino there is a sketch already there. I added the one you supplied and there are two. Am I supposed to paste yours over the existing one or are they to be both run? I went to Sketch, add file and selected yours so there are two. Not sure what to do here or how you 'flash'. Need your help. Thank you
TheSuperSewcio. 5 years ago
ptbuzzcut 5 years ago
Yonatan24 6 years ago
I didn't know you could control the internal volume of the computer, I took apart an old speaker and use its potentiometer/amp to control the volume of my headphones, externally.
But do you actually need to know the volume level you're at, it's either too low, just right, or too loud, the number means nothing. After all so many people, feel uncomfortable when their TV volume isn't at an even number. This conversation on whether that's moral or not should be muted.
Kind of a bummer though that it needs an Arduino though.
ptbuzzcut 5 years ago
TheSuperSewcio. 5 years ago
ptbuzzcut 5 years ago
CharlieR18 6 years ago
Yes, it's actually very useful to a lot of us to know where in its range that volume control is. If you only play music files for entertainment while you do something else, the rest of this doesn't apply.
But for someone who edits video and sound, there are going to be multiple volume settings and it's helpful to know where each of them are set at a glance. For example, levels for each track in the software, overall editing software level and Windows sound system level, plus any external volume controls like on amplifiers for speakers. I'm always annoyed at having to get Windows volume to pop up so I can see where it is set. Everything else I can tell quickly without interrupting my workflow. OK, except my current speakers. I can't see the line on the volume knob because Yamaha placed it on the top and at the back edge so when the desktop speakers are tilted back I'm always grabbing the speaker to turn it over enough to see the volume indicator, cause it matters to me.
Yonatan24 6 years ago
True, I didn't think of that. But unfortunately most of the Youttube videos I watch have the audio levels balanced horribly, AKA low quality mic recording a voice over for a video with loud music, and tablesaws that make me go deaf... A bit of an exaggeration, but I wish everyone was like that!