Skip to main content
Topic: USB Volume Knob (Read 8725 times) previous topic - next topic

USB Volume Knob

After having been inspired by this Instructable [1] I also wanted to make a nice looking volume knob to attach to my computer.

It uses the TrinketHidCombo library [2], but on a Digispark board, to have one more I/O pin which I use to drive a WS2812 LED ring.  The code to bit bang the LEDs was taken from one of Josh's excellent articles on WS2812 LEDs [3].  I also experimented with other WS2812 libraries (NeoPixel, light_ws2812, FastLED), but they consumed either quite a lot of flash, or prevented the USB part from functioning.

Curiously the fuse setting of my purchased board were set to use the NRES pin as reset instead of an additional I/O line, so I installed the ArduinoISP example on a spare Arduino UNO to set the fuse bits to the correct values:
[tt:]C:arduino-1.6.5-r2hardwaretoolsavrbinavrdude -C C:arduino-1.6.5-r2hardwaretoolsavretcavrdude.conf -v -p attiny85 -c stk500v1 -P COM7 -b 19200 -U lfuse:w:0xf1:m -U hfuse:w:0x5f:m -U efuse:w:0xfe:m[/tt:]

I also like the Micronucleus bootloader [4] approach taken by the Digispark, which I replaced by the micronucleus-1.11-entry-jumper-pb0-upgrade.hex which gets rid of the 5 second delay when plugging the device in, but requires pressing the button when connecting to the computer to enter bootloader mode.  (This requires that the push button of the rotary encoder is connected to PB0.)

[1] http://www.instructables.com/id/Digispa ... e-Control/
[2] https://github.com/adafruit/Adafruit-Tr ... etHidCombo
[3] http://wp.josh.com/2014/05/13/ws2812-ne ... know-them/
[4] https://github.com/micronucleus/micronucleus/tree/v1.11

As an enclosure I found a small cream tin made from plastic:

[attachment=5]
I dremeled away part of the PCB to get its USB micro connector closer to the outside.:

[attachment=4]
Hot glue holds everything together:

[attachment=3]
The LED ring

[attachment=2]
neatly fits inside the enclosure and is also held in place by a bit of hot glue:

[attachment=1]
To give the moving part of the knob a more solid feeling, I added some big washers inside it:

[attachment=0]

Re: USB Volume Knob

Reply #1
After everything was soldered together

[attachment=5]
I also wanted the base of the knob to be more heavy.  I experimented with some kind of self made mold

[attachment=4]
but the results turned out to be less than optimal

[attachment=3]
[attachment=2]
So I settled on some lead from a shot gun round, which the kind guy from a local hunting equipment store sold me by opening the round for me :)

[attachment=1]
Pouring a lot of super glue on top of it fixes everything in place.

[attachment=0]

Re: USB Volume Knob

Reply #2
Due to the added weight in the base and well as in the rotating part, turning the knob feels very solid and satisfying ;)

[attachment=2]
[attachment=1]
The firmware (attached below) smoothly cycles the LEDs through all colors in about one minute.  On activation (turning the knob to change the volume, pressing it to mute/unmute the sound), the volume knob briefly flashes brightly white and fades back to the current color.  Temporal dithering is done to prevent intensity steps being visible, especially at lower intensity values.

A short video can be seen here: https://www.youtube.com/watch?v=r7PtrN89fg4

And as always, have fun!
Markus