A Tiny Knob Keeps You In Control https://hackaday.com/2024/08/11/a-tiny-knob-keeps-you-in-control/ #PeripheralsHacks #Volumeknob #knob #hid
OLED Display Kicks Knob Up Several Accurate Notches
As far as input devices go, the potentiometer is pretty straightforward: turn it left, turn it right, and you've pretty much seen all there is to see. For many applications that's all you need, but we can certainly improve on the experience with modern technology. Enter this promising project from [upir] that pairs a common potentiometer with a cheap OLED display to make for a considerably more engaging user experience.
To save time, the code is fine tuned in a simulator.
The basic idea is to mount the display over the potentiometer knob so you can show useful information such a label that shows what it does, and a readout of the currently detected value. But you'll likely want to show where the knob is currently set within the range of possible values as well, and that's where things get interesting.
In the video after the break, [upir] spends a considerable amount of time explaining the math behind details like the scrolling tick marks. The nearly 45 minute long video wraps up with some optimization, as getting the display to move along with the knob in real-time on an Arduino UNO took a bit of extra effort. The final result looks great, and promises to be a relatively cheap way to add an elegant and functional bit of flair to an otherwise basic knob.
With the code and this extensive demonstration of how it all works, adding a similar capability to your next knob-equipped gadget shouldn't be too much of a challenge. Perhaps it could even be combined with the OLED VU meters we've covered previously. Be sure to let us know if you end up using this technique, as we'd love to see it in action.
Thanks to [Marko] for the tip.
#hardware #microcontrollers #digitalgauge #knob #oleddisplay #volumeknob
Setup Menu Uses Text Editor Hack
Many embedded devices that require a setup menu will use a USB serial port which you connect to your favorite terminal emulator. But we recently encountered a generic USB knob that did setup using a text editor, like Notepad or even Vim (although that was a bit ugly). A company called iWit makes several kinds of USB knobs which end up in many such products.
These generic USB knobs are normally just plug-and-play, and are used to control your PC's volume and muting. Some models, like the iWit, the user can configure the mapping within the device. For example, knob rotation can be set to generate up and down arrow keys, and knob press could be ENTER. One could do this kind of mapping on the PC, but many of these USB knobs can do it for you. The crux of the setup is this menu (which you can see in action in the first 30 seconds of the video below).
- WINDOWS MODE -
1 Clockwise : Up Key
2 Counterclockwise : Down Key
3 Press : Enter
4 Press+Clockwise : Next
5 Press+Counterclockwise : Previous
6 Long Press : Play/Pause
[RESTORE DEFAULT]
[SAVE & QUIT]
That's nice, of course, but the surprising point is how the setup menu is implemented in the first place. The knob, already being an HID, spews forth the setup menu as if it were being typed from a keyboard. Turning the knob to select an option generates ANSI escape sequences for up and down cursor movement and somehow highlights the current line. Looking at the stream, you can see that the menus are proceeded with these codes:
ESC [ 4 ~ Private code?
ESC [ 1 ; 2 H Cursor row 1, col 2
ESC [ D Cursor back one column
ESC [ 3 ~ Private code?
and item selection is simply the up and down cursor movement codes:
ESC [ A Cursor up one row
ESC [ B Cursor down one row
This makes sense, if we were talking to a terminal. But it's not entirely clear how the typical text editor handles ANSI escape sequences. It's not a big stretch to imagine that up and down cursor codes would be interpreted as arrow keys by either the operating system or the editor itself, but the highlighting remains a bit of a mystery. If you have any ideas, or have done anything similar yourself, let us know in the comments below.
The video below was found on [Nelson Chu]'s Expresii blog, an artist who specializes in simulating organic brush strokes in computer graphics systems. The particular knob used in this article was branded DROK, so you might have this capability in your USB knob even though it doesn't say iWit on the label. If you'd like full control of your USB knob, build your own as we wrote about in this article from 2020.
#peripheralshacks #softwarehacks #ansiescapecodes #setup #usb #volumeknob