Introduction: Multimedia Desktop Controller

No Multimediakeys on your Keyboard?

In this Instructable you will learn how to build your own Controller for Multimedia shortcuts!

Volume controll, play, pause, previous or next; all combined into one little accessory for your Desktop.

Step 1: Parts

  • Arduino Micro
  • Push-button (3x)
  • Rotary Encoder Breakout
  • LED (2x)
  • Resistor 10kΩ (3x)
  • Resistor 220Ω (2x)

Step 2: Making a Plan

For an first overview, design your circuit in Fritzing.

To prevent floating on the input pins add 10kΩ resistors as pulldown to every Push-button. Optionally you could also utilize the Arduinos internal Pullups.

Shown above is the use of a Rotary Encoder Breakoutboard. A Rotary Encoder converts turning motion into digital signals. Pinout from left to right: (GND | + | SW | DT | CLK).

The LEDs can be used to indicate if the system has power (blue) or if commands are sent to the PC (yellow).

Step 3: Preparations to the Arduino IDE

In order to use multimedia commands like volume controll, play, pause, previous or next you need to extend your Arduino IDE.

The Blog by Stefan Jones:

Arduino Leonardo Remote Control (Multimedia Keys) Support for Arduino 1.0.5

gives very detailed instructions how to change your arduino core files.

Since his tutorial only works with the older Arduino IDE versions, download Version 1.0.5.

Arduino - OldSoftwareReleases

Step 4: Arduino - Code

Now that you´ve embedded Stefan Jones´ Code into your IDE, and maybe ran some scripts to test its functionalities, start writing your code.

In my case the volume can be adjusted by turning the Rotary Encoder. Actions like play, pause, previous or next are triggered by the Push-buttons.

In order to understand the working principle of a rotary encoder watch this video by How To Mechatronics:

How Rotary Encoder Works and How To Use It with Arduino

Noticed the repeated 5ms delay in the Examplecode? Its used to prevent bouncing by the Push-buttons.

Examplecode:

#define enc_outA  6
#define enc_outB  7
#define enc_SW    8
#define but_pin_1 10
#define but_pin_2 11
#define but_pin_3 12
#define led_pin   9
boolean enc_stateA;
boolean enc_laststateA;
boolean enc_stateB;
boolean enc_stateSW;
boolean but_state_1;
boolean but_state_2;
boolean but_state_3;
boolean play_pause = HIGH;    // 0:Pause / 1:Play
void setup() {
  pinMode(but_pin_1,INPUT);
  pinMode(but_pin_2,INPUT);
  pinMode(but_pin_3,INPUT);
  pinMode(enc_outA, INPUT);
  pinMode(enc_outB, INPUT);
  pinMode(enc_SW  , INPUT);
  pinMode(led_pin , OUTPUT);
  enc_laststateA = digitalRead(enc_outA);
}
void loop() {
  
//Read pin status
  enc_stateA  = digitalRead(enc_outA);
  enc_stateB  = digitalRead(enc_outB);
  enc_stateSW = digitalRead(enc_SW);
  but_state_1 = digitalRead(but_pin_1);
  but_state_2 = digitalRead(but_pin_2);
  but_state_3 = digitalRead(but_pin_3);
  
//Check for Rotary Encoder
  if(enc_stateA != enc_laststateA)
  {
    
    if (enc_stateB != enc_stateA)
    {
      
      if(enc_stateA == LOW)
      {
        digitalWrite(led_pin,HIGH);
        Remote.increase();
        Remote.clear();
      }
    }
    else
    {
      if(enc_stateA == LOW)
      {
        digitalWrite(led_pin,HIGH);
        Remote.decrease();
        Remote.clear();
      }
    }
    enc_laststateA = enc_stateA;
    delay(5);
    digitalWrite(led_pin,LOW);
  }
  
//Check for Button 1 (Previous Song)
  if (but_state_1 == HIGH)
  {
     digitalWrite(led_pin,HIGH);
     Remote.previous();
     Remote.clear();
     delay(5);
     while(digitalRead(but_pin_1) == HIGH){}
     delay(5); 
     digitalWrite(led_pin,LOW); 
  }
  
//Check for Button 2 (Play/Pause)  
  if (but_state_2 == HIGH)
  { 
     digitalWrite(led_pin,HIGH);   
     if (play_pause == HIGH)
     {
       Remote.play();
       Remote.clear();
       play_pause = LOW;
     }
     else
     {
       Remote.pause();
       Remote.clear();
       play_pause = HIGH;
     }
     delay(5);
     while(digitalRead(but_pin_2) == HIGH){}
     delay(5);  
     digitalWrite(led_pin,LOW);
  }
  
//Check for Button 3 (Next Song)  
  if (but_state_3 == HIGH)
  {
     digitalWrite(led_pin,HIGH);
     Remote.next();
     Remote.clear();
     delay(5);
     while(digitalRead(but_pin_3) == HIGH){}
     delay(5);  
     digitalWrite(led_pin,LOW);
  }
  
//Check for Rotary Encoder Switch (Mute)  
  if (enc_stateSW == LOW)
  {
     digitalWrite(led_pin,HIGH);
     Remote.mute();
     Remote.clear();
     delay(5);
     while(digitalRead(enc_SW) == LOW){}
     delay(5); 
     digitalWrite(led_pin,LOW); 
  }
  
}

Step 5: Planning of the Finished Layout

First of all you should design a 1:1 layout of your components and consider how to route the wires.

Note that in the drawing above the pulldown resistors and connectoins from the Rotary Encoder are located in another Layer.

Step 6: Hardware

Be creative in designing your own box.

In my case I used some plastic sheets, fixed to each other with hotglue, and added some 4mm acrylic glass as top cover with sanded edges for a nice glowing effect.

To make everything accessable some M4 bolts and nuts were located in each corner and the holes in the acrylic glass countersunk.

To give the Microcontroller some stability when the USB-Cable gets connected, a support strut was added.

I used some rubbing alcohol to clean the surface of the glass and then glued all components to it.

To give the whole project a modern look, the wires were routed through midair.

Additionally I lowered some LEDs into the acrylic glass. Their light is broken by the holes and sanded edges.

The knob for the Rotary Encoder was made out of some wooden dowel, which i burned with a lighter to give it some texture.

I hope this Instructable gave you some inspiration in designing you very own Multimedia Controller.

Got any tips or questions? Send me a message!


Multimedia Desktop Controller by Jens_R
Microcontroller Contest

Participated in the
Microcontroller Contest