A USB Connected Box-o-Encoders

picoscope-encoder

[Colin] loves his PicoScope, a USB based “headless” oscilloscope. While using it he found himself longing for a classic oscilloscope interface. Mouse clicks just weren’t a replacement for grabbing a dial and twisting it. To correct the situation he created his USB-Connected Box-o-Encoders. The box maps as a USB keyboard, so it will work with almost any program.

[Colin] started by finding encoders. There are plenty of choices – splined or flatted shaft, detents or no detents, panel, PCB, or chassis mount. He settled on an encoder from Bourns Inc. which uses an 18 spline shaft. His encoder also includes a push button switch for selection. With encoders down, knobs were next. [Colin] chose two distinct styles. The two knob styles aren’t just decorative. The user can tell which row of knobs they are on by touch alone. Electronics were made simple with the use of a Teensy++ 2.0. [Colin] used a ATUSBKey device running Teensy software, but says the Teensy would have been a much better choice in terms of size and simplicity.

Once everything was wired into the box, [Colin] found his encoders would “spin” when the knobs were turned. They are actually designed to be PCB mounted, and then screwed into a control panel. Attempts to tighten down the panel mounting nut resulted in a broken encoder. Rather than redesign with purely panel mounted encoders, [Colin] used a dab of epoxy to hold the encoder body in place.

encoder-wired

The software setup is simple: Whenever an encoder is moved, Teensy outputs a unique keystroke for that encodrer’s clockwise rotation, counterclockwise rotation, and press-to-select. The PicoScope software keyboard shortcut keys are setup to respond to the keys programmed into the encoder box. The final result is very slick. Timebase, channel voltage, and trigger level, all work like a regular scope. 

27 thoughts on “A USB Connected Box-o-Encoders

    1. Additionally, the standard Chinese rotary encoder available all over EBay has pretty exactly the same footprint and is compatible, but with fewer clicks per rev (I think 18). They’re also much cheaper.

      Alas, it’s impossible to find it the Chinese encoders are RoHS compliant, so I can’t use them in my module ;-(

  1. looks like you built a macro box or a video editing keyboard or gaming mouse where each encoder can be programmed to do something so you can turn 1 and vertically scroll and another horizontally scroll and another volume for sound or another could be brightness or contrast in a photo editor or video editor

  2. Nice. I think the headless O-scope companies should consider a project line for this (i.e., PC is just used for the display screen). Another solution for cleaner look on the mounting panel is FrontPanelExpress.com (I haven’t tried them, but it looks like relatively painless way to get a nice result).

    1. Yes, if such a company takes this on, I hope they would use a PCB to solder the encoders to reduce the “rat’s nest”.
      I had no idea encoders could be had for those prices. Is there an item available for obtaining scrap encoders, like maybe a mouse wheel?

      1. Scroll wheels usually do have a small optical encoder attached. Old ball mice contain two or more. For a mechanical encoder with a shaft, look in discarded consumer electronics which use a rotary knob for a digital function: car radios, stereo receivers, and radio scanners.

  3. The only good encoder is optical and it will have a power input for the LED. The mechanical ones don’t always output one pulse per click or bump. I have a stereo where the big knob skips pulses and has to be turned slowly to get volume change at all. They get dirty and wear off their carbon tracks. Though I prefer knobs to a buttons especially for volume in a car radio, some of these leave something to be desired.
    This overall hack could make for some better action for keyboard based games or editing.

    1. I agree that the mechanical ones can sometimes not output a pulse. However this is generally only a problem at higher rotational speeds where the contacts bounce, or it’s given a quick flick, in which case you’re not expecting it to settle on an exact value anyway.

      The insides aren’t carbon track, they’re metal contacts. Here’s the innards of one of the cheap Chinese ones:

      http://imajeenyus.com/temp/DSCN6381.JPG

      Note the grease – at higher speeds, the sprung contacts will ride over the surface of the grease (“greaseplaning!”) and won’t make proper contact. However, I found that even at 500rpm, the encoder still produces (or rather, my little circuit detected) correct pulses 95% of the time. At 2000rpm, that’s down to 90%.

      Generally you’re going to sneak up on whatever value you want, so the final adjustment will be at a very slow speed, so contact bounce shouldn’t be an issue.

    2. The mechanical ones need SW debouncing…. if you are lazy (as in my project) they won’t be very reliable. But lots of products use them & work great (e.g. real scopes) because they were not lazy!

  4. Very nice! this will have to be added to my list of things to do. Only thing that would irk me is that the Picoscope software would need to be the active window for the keyboard short-cuts to work, so I couldn’t have the scope on a second monitor (usually my TV) while working on something else on my main monitor. This is already an issue though, having to mouse on over to the TV to change anything

    I might add a button to the panel which would run a Windows Hotkey which would make the Picoscope window active. This could maybe also run the software if it isn’t already open. Or see if I can run the Hotkey on the first click of any encoder without the window minimising when I turn another one.

    1. Keyboard is HID… just a specific class. Thus if you want to use generic HID it’s about 2 lines of code to change! The problem is then you require your computer SW to be designed to use this box properly & know what the codes are. I didn’t have that option (scope software is closed-source) so had to hack the available input options.

  5. This is a complete waste of time. For the cost of a Picoscope and the encoders, you can just go out and buy a better bench oscilloscope WITH VGA output. A much cleaner, much more functional solution that doesn’t require 4 boxes (picoscope, CPU, Monitor, switch box).

    This is what happens when people stop thinking analytically.

    1. Huh? AFAIK this is far cheaper… the reasonably-priced scopes have very small buffers (1MSample) seems to be more expensive, although the Pico devices have insanely large buffers (512MSample for my device). Besides 95% of the time I like the GUI interface anyway instead of encoders, but wanted to build this out of interest…

    2. Huh? AFAIK this is far cheaper… the reasonably-priced scopes have very small buffers (1MSample) seems to be more expensive, although the Pico devices have insanely large buffers (512MSample for my device). Besides 95% of the time I like the GUI interface anyway instead of encoders, but wanted to build this out of interest…

      1. My comment got screwed up there sorry… it should have read “the reasonably-priced scopes have very small buffers like below 20KSamples, devices with OK sized buffers (1MSample) seems to be more expensive”. I don’t think the comment system liked my ‘less than’ sign for some reason!

Leave a Reply to Tom HargraveCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

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