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.