Close
0%
0%

The Infinity USB Knob

This is a USB knob that will allow me to execute keyboard shortcuts at each step and get visual feedback

Similar projects worth following
I found very few solutions that would allow me to execute repetitive keyboard actions. It is something that could be useful when working with Lightroom or Photoshop in order to quickly reverse a few actions back and forth to visualize the result.

All commercial items I found are task specific and not very customizable so I decided to build my own.

By using the push button on the rotary encoder I should be able to switch between pre-defined shortcut and get a visual feedback using the Neopixel ring.

I also want to make something accessible to anyone and easy to reproduce.

Current Status

Project completed !

The Knob in action :

The code is here: https://github.com/vincentmakes/InfinityUSBKnob

Hardware

This is the hardware we will use for this project:

A Trinket M0, EC11 rotary knob, a neopixel ring, a nicer knob and an aluminium case from audiophonics.

What I want to achieve

Several mode will be available at each push of the rotary knob, allowing to switch between shortcut possibilities :

ModeActionShortcut (MacOs)LED Colors
1Undo/Redo Lightroom or PhotoshopCmd+Z/Shit+Cmd+ZBlue
2VolumeHID Volume +/-Green
3Close/Reopen tab ChromeCmd+W/Cmd+Shift+TPurple
410s Forward/Backward in VLCCmd+Alt+Left/Cmd+Alt+RightOrange

Connections

The connections are quite straightforward. The A,B,C pin of the encoder are going to the pin 1,2 and 3 of the Trinket. 

Pin 4 is connected to the DI of the ring.

The power consumption is not very high when the brightness is set to 24

The code

Here's what I'm using and the challenges I faced:

Controlling the LED: Just using the Neopixel Library for Arduino. There are two types of animations I want to cover:

1. Turning on LEDs clockwise, turning off LEDs counterclockwise until one LED only is on. Stopping at LED of origin. This is for Undo/Redo actions with finite history.

2. Turning on LEDs clockwise, turning off LEDs countreclockwise but also turning on LEDs further counterclockwise if it passes the LED of origin. This is for volume up/down or any "unlimited" action.

Reading the encoder: the trick is to trigger an action on interrupt to detect when the knob is turned. Therefore the main code will not be in the loop() function but rather in the function called on interrupt.

Sending keyboard commands: I will be using the HID-Project Library. This is important to not use the default Keyboard.h library provided by Arduino because the HID library already includes it. The difference is that some actions are not just keyboard shortcut but requires to interact with the HID. The volume up/down is one of them for example and triggering F11/F12 will not work.

Casing

Anything will work here but I stumble upon this aluminium case that I will re-purpose for the project. I will simply drill holes to mount the knob and be able to see the LEDs.  I have attached a template to mark the holes.

Here's some measurement for the drilling/tapping:

After drilling and tapping

Filling the holes with epoxy

The neopixel ring fits into the casing after machining the inside (see project log, for a poor's man lathe using a drill and a file)

and here it is after jamming everything in there and closing it

neopixel dimensions in inches.png

Neopixel Ring 16 LEDs sourced from Adafruit wiki

Portable Network Graphics (PNG) - 52.11 kB - 02/28/2019 at 08:59

Preview
Download

neopixel_scale.pdf

template for marking holes

Adobe Portable Document Format - 1.50 kB - 02/28/2019 at 08:32

Preview
Download

View all 6 components

  • A poor's man lathe

    vincentmakes03/05/2019 at 07:26 0 comments

    Turns out the wall of the casing is a tad too thick in order to fit the neopixel ring I just received. 

    And I don't have access to a lathe, so I shaved off the 1mm excess with a coarse round file after mounting the casing on a drill. I clamped the portable drill on the bench for that and such filed the inside for 30-40mm.

    I then finished the surface with sandpaper. 

  • First test

    vincentmakes02/28/2019 at 07:58 0 comments

    I put together the components without the casing and wrote some code for testing. Here's a short video that shows how it works with the volume

View all 2 project logs

Enjoy this project?

Share

Discussions

Antonio Tejada wrote 01/15/2023 at 15:42 point

Having just helped someone who failed to get this working: you should redraw the schematic as a real schematic, and make clear what's inside the dfrobot encoder breakout board. Because as drawn, it's wrong. The dfrobot board's idiotically named "A, B, C" terminals aren't the A, B, and C terminals of a bare encoder, and the bare encoder shown in the "schematic" leads one to mistakenly believe a bare encoder wired that way will work. 

Dfrobot's "C" terminal is the active-low pushbutton, not the common terminal of the encoder. 

  Are you sure? yes | no

Tobias wrote 06/06/2020 at 01:57 point

Hi Vincent,

Great project! I'm trying to make a multi knob control, primarily for Photoshop (brush size, zoom etc) so having a look at how you've done yours and hoping to build on it.

Anyway, when I try to compile your code I get an error saying: "'updateEncoder' was not declared in this scope" in the 'call updateEncoder() when any high/low changed seen on Pin A or B' section.

I've commented out the parts relating to the neopixel, but I couldn't see the updateEncoder being defined anywhere that I might have accidentally commented out as well. I can only see the actual function toward the end of the sketch, which I presume counts as a global definition and therefore should be all that's needed?

I'm afraid I'm a bit new to this, sorry haha!

  Are you sure? yes | no

icewalker wrote 07/20/2019 at 07:19 point

Hi Vincent,

It seems the link https://www.ebay.fr/itm/183537308155 is broken or the eBay product ID 183537308155 is invalid, could you please give us the full reference, or if it's not too much to ask the physical dimensions of this enclosure? I would like modeling one in 3D (if not available in plain Aluminum) and having rough starting ideas would greatly help to avoid aspect-ration mistakes.

Very nice project!

  Are you sure? yes | no

vincentmakes wrote 07/23/2019 at 07:25 point

Hi Icewalker ! Of course : the dimension of the cylinder are 55mm height (external), 52mm Diameter (external) and the internal diameter is 48mm. I don't have other references to give, I think this piece is a legacy part of an old audio system and I haven't been able to find it anywhere else. Have fun :-)

  Are you sure? yes | no

icewalker wrote 07/23/2019 at 21:15 point

Merci Vincent, c'est un excellent point de départ, je vais tenter quelques expériences en PLA :)

  Are you sure? yes | no

Harlley Sathler wrote 05/22/2019 at 22:52 point

Tried it with a Pro Micro (mega 32u4) and all I get is ring flashing among the five defined colors. Anyone else tried with a 32u4? Any help? Thank you all! 

  Are you sure? yes | no

vincentmakes wrote 05/23/2019 at 11:33 point

Check the specs of your neopixel ring. I used NEO_GRB+NEO_KHZ800 in the configuration but it can be you have another model with white LEDs as well.

  Are you sure? yes | no

Harlley Sathler wrote 05/23/2019 at 12:08 point

Hi, Vincent! Thanks for your kindly repply. I sure will check my ring, but I think it doesn't have white LEDs. In fact it's a chinese clone as I can't buy the original NeoPixel in my country. I will check and try use different configurations. One more question: the knob should work even if the LED ring doesn't? I asked this because rotating and pressing the encoder did nothing and one thing I noted in your photos is you used a dfrobot encoder module that, based on photos on their site, have some resistors and a capacitor mounted alongside the EC11 encoder. I tried it with just the enconder (without the PCB and the other components).

I'm really sorry to bother you with this. I just loved your project and am trying to replicate it with the components I can purchase here, so thank you very very much for your support.

  Are you sure? yes | no

vincentmakes wrote 05/25/2019 at 16:11 point

Yes the knob should work by itself. I would recommend to comment all lines related to the neopixel in the loop to see how it goes. Also note that when I first tried with an 8 led neopixel, it was numbered clockwise while the 16 was numbered counterclockwise (or vice versa). So you need  to figure out in which direction the leds the leds are supposed to go because it impacts  the animation further down the code

  Are you sure? yes | no

Harlley Sathler wrote 07/10/2019 at 12:54 point

Hi, Vincent! Thank you very much for you help! It finally worked! I replaced the encoder and all works great now! I tweaked your code a bit and added scroll functionality to the yellow mode. Also tweaked the hardware a bit and used a reed switch (along with a magnet) with a free I/O pin to alternate between Mac and PC modes, since PC uses ctrl and Mac uses cmd with the shortcuts. As I could not find a nice case as yours, I used a Chinese tea can, so my magnet is glued on can side and the reed is suspended by a rigid wire inside the can, so to change between PC and Mac modes, all I need to do is turn the lid a bit to move the magnet closer or farther the reed.

  Are you sure? yes | no

vincentmakes wrote 07/11/2019 at 07:59 point

Hi Harlley, glad it works :-) and nice idea with the reed switch !

  Are you sure? yes | no

fabian wrote 03/25/2019 at 16:51 point

Can You show video how easy is playing in tempest game? Better than keyboard or mouse?

https://en.wikipedia.org/wiki/Tempest_(video_game)

  Are you sure? yes | no

Christian W. wrote 03/20/2019 at 03:38 point

Great job!. I like your idea of using epoxy as a light diffuser in the aluminum case. 

  Are you sure? yes | no

Sophi Kravitz wrote 02/27/2019 at 14:00 point

Hi Vincent! This looks like a useful tool, and could be a cool-looking add-on to the already existing keyboard. I'm curious to see how this will work.  

  Are you sure? yes | no

vincentmakes wrote 02/28/2019 at 08:31 point

Thanks Sophi ! 

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates