USB Volume Controller - Potentiometer Based




About: DIY projects, CNC, 3D Printing and Arduino

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:

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!



    • IoT Challenge

      IoT Challenge
    • Party Challenge

      Party Challenge
    • Arduino Contest 2019

      Arduino Contest 2019

    34 Discussions


    4 months ago

    I started my first Arduino experience following your tutorial. Then I realized it was a volume controller for Windows. However, I used part of what you have and found a sketch that is supposed to output midi data. Using an Arduino mini, 10K linear pot and the mini usb port on the board. The program uploaded without error. Windows is seeing as Arduino leonardo, as does the virtual organ software. However, neither my software or MidiOx is seeing any midi data. This is the setup:
    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>
    #define expPin A0
    int currentVal = 0;
    int lastVal = 0;
    void setup() {
    // put your setup code here, to run once:
    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;

    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)

    2 replies

    Reply 4 months ago

    Sorry but i can't help with that, i've never used this library. The code looks OK for me and the connections should be ok as well. Maybe try to find some examples using this specific library, it might help


    4 months ago

    Is this now a closed post? Still need help with the code as I am not getting any output.


    4 months ago

    I am following this tutorial as it explains the process simply. However, I am using a different board to make a midi/potentiometer/usb expression pedal. I found code for it and it uploaded. I tested against the software and it sees the Arduino device. However, now I do not know what pins to connect the pot to and which I can remove- I am not finding VCC. The board is Arduino mini. With the board positioned so that the usb is on the left, with the pins facing down, the top row of pins are 12~, 11~,10~,9,8,7,6,5,4,3,2 GND,RS,TX,TX,SS,MO. The bottom is 13~,3V,A0,A1,A2,A3,A4,A5,unmarked, unmarked, 5V,GND,VI,MI,SCK. the sketch has "currentVal = analogRead(expPin) f and #define expPin A0. I am guessing it is using AO instead of what you have in your instructions (A0). As in the pins listed, there are 2 GND and no VC.

    1 reply

    Reply 4 months ago

    You can do:
    #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.


    Question 4 months ago on Step 9

    I am new to this. I have gotten as far as this:
    "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

    2 answers

    Answer 4 months ago

    What you want to do is either delete the existing sketch or just open my code as a new file (if i remember correctly it is just File -> Open). Then flash the Arduino with my program with the arrow key on the top


    1 year 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.

    10 replies

    Reply 4 months ago

    THANKS. BTW- the Arduino I have has long pins from each of the 'contacts/pins'. In all the videos I have watched, I do not see them on others boards. Do they get cut off?


    Reply 1 year 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.


    Reply 1 year 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!

    Dangerously ExplosiveYonatan24

    Reply 9 months ago

    This is why I use the "Normalize Volume" feature of my video editor, it does all the balancing for me, and then I can still go back through and use ducking to make the music quieter while I talk or demonstrate the noise made by something, or whatever. Note that I use iMovie '11 because my "cr@p" 2007 MacBook doesn't support anything else, and my other computers are too slow to run video editors. And if it had that feature 7 years ago I'm fairly sure modern editors should too.

    Yonatan24Dangerously Explosive

    Reply 9 months ago

    I edit my videos on my phone so I don't have that option unfortunately...

    But I think the issue might be that tool many woodworkers and makers have already gone partially deaf from their loud power tools, and don't even hear the volume spikes! Just listen to Walter Sorrells intro! Jack Houweling! Jimmy Diresta!



    Reply 1 year ago

    For some reason it is just better for me to have min and max sound level defined and not only + and - volume.

    Thanks for your comment!