As always, friends ask me to support them for the technlogical part in their events, parties and so on. So this Christmas I’m involved in various Christmas pageants: I’ll be responsible to manage the audio part of the event (I don’t like to use the word ‘deejay’). I come from Commodore64 and Arcade coin-ops so I developed an idiosyncrasy for the mouse and I prefer a lot using keys and keyboard shortcuts when is possible… but my laptop is very old and it doesn’t have multimedia buttons. So I thinked to build me an USB multimedia-only-keys keyboard.
I had a spare Olimexino 32U4 (an Arduino Leonardo clone) and some Arcade-Style microswitch pushbuttons: knowing the fact that the Leonardo has a lot of pre-cooked example about keyboard and mouse emulation I don’t think it twice about using those components.
There was some initial difficulties: the Arduino examples don’t cover the multimedia buttons. So I’ve searched on the internet and discovered a project made by NicoHood : this guy realized a library that expands HID capabilities of the ATmega 32U4 chip.
You can simply install the new library from Arduino IDE going in Sketch -> #include library -> Library management and searching for “HID-Project” in the search bar. In the results must be present “HID-Project by Nicohood”:
Click the Install button. This library allow also the usage of HID capabilities from boards that does not use the 32U4 as main chip but only for the serial bridge (Arduino UNO e Arduino Mega): this is possibile reprogramming the bootloader with a new one provided by Nicohood himself: HoodLoader2. Hackaday has already covered some examples of those applications in past years. Using an Arduino Leonardo or a clone of it you don’t need the new bootloader.
Nicohood library allowed me using pushbuttons for functions I needed: play/pause, stop, next song and previous song. Library can also manage the system volume control using 2 methods for Volume up and down so I’ve included also a Rotary Encoder for volume management.
Schematic is very simple: 4 pushbuttons with pull-up resistors and the encoder connected to 2 interrupt-capable pins. I’ve used external pull-up resistors since I had some noise on certain pins: maybe the power from my USB is not so clean and the internal pull-ups failed triggering continuously the inputs. This is the schematic:
Source code is on my Github. In the following pictures you can see how I’ve realized the thingy. Box come from my job: was a kit for chemical analisys of water, labels are made with a Dymo. I made an hole in a box wall in front of USB connector of the board, so the USB cable can pass through it and can be connected to the board directly. Pushbuttons are connected using fast-ons and pull-up resistors are directly soldered on the fast-ons. Cables are soldered directly on the board since the Olimexino 32U4 has the pads doubled for every GPIO.
Player I use is Foobar2000 that become my default player after Winamp departure in 2013, even if was acquired by AOL in recent times and seems that the development of this popular player is slowly restarting.