Wednesday, 13 November 2013

Adafruit Trinket compatible µVolume USB Media Control PCB


Back in August, you may have read my article regarding the AVR based  Attiny2313/ Attiny84/ Attiny85 USB Volume Controls.
The article appears to be pretty popular on various websites, including a nice mention on the Adafruit Blog.

With the release of the Adafruit Trinket (Attiny85 based) a tutorial is now available on the great Adafruit Learning System for a Trinket USB volume control example.

After Purchasing a Trinket to experiment with and Adafruit having a great mentality for Open Source Hardware, I decided to modify my own Attiny85 volume control PCB to make it compatible with the Trinkets 5Volt firmware (flash_me_hv_5volt.hex)! (which is Arduino compatible) This gives access to direct programming without the need for a separate programmer from the Arduino IDE. Its also nice to support the hard work done at Adafruit  by purchasing one of their Trinkets.





PCB Design

The PCB design is not as one sided as I would have liked, but in the essence of speed and compatibility with my existing enclosure design, I quickly modified my Attiny84 PCB layout.



The PCB Eagle Design files can be downloaded here...

If you are not able to compile the needed firmware from the source code yourself, see this forum thread 

AVR Fuse Setting for the Firmware are as follows:

SELFPRGEN = [X]
RSTDISBL = [ ]
DWEN = [ ]
SPIEN = [X]
WDTON = [ ]
EESAVE = [X]
BODLEVEL = 2V7
CKDIV8 = [ ]
CKOUT = [ ]
SUT_CKSEL = PLLCLK_16KCK_14CK_64MS

EXTENDED = 0xFE
HIGH = 0xD5
LOW = 0xF1

Please keep in mind, this does not have to be a volume control, any project that requires the use of a rotary encoder can be incorporated in your code.




Adafruit NeoPixel Ring  (16xWS2812) Individually addressable RGB LEDS.  Only requires 1 pin on the micro
A work in progress at the cost of the Mute pin on the Attiny85)


The assembled PCB although not installed, allows for 3 additional bypass capacitors for de-bouncing of the encoder if needed.



The Rotary encoder can be soldered to the PCB from the bottom side, top side or shaft mounted as shown in the photo.




Large Machined Aluminium Knob 



If you are planing on using  heavy and large aluminium knobs for your projects, it is worth noting that you have to select your rotary encoders with a little more care. Especially, when used in a vertical position. Shaft play and turning torque come into effect.

On the flip side, when using a heavy knob with a low torque encode, the inertia of the knob gives a nice jog effect for rapid output.

Here are my recommendations for a volume control with a nice "Amplifier" feel.

EC11E1830401 /NO SWITCH/ NO DETENT/18PPR/ TORQ 7/24.5MM TOTAL HEIGHT/ £1.40+VAT

EC11E153440D /SWITCHED/ NO DETENT/15PPR/ TORQ 7/24.5MM TOTAL HEIGHT/ £2.40+VAT

EC12E2430803 /SWITCHED/ NO DETENT/24PPR/ TORQ 25/25MM TOTAL HEIGHT £1.00+VAT

If any of the readers have any example sketches using WS2812 LEDS, aka NeoPixels, with a rotary encoder, such as the video, please leave a comment below :)

This would make a great 'Example' sketch for the Trinket or tutorial for the Learning System Adafruit ;)

SmileyNerd128



I have to say that the Trinket isn't the best platform for a volume control but it does show what can be done. For me its all about learning and getting as much code/examples on as many platforms as my knowledge allows.

There are problems with not using an external crystal. A HID Consumer Control Device that is intended to be connected all the time, the USB connection is just not reliable enough. This is common to all Virtual USB projects using PLL/internal oscillator, the timings are crucial.

On my previous AVR based Attiny85 volume knob, it would not work on some computers at all, or reset the Attiny in a loop. Even when working sometimes it would have to be plugged back in after a reboot of the PC.

 After moving to a Attiny2313 with an external crystal then later a Attiny84 to squeeze the board size down (plus I have a few more pins to play versus the 85), all the connections issues disappeared. It has worked on every PC I have tried.

Now if only I could port the Trinket firmware to my Attiny84  µVolume!

To Be Continued....