Got a desktop with a sound system far from where you sit?--I do. After a bit of digging, I found that it was pretty easy to make my own soft volume control knob on the cheap.

In this tutorial I will show you how to create a USB volume control knob for your PC!

To keep things simple, Instead of Arduino, I will use an arduino compatible board called the Digispark. Not only is the Digispark small, but it is cheap! Normally I pick mine up from aliexpress.com for less than $2 USD

Lets get started!

Step 1: What You Will Need...

What you will be needing:

Micro USB cable

Micro USB DIgispark (can't be full sized version)

Rotary encoder (also cheap on aliexpress)

Not needed (but nice to have): Some sort of enclosure and knob

Arduino IDE and digispark environment.

Step 2: Time to Get Everything Set Up.

I won't teach you how to use the Arduino Development Environment, there are plenty of tutorials for that on the web already. If you are not familiar with the Digispark, setup information can be found here: https://digistump.com/wiki/digispark/tutorials/con...

Once set up, go to: https://learn.adafruit.com/trinket-usb-volume-knob... and download the Library that we will be needing for this project. Extract the .zip file and place the "Adafruit-Trinket-USB-master" folder into C:\Users\ \Documents\Arduino\libraries

Then copy and paste the sketch found on the same webpage into the Arduino IDE and upload it to your digispark.


The reason that we can do this so easily is because Adafruit has a product called the Trinket that uses the ATtiny85 chip (they have developed this simple-to-use library to work with their trinket) but the DigiSpark also uses the ATtiny85 chip!--So we can very easily use the cheap digispark to run the code and save some money!

Anyway, download the library and go to step 3!

Step 3: The Wiring

Next we can start on the hardware. I shall now demonstrate my artistic skill by drawing a simple schematic for you...

Anyway, as you can see it is very simple and that is all there is to it!

Step 4: The Build!

This is optional and depends on how you want the finished product to look (unless, of course, you just want it to sit on protoboard when you're done)

What I did was cut a small hole into a pill bottle and stick the rotary encoder though it, then I hot-glued the digispark inside the lid (remember to cut a small hole in the side of the lid for the micro USB port to connect to your computer)

Lastly I glued a piece of rubber mat to the bottom--that completes the base!

For the lid, I took the knob from an old broken stereo receiver and plopped that on top!


I also filled it with wax and iron pellets to give it a heavy quality feel, but you can watch the video to learn more about that in step 5.

Step 5: Finished!

That is it!

This video may or may not be useful to you, but check it out!

If you have any problems getting it to work, contact me here on Instructables or leave a comment on the youtube video!

Also, if you find that the rotation is reversed, try changing the following lines at the top of the sketch from:

#define PIN_ENCODER_A 0

#define PIN_ENCODER_B 2


#define PIN_ENCODER_A 2

#define PIN_ENCODER_B 0

Remember to check out some of my other instructables!

<p>I was directed here from this Thingiverse page ( <a href="https://www.thingiverse.com/thing:2329074" rel="nofollow">https://www.thingiverse.com/thing:2329074 </a> ) and it has this page linked so I am going to favourite this instructable and use this comment as a link to myself if I want to get back to that page. The 3D model looks quite good so if anyone else wants a case for this Instructables project, this one should suffice but I'm sure there are many other good ones online or even some Instructables of how to make one or something. This comment isn't advertising or anything just a note to self, ignore it if you want. I can't wait to get the parts specified in this Instructable so I can try it out so thanks to Kris S for these instructions. :)</p>
<p>Thank you!</p>
<p>Hi, great instructable! On the Arduino Software I get </p><p>'Invalid library found in </p><p>C:\Users\Harry\Documents\Arduino\libraries\Adafruit-Trinket-USB-master: C:\Users\Harry\Documents\Arduino\libraries\Adafruit-Trinket-USB-master'</p><p>Was wondering if you could shed any light on this or let me know what I'm doing wrong. Thanks.</p>
<div><div><div>I made it. Just what i whant and need .Thank u </div></div></div>
<p>How did You connect and program button to use click to mute volume ?</p>
<p>Not sure if its the coding or the my hardware, but having the digispark wired exactly like adafruit's diagram. I still cannot get the click button to do anything.</p><p>Any ideas?</p>
<p>Instead of volume, can you make it control a media player?</p><p>Only keys I want are:<br>-Left arrow key: when rotated counter clockwise<br>-Right arrow key: when rotated clockwise<br>-Spacebar: when pressed</p>
Yeah that'd be pretty easy. But I believe you'd need to use an arduino leonardo, (or pro micro)<br><br>All you need to do is use an encoder library, and map the rotations to a virtual keyboard emulated by the leonardo.<br><br> I haven't done it, so this is just speculation on my part. <br><br>Let me know if you are interested in trying it.
<p>Ah damn I already ordered the same parts as your guide assuming it was just a change in the coding.</p><p>What's your thought on the size of the leonardo or pro micro though? I was hoping for something similar to the size of the digispark so that it can actually be placed inside a knob.</p>
<p>Just did a quick search and it seems that it is possible to use the digispark to emulate a keyboard. </p><p>Check this link: <a href="https://digistump.com/board/index.php?topic=20.0" rel="nofollow">https://digistump.com/board/index.php?topic=20.0</a></p><p>Let me know if it is useful. </p><p>Also: https://www.google.com/webhp?sourceid=chrome-insta...</p>
<p>Awesome, will keep you updated on how it turns out.</p><p>Also I can't seem to get to that google link, sorry.</p>
<p>Really nice instructable. Thanks &quot;Kris S&quot;. And &quot;OrC2&quot; for the great idea. I have added a reset switch coz i too had to unplug/replug it every time i restarted my PC.</p>
<p>Always amazed at what I see people do. That's pretty freakin awesome, man! </p>
<p>Really useful and work pretty well!!</p>
<p>Wow that's a really cool design! Isn't the round hole on the bottom of the thick lego the right size to fit onto the encoder where the knob goes?</p>
Hi This is a LEGO 61485 Its fit perfect with potentiometers, encoders and many more, this hole is bigger than the normal stud hole, I have a bounch of than they are very usefull and you don't need damange the piece because they fit just right
<p>This is a really useful project that I am keen to try out myself but I am not sure about the wiring connections between the digispark and rotary encoder.As shown in the figure I have a KY-040 encoder that has 5 pinouts.I have connected CLK to P0, DT to P1 and GND to GND but it does not work.Do help if possible.Thanks!</p>
<p>Use the pins on the encoder itself to determine how to connect it. The side with 2 pins is the switch--The side with 3 pins is the encoder. For the encoder, wire it just as in the crude diagram that I have in the instructable. </p><p>All you need to do is trace the connection on the encoder itself to the connection on the board you have that the encoder is attached to.</p>
<p>Is there any chance that you could tell me more about how to wire this thing up?</p><p>I have everything set up, but I am very new to eletricals and I am not sure how it work</p><p>Do you have to solder the wires to the board? What was the green tray looking item that was present in the video? how do you connect the rotary encoder to the board?</p><p>Thanks, its a great project!</p>
<p>If you have this kind of encoder then you can connect it using the figure attached</p>
<p>Just use the photo in part 3 to wire it. Yes, you must solder the connections--Unless you use a prototyping breadboard.</p>
<p>Thanks! </p><p>I had a problem with the Adurnio Development Environment, because it said that there was an error compiling for digispark (default 16.5 MHZ)</p><p>Any thoughts?</p>
<p>Two questions:</p><p>What board do you have selected in the Tools&gt;Boards Menu?</p><p>What programmer do you have selected in the Tools&gt;Programmer Menu? </p>
<p>The board that I am using is: Digispark (Default - 16.5mhz) </p><p>The programmer is AVRISP mkII, but I have also tried USBtinyISP</p><p>Thanks for any help!</p>
<p>Hmm. And have you followed the tutorial that I posted within this instructible? </p>
<p>too the best of my ability! this is my first time, so i followed it to the letter! </p>
<p>I'm not sure what to tell you. I havent used the digispark in a long time, so I can't rememebr how I troubleshooted it. Your best option would be to watch some videos on youtube to figure out how to upload to it.</p><p>Here is a good one: https://www.youtube.com/watch?v=O1aLLBAChq4</p>
<p>in online i am getting 5 pin encoder does it will support</p>
<p>There should be 3 pins for the encoder, and two pins for a push button for mute--Totaling 5 pins :)</p>
<p>Nice guide easy to follow thanks! &lt;3</p>
<p>Wow! that is genius! I will do it like that too!</p>
<p>Cool beans!<br>I have a keyes rotary encoder module,.. And i tried using the inbuilt switch to see if i could use it to add the mute the way they do at adafruit.. But it just caused problems,.. Ill have to investigate further.. otherwise without the mute it works great. </p>
<p>Hmm, I didn't mention it in the tutorial, but mine uses mute as well and I have no problems.</p><p>Did you tie the button to 5v? the encoder is tied to ground, but the code is set up so that the button is actually tied to 5v to work.</p>
<p>If I understand correctly, tie to Pin 1 and the 5volt pin for mute?</p>
<p>I believe so, yes. There should be clues within the code as well.</p>
<p>Hi Chirs, can you upload the schematic of your complete design and the code as well? I tried doing what was said in the trinket's page, try tieing pin 1 to VCC (through a 10k) resistor but the mute key is not registered. Also I'm confused about the direction: if you tie pin 1 to VCC, when pushing pin 1 then it would have 0V, then doesn't that mean pin 1 is Active-LOW? If that's the case then the code won't work, because it's designed to work with PIN 1 being active-HIGH. Well I supposed that should be the case, doing this check (notice the checking if it's LOW logic) (if (!bit_is_set(TRINKET_PINx, PIN_ENCODER_SWITCH))) instead, but it still doesn't work. I'm not sure if there's something missing. </p><p>Btw in your video the mute button works as expected, but your instructable doesn't contain any mention to that. Would you like to update for a more complete version? Thanks</p>
<p>I made it. thanks for your patience Kris S. </p>
<p>I realized the project isnt done until I show the HTPC (home theatre pc) I built with the usb knob (right side of the picture) ... many thanks to Kris S. for the help. Now all I have to do is add some remote control feature and 2 liner OLED plus finishing paints.. :)</p>
<p>Thats awesome dude! You turned the project into something very iunteresting. </p>
<p>Awesome! XD how did you get it to work?</p>
<p>hi does this work with &quot;infinite turn knob&quot; (does not have any start and end point) as well?</p>
<p>Since it uses a rotary encoder instead of a potentiometer, it can turn endlessly. :)</p><p>Does that answer your question?</p>
<p>sorry, I realized instructables dont send notification for any responses. I JUST received my digispark from China and I have an infinite knob (pioneer XWZ 4286). Just like my initial question, I am not sure if the same code will work with my encoder since it is not a potentiometer. </p>
What I used is not a potentiometer. a potentiometer will not work for this project. <br><br>does the encoder you have use 3 pins?
<p>yes it does have 3 pins... I dont think mine is a potentiometer... it doesnt act as a variable resistor when I tested it with an ohm meter. it does however act like an endless on off switch whenever I rotate the knob in any direction. it also turns the main LED of the digispark on and off when I turn the knob.<br><br>also I noticed that it heats up a lot (blistering hot) when the encoder is plugged in to the digispark.. </p>
<p>There should be one common point and two switching pins. connect ground from the digispark to the common point (generally center pin) then connect the I/O pins to the switching pins.Sorry, I don't know anything about that encoder--I recommend you buy a new one; they are pretty cheap.</p>
<p>Since it uses a rotary encoder instead of a potentiometer, it can turn endlessly. :)</p><p>Does that answer your question?</p>
<p>Thanks a lot.<br>I made it a while ago following your instructions and is turned out great. I use it all the time.<br>I used different materials like hard wood and aluminium to make it stand out on my desk. All done on the lathe.<br>I included some pictures.</p>
<p>Holy crap dude, I just looked closer at those images... Thats freaking awesome! Keep up the great work! </p>

About This Instructable



More by Kris S:Make Life Easier... Arduino Thermostat for Window AC Unit (On the cheap) Turn NES Cartridge into USB Phone Charger!  
Add instructable to: