Knobber USB
This is a new and enhanced version of the first Knobber Rev.A.
Why the new revision? #
The first Revision of the board featured STM32G070RBT6 and a CH340C USB-Serial converter.
It gets automatically detected by any modern operating system as a virtual COM port or tty.
This is handy for debugging, but always requires additional software on the pc to do something useful.
Make it more usable #
Wouldn’t it be nice to use the Knobber natively without any software running on the PC?
From work, I knew some STM32 have native USB support that can be used to implement for example an HID device.
The STM32CubeIDE has some nice HAL code generation to support common use cases such as USB mouse or keyboard.
A USB mouse would be a nice application for this device, since the motor could simulate mechanical indents which can be used for scrolling.
To achieve this I chose the STM32L412KBT6 which supports native USB.
Other than that it has a slightly smaller package and therefor fewer pins, which are still plentiful in this case.
What has changed? #
The biggest change was, as mentioned above, the switch to a better STM32.
Furthermore the CH340 was removed since it was not needed anymore and a proper debug header was added.
Debugging on the old revision with wires soldered to test points got old quickly.
Also a push button was added for user inputs.
The shape and mounting was left the same, since that worked well in the previous revision.
New options for programming #
This board can now either be programmed via the debug header, or via USB.
But that requires the STM32 to be in bootloader mode (USB DFU).
The BOOT0 pin can be used to change the boot behavior of an STM32.
Luckily this pin is only reserved for this purpose during the reset sequence. Afterwards it is a regular GPIO.
I connected the button in such a way that it reads LOW when the button is not pressed, which starts the regular program from flash.
But if the button is pressed while powering the device, it starts up in DFU mode.
Mechanics #
To make the button easily accessible it was placed dead center directly opposite the magnetic encoder.
This way it can be accessed from the bottom of the finished device.
Software #
The software was extended with the new USB capability. This was luckily mostly done by the STM32 code generator.
I’ve also put in quite some work to have a nice control loop with position and torque control.
Now used is the indentation mode, which simulates mechanical indents which snap in place.
In combination with that the USB part sends scroll position updates to the PC.
To demonstrate, that the indents are indeed software defined, I implemented a state machine with a list of different numbers of indentations per revolution which can be cycled through.
Sources #
All the schematics, mechanical drawings and code can be found on my Github.