Main Content

An USB keyboard for Media Players using Arduino Leonardo

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.

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

Link to article