PC Volume and Media Controller

10,879

239

20

Introduction: PC Volume and Media Controller

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.

Parts:

Rotary encoder (for example one or another )

220 ohm resistor

LED

3x 10k ohm resistors

Wire

Enclosure

Knob for the encoder

Perfboard

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.

3 People Made This Project!

Recommendations

  • Metalworking Contest

    Metalworking Contest
  • Water Contest

    Water Contest
  • Creative Misuse Contest

    Creative Misuse Contest

20 Discussions

Could you please give the circuit diagram in case that i want to add 2 more buttons ex. Next/Previous? Thanks.

Great job my friend, what would be the difference in making a subwoofer volume controller for and underdash mount in my car? (Forgive my ignorance) ;)

0
None
EnzoE2

1 year ago

Hello,

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.

Can you help me?have any suggestion? by the way I tried both apps whit mute and play /pause function, same result,

thank you

2 replies

Hi,

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.

Hi,
thanks for your answer.
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 "volume UP" and "volume DOWN" still work.
I Hope it was clear, sorry for my bad english.
thanks

0
None
cherk

1 year ago

Very useful! There is no sound buttons on my keyboard, I'm very glad to have found this project! Thank you, pertti56!

can you post it?I don t have any "skills"in coding

nice project ,can you modify the project instead of play pause to be volume mute?

1 reply

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.

Nice project

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?

4 replies

Or is it possible to add more rotary encoders to control the volumes?

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...).

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

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.

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!

1 reply

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.

0
None
TheBal

2 years ago

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!

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.

2 replies

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.

Ah, cool. Keen to see what's coming up :-)