This project was initially inspired by the Microsoft Surface Dial, but has evolved towards supplementing a dial for multimedia purposes. Sometime Youtube video or new video game default volume setting is set too high. In Windows, the access to the volume control on the menu bar can takes seconds. It would be nice to have a physical interface that is accessible at all time.
The theme of this project is try to make use of recycled materials or old forgotten parts as much as possible. There is a bit of physical construction by hand while trying for a more polished look.
The idea is to map the media keys functions into the very few controls for a rotary encoder in an intuitive manner. The LED provides visual clue to the operating mode of the device while doubling clicking is used to switch between them. I keep the LED subtle and to not distract from the media I am watching.
I have considered a few options, but I am going to be using old Microchip/Atmel ATMega8 using firmware only USB implementation V-USB. I have some of the leftover parts before I went with ARM and others.
The dial acts as a USB HID, so there are operating system level device driver support in place. The dial communicates with the PC using HID reports. The USB standard defines device Usage Tables that describes the formatting of the data packets for the device that the operating system use for parsing.
There are additional plug-in/key mapper for media players which are outside of the scope of this project.
Volume control falls under HID Consumer page (0x0C) in HID Usage Tables (.pdf)
The rest of the functions are under transport controls:
Note: OOC = On/Off Control, OSC = One Shot Control, RTC = ReTrigger Control (auto repeat)
The hardest part of this project is coming up with a HID report table. There are different ways for implementing this, and also a lot more ways of not working. I modified the HID report table from Microchip forum: HID USB keyboard with MultiMedia key Play / Pause function using HID Descriptor Tool from USB.org
This usage table uses a 7-bit bitmap to represent the commands that are mapped in the dial. A different style of table could be used to transmit the commands as 16-bit usage ID which is more for a larger set of commands such as IR receiver.
The current code size is:
Program Memory Usage : 2340 bytes 28.6 % Full
Data Memory Usage : 68 bytes 6.6 % Full
Even with the 2kB for the USBasp bootloader, there are still 3.5kB of code space left for additional features. e.g. NEC IR Remote Protocol to HID Consumer Control
The GPIO assignments are done with future expansion in mind. The SPI, 2-wire, serial, timers 1-2, ADC, and analog comparator are available.
The hardware is released under CC BY-4.0 and firmware under GPL 3.0.
HID Usage Tables (.pdf) - USB org
HID Descriptor Tool - create, edit and validate HID Report Descriptors
Microchip forum: HID USB keyboard with MultiMedia key Play / Pause function