My PC setup includes a pair of active speakers that don't have a separate volume control. Having to navigate to the windows volume every time to set the volume setting was a bit frustrating so I wanted to come up with an easier solution.

The controller itself is just a rotary encoder that detects the direction of rotation and sends commands to PC accordingly. I also added a play/pause button. The circuit is very simple so if you wan't to add more buttons (e.g forward, backward, stop...) that can be done easily by replicating the circuit concerning the push button in the schematic.

The actual volume controlling is done by a small windows app written in C# that simulates keyboard media key presses.

Step 1: Hardware

The schematic is very simple. More buttons can be added just by replicating the circuit seen in the schematic. I assembled the circuit to a perfboard an installed it in to a small enclosure. I used a 9-core data cable to connect the Arduino and the enclosed encoder. Regarding the encoder the number of steps per revolution is not critical but anything above 10 will do fine.


Rotary encoder (for example one or another )

220 ohm resistor


3x 10k ohm resistors



Knob for the encoder


Arduino (I used a cheap copy of Arduino Nano)

Momentary push button

Step 2: Software and Arduino Code

It is also possible to program the Arduino to be a HID device so that no external app would be needed (more about the topic can be found here). But I chose to use a Windows app because I have intentions to modify the project in the near future.

The controller communicates with PC over the serial bus. I wrote a small C# program that runs in windows in the background and can be accessed from the windows notification area by double clicking. The program saves the previous settings so they don't need to be set every time. I've also set the program to run every time I boot up my operating system (instructions can be found here). I've included the C# files so that the app can be easily modified.

The Arduino code is pretty simple. The controller sends command bytes to the serial bus according to the operation (button push, encoder clockwise or encoder anticlockwise). The windows application receives the bytes and simulates key presses accordingly. I made the code as simple as possible so it'd be easy to modify.

<p>Hello,</p><p>nice work :). I tried to do it but something went wrong. When I push the button it works, but only one time, If I'll push again it doesn't work. I tried to check and change some value on the arduino code, but without success.</p><p>Can you help me?have any suggestion? by the way I tried both apps whit mute and play /pause function, same result,</p><p>thank you</p>
<p>Hi,</p><p>You could try to monitor the serial port from the Arduino IDE to make sure that it sends out the right messages. This way you can pinpoint whether the problem is caused by the program or the Arduino.</p>
Hi,<br>thanks for your answer.<br>So I have tried with serial monitor of Arduino (even without program), first time I push the button I can see on the serial monitor the number 3 (and this is what I expect), but after the first time, the number three don't come out again, only the function &quot;volume UP&quot; and &quot;volume DOWN&quot; still work.<br>I Hope it was clear, sorry for my bad english.<br>thanks
<p>Have realised this project on ATmega8 and USB-UART converter (you can not see converter on the photos)</p>
<p>Very useful! There is no sound buttons on my keyboard, I'm very glad to have found this project! Thank you, pertti56!</p>
<p>Here's a version with mute function.</p>
<p>10x , i will try it</p>
<p>can you post it?I don t have any &quot;skills&quot;in coding</p>
<p>nice project ,can you modify the project instead of play pause to be volume mute? </p>
Sure, with the library used it's easy to use any windows media key function. The Functionality can be changed just by altering one word in the code.
<p>Nice project</p><p>Is it possible to use this as a volume control on windows and control for example game volume, web browser volume and skype volume separately? Is it possible to change the rotary encoder to volume sliders and with the sliders you could control separately game volume, web browser volume and skype volume? How can I change the rotary encoder to sliders and where i have to connect the sliders. Is this even a possible to change rotary encoder to volume sliders?</p>
Or is it possible to add more rotary encoders to control the volumes?
<p>The things you've suggested are indeed possible but there is a major difference when using a potentiometer (a slider) to set the volume. When you use a potentiometer you must sense to position of the slider and map the position to range from 1 to 100. That is very easy. Then the value read from the potentiometer must be set as the value of the system or program volume and that is when it gets complicated. Accessing windows volume information and setting it numerically involves pretty advanced software coding (and at the moment I've still learning to do so...).</p><p> The way my project gets around the problem that it simulates keyboard button presses so I don't have to access the operating system itself. Although if you really wanted to use a slider instead of rotary encoder you could modify the program so that it set's the windows master volume to 0 at startup and then simulates the key presses the number of times that is set with the slider. Although the method described is pretty unorthodox when it comes to software developing... </p>
Thanks for your answers. The product on the link is what I meant. I need to think what should I do because I want to make device which allows me to control windows volumes separately. But it's not necessary for me to have pontentiometers instead rotary encoders. So I could just add more rotary encoders. But the problem is the code because I don't have any idea how to make the code so it allows to change volumes separately. And devices on the shops are too expensive.
<p>I guess this is what you are after: <a href="https://www.kickstarter.com/projects/94625964/mixology-a-volume-mixer-for-gamers" rel="nofollow">https://www.kickstarter.com/projects/94625964/mixo...</a></p><p>Accessing windows mixer and separate volumes includes some more advanced programming. </p>
<p>Nice project ... that could come in handy ...</p><p>Q:<br>Could you create a similar setup (or add to this project) to have just one push switch to shutdown the PC? ...<br><br>Scenario:<br>We have a simple setup where the PC is totally enclosed, except for PC Power, LAN and USB connections ... therefore access to the actual PC is not available and a keyboard or mouse will not be plugged in ... the PC uses a touch screen as an input device and runs custom software (with no access to the Windows GUI) ...</p><p>The PC starts up fine (auto starts when power is applied) but the power off function is non existant at the moment ... and a complete shut off of power (pull the power supply out) is not the way to go ... ;) ...</p><p>Thanks.</p>
<p>Yes it's possible to shutdown the computer programmatically. The command in C# is &quot;System.Diagnostics.Process.Start(&quot;shutdown&quot;, &quot;/s /t 0&quot;);&quot;. </p><p>I've attached a modified version of the program that shuts down the computer when the button is pressed (instead of play/pause).</p>
Very nice project. I would like to make it but I'm a little bit confused. How do I connect it to the PC. Can you explain that? Thanks!
<p>The controller connects to the PC with USB port (and it's used to transfer the serial data) found in the Arduino board or via separate USB to serial converter if your board doesn't have a USB connector. The serial to USB converter that is built in to the most Arduino boards makes the Arduino look like a serial (COM) device to the PC.</p>
Nice project! I did a similar USB volume controller using an Arduino Pro Micro as a HID device. Would love to see what you will do in the future!
<p>Nice :-) I just made a foot switch to turn scanned music notes. I used an Attiny84 and a USB-Serial adapter. I guess for your circuit that would also be enough. Saves a few bucks compared to the Arduino.</p>
<p>Yes that is right. The reason that I used a Atmega328 based Arduino is that this is actually part of a bigger project that needs more IO pins. I'll be covering some of those features in my next instructable. </p>
<p>Ah, cool. Keen to see what's coming up :-)</p>

About This Instructable




More by pertti56:PC Volume and media controller  Motion controlled outlet 
Add instructable to: