DIY USB Media Dial

Recently few Media Dial project popped out to my Facebook feed.

It seems pretty cool project to built, but I couldn’t fabricate the files needed in their instructions.
Moreover, they used some expansive microcontrollers and the total build was way above $5.

I decided to challenge myself and build a cheap version which I could print in my 3D printer and the
total cost would be around $5.

The Components

These are the main components I used:

Name Quantity Price (USD)
Digispark Clone 1 1.5

WS2812 Ring (with 16 leds)

1 2.79

Rotary encoder

1 1.72

The microcontroller I choose is the ATtiny85. With few tweaks it fits perfectly with me needs.
I bought a Digispark clone board. It is very small and has a micro usb connector which connects to pins PB3 and PB4 of the ATtiny .
This board is able to emulate HID device with the Digispark libraries.

The LED ring is not a must, but it can add some nice effects when I turn the dial or press the button.
The WS2812 is an addressable led, so we only need 1 gpio from the ATtiny to control all the 16 leds.
Digispark provides a version of the Adafruit Nexopixel library to the Digispark boards.

The encoder is the obvious choice for detecting the direction of the wheel and also to counts steps.
It also has a button and I can add more features with a button click or double clicks.

Modifying the Digispark

To use the Digispark board from the areduino IDE, I needed to add it with it’s libraries to the Arduino board manager.
Here is a quick guide from their website:
https://digistump.com/wiki/digispark/tutorials/connecting

TL;DRBoard Manager URL:    http://digistump.com/package_digistump_index.json

I also need to make few tweaks to the board as I mentions earlier:

  •  Change the fuses so PB5 won’t reset the board (this is the default state). I need all the IO of the ATtiny85
  • Remove the LED from the board (it will interfere with the reset of the components)

To change the fuse, I used USBASP V2.0 I had laying around.
This is how I connected the IO to the USBASP:

PB0 – MOSI
PB1 – MISO
PB2 – SCK
PB5 – RESET
VCC to 5V, and of course the grounds.

Then I used ‘avrdude’ to check if everything is connected and responding, and the current
fuse settings with the command: (the path might be different in other systems)

C:\Program Files (x86)\Arduino\hardware\tools\avr\bin>avrdude.exe -C "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf" -c usbasp -p attiny85 -n

I got this respond:

avrdude.exe: warning: cannot set sck period. please check for usbasp firmware update.
avrdude.exe: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.03s

avrdude.exe: Device signature = 0x1e930b (probably t85)

avrdude.exe: safemode: Fuses OK (E:FE, H:DD, L:E1)

avrdude.exe done.  Thank you.

Everything is good.

I entered the fuse values in this calculator:  http://www.engbedded.com/fusecalc/
and checked the ‘RSTDISBL’ (external reset disabled) to get the new fuse values.

Only the HIGH fuse changed, so I only change it with this command: (hfuse – HIGH, w – WRITE, 0x5F – Fuse Value, m Program )

C:\Program Files (x86)\Arduino\hardware\tools\avr\bin>avrdude.exe -C "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf" -c usbasp -p attiny85  -U hfuse:w:0x5F:m

and this is the respond:

avrdude.exe: warning: cannot set sck period. please check for usbasp firmware update.
avrdude.exe: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.03s

avrdude.exe: Device signature = 0x1e930b (probably t85)
avrdude.exe: reading input file "0x5F"
avrdude.exe: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.02s

avrdude.exe: 1 bytes of hfuse written
avrdude.exe: verifying hfuse memory against 0x5F:
avrdude.exe: load data hfuse data from input file 0x5F:
avrdude.exe: input file 0x5F contains 1 bytes
avrdude.exe: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.01s

avrdude.exe: verifying ...
avrdude.exe: 1 bytes of hfuse verified

avrdude.exe: safemode: Fuses OK (E:FE, H:5F, L:E1)

avrdude.exe done.  Thank you.

Perfect.

Now for the LED, I just remove the resistor connected to PB1.
It’s the small resistor between the ATtiny85 and the voltage regulator.

Designing and Printing

The design I made (using Fusion 360) contains 3 main parts:

  • The bottom part where the Digispark sits
  • The center part where the Encoder and the led ring sits
  • The top part that will be turned to control the dial.
    • The top part is made from 3 pieces, because I wanted to have
      a transparent ring for viewing the leds.

I printed all the parts in a black PLA, and the top transparent ring in a clear PLA.
After few hours in my 3D printer (I used the CR-10 Mini), this is what came up:

Assembling

First I assembled the top part. I inserted the transparent ring to the top part body (and added few drops of glue),
and then did the same thing with the center part.

Then I solders 3 wires to the led ring where is says  V+, IN and G,
and I passed them through the holes in the middle parts.

I also solders wires to all the encoders legs and fixed it to the center part as well.

Now I solders the wires to the Digispark board as the following scheme:

I used the ATtiny internal pullups for the encoder A and B, and also for the button so no external pullups resistors are needed.

Now I connected the Digispark board to the bottom part with two 3mm M3 screws, and connected the middle part to the bottom part with two long M3 screw.

At the bottom part, I room for 8mm anti-slip stickers, but it’s not a must.

Code

I used the Digispark library for the HID emulation of keyboard (or mouse, I used only keyboard) and the Adafruit library for the Neopixels to control the leds.
I wrote one function that handles the encoder (check for changes), and one function that handles the button pressings.
Those functions are called constantly (polling, no interrupts here) and if there is a change – it calls one of the assigned operation functions.
There is function for button click, double click, scrolling the wheel ‘Down’ or ‘Up’.

This is a very fast draft I made, but it’s easy to continue of change it from here.

Every encoder change will turn the next led in the ring (or the previews, depend on the direction) with Blue color.
One click on the button will turn 4 leds to Green, and double click to Red.

The first use I came up for this Media Dial is for Lightroom.
Rotating the dial with increase of decrease the slider values.
One button click will cycle through the next panel slider, and double click will cycle through the previous.

You can see the final result here:

You can find the STL for the 3D files and the source code in my gitlab repository:

https://gitlab.com/itaysp/Media-Dial

8 thoughts on “DIY USB Media Dial”

  1. Great project, got all the stuff together but missing 1 STL (3d) file for printing and thats the middle section were the neopixel is mounted. It’s not present on your Github dir.
    Is it posible to mail me the stl or better to update your github dit 🙂

    thanks in advance!

    regards,
    Eef

        1. sorry, but still missing the part were the neopixel is mounted. In the picture it’s the right most part :-).
          The part you just added is the top inner part of the knob.
          Grtx,
          Eef

  2. Hi,
    loved your project. I always wanted to add a few light effect on some of my gadgets and had no clue how to get the ‘Amazon Echo’ types light effect. So please confirm that if i use a neopixel ring along with a top cover made of transparent PLA material, i should be able to get the same ‘continuity’ light effect? Your expert comments on this will be highly appreciated.
    Thanks
    abhinavfunda@gmail.com

    1. Hey,
      you should be able to to that.
      if will need to figure out the distance between the neopixels and the pla that gives you the best results of smooth light and not a hard spot of light.
      You can also cut semi transparent acrylic sheet (i did that at the clock project)
      https://www.youtube.com/watch?v=vkq0RFj5_Ug

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.