This project began as an experiment when I inexplicably decided to learn how an optical rotary encoder worked (FYI, 2-bit gray code). It transformed into a learning experience around USB - specifically the HID protocol. Ultimately I ended up with a simple gadget that now sits on my desk and allows me to control the PC volume. A salvaged optical encoder was used to detect rotation along with a reclaimed head drum of a VCR which was repurposed as a control knob.
Key concepts for the project were:
- The optical encoder parts (sensors and disk) were salvaged from an old track-ball.
- The "knob" was made from the head drum of a VCR (remember those?). I liked it because of the smooth bearings - it spins forever. This is the part that spins and is used to adjust volume on my PC.
- The optical disk was fixed to the shaft and optical sensors mounted off some strip-board and attached to the base of the vcr head.
- This assembly is mounted to a custom PCB with some nylon stand-offs. The PCB became the base of the whole unit.
- Some wooden rings were cut to enclose the electronics and the base of the vcr drum.
- The custom PCB was designed in eagle and etched at home from some single-sided copper-clad board. The circuit was designed around an AVR at90usb162. The code is written in C and implements the LUFA library developed by Dean Cameron.
- The whole unit plugs into a PC via USB and is automatically identified as a HID - no drivers required (tested in Debian Linux and Windows). It's a very simple device - rotate clockwise to increase volume, counter-clockwise to decrease.
- Code and PCB design are available via github. Here are some reference links:
- VolCon github repo - for code and eagle design (PCB) - https://github.com/Clewsy/VolCon/
- LUFA (lightweight USB Framework for AVRs) main page - http://www.fourwalledcubicle.com/LUFA.php
Here's the completed device. You can just make out the USB port on the lower right:
An inside view; note the rotary encoder:
This is the underside of the PCB - DIY designed and etched. Just the SMD Atmel chip is soldered on this side: