The 128 Button, 6 Axis, 17 Slider, 4 POV Hat Switch Joystick Controller

stick

[Paul Stoffregen], creator of the Teensy series of dev boards, previously implemented a six-axis joystick for Teensyduino, the Arduino library for the Teensy. He had originally tried 8 axes, but a few problems cropped up, deadlines approached, and he left it as is. A few recent projects gave him some insight into how to implement a joystick with more than six axes as a USB HID device, so he started looking at how to read an improbable amount of pots and buttons for a USB joystick.

So far, the biggest problem is figuring out what software can actually use an HID joystick with this many controls. The answer to that question is none. The Linux-based jstest-gtk is able to read 6+17 pots, the four hat switches, but only 64 of the 128 buttons. A user on the Teensy forums, [Pointy], has been working on his own joystick test app that works on Linux Windows, but testing the joystick on Windows is an exercise in futility for reasons no one can figure out.

As for why anyone would want a six-axis, 17-slider, 128-button joystick, think about this: with this much control, it would be relatively simple to build the MIDI controller to end all MIDI controllers, or a cockpit simulator for everything from a C172, 737, to a Kerbal interplanetary cruiser. That’s an impressive amount of control, and all from a $20 Teensy dev board.

Further testing of this Teensy joystick is desperately needed, so if you’re able to help out drop a note in the forum thread.

56 thoughts on “The 128 Button, 6 Axis, 17 Slider, 4 POV Hat Switch Joystick Controller

  1. >Pointy], has been working on his own joystick test app that works on Linux

    The link seems to point to a post regarding a .NET joystick test app for Windows 7 and doesn’t telle anything about Linux, kinda contradicting the post.
    Am I missing something ?

    1. The article mistakenly says Pointy’s app is for Linux, when in fact it’s for Windows.

      Here’s a direct link to the message on that lengthy forum thread, with the latest screenshot of the Linux-based “jstest-gtk” application testing this extreme joystick controller.

      http://forum.pjrc.com/threads/23681-Many-axis-joystick?p=41943&viewfull=1#post41943

      Or here’s a full-res screenshot.

      http://www.pjrc.com/teensy/beta/jstest.png

    2. Quote:

      “It wasn’t done, but I wrapped it up this morning and tested on Linux. I ended up with 128 buttons, 6 axes, 15 sliders, and 4 hat switches with 1 degree resolution.

      Here’s a screenshot with “jstest-gtk”. Linux considers each hat switch as 2 axes. I don’t know if the 64 button limit is coming from jstest or the Linux kernel.”

  2. Where is the picture of the joystick? I see the teensy board configured to read a bunch of pots and buttons that are placed in a row but the joystick isn’t there?? Or is someone implying that a flat board with a bunch of pots and buttons = joystick?

    Joystick interfaces used to be very interesting for data logging. In the 80’s, we didn’t have an affordable ADC input peripheral that was meant for data logging in your average XT PC, but we did have joystick cards (which were usually incorporated in to sound cards such as the original Sound Blaster series of cards).

    This doesn’t look like a joystick, it looks like a USB version of the joystick data loggers of the 80’s. I hereby rename this project “joystick interface data logger”

    1. I’m sure there are examples and libraries for MIDI on arduino/teensy. And think it’s best to use those, but yeah when combined you can read the data as done here and then wrap them in MIDI packets to send them out I expect. I just don’t think registering as a joystick and then getting a MIDI program to turn that into MIDI is all that handy, even when ableton supports such a thing (no idea if it does).

      1. You’re absolutely right. In fact, it would be particularly pointless to hack the joystick data from a Teensy 3.1 into MIDI, since Teensy 3.1 has a native, class-compliant USB MIDI implementation. All you need to do is select it from the Tools > USB Type menu in Arduino, and then use the built-in usbMIDI functions to send or receive MIDI at native USB speed.

        1. Not strictly true Paul standard MIDI uses 8 bit output, whist adequate for most level sliders, some effects need finer control then the 0.4% per bit that 8 bit offers, also 8 bit is inadequate for encoder to deck control (Scratching)
          High end equipment these days use both protocols, MIDI for legacy support and HID if your dj software supports it.

    1. The DPad on most controllers is a hat switch. Essentially it’s 4 buttons with a hat over them. Hat doesn’t really stand for anything, it’s a literal use of the word hat, just not the kind of hat you’d wear on your head (unless your a weirdo).

      1. Actually “Hat Switch” DOES stand for something. It resembles the hat worn by Chinese peasants. In the 19th century, Chinese immigrants in America were known as “Coolies” their hat was a “Coolie Hat”. When joysticks incorporated this style of button, some genius noted that it looked like a “Coolie Hat”. The switch became known as the “Coolie” or “Coolie Hat”. These days, it is considered politically incorrect to refer to anything using a “racially charged” term, but the name “Hat Switch” still persists

    2. Seems the term hat-switch comes from the looks being similar to a coolie hat, but,:and I wikipedia quote:
      “A coolie (alternatively spelled cooli, cooly, kuli, quli, koelie and other such variations), during the 19th and early 20th century, was a label applied to a slave or unskilled manual labourer from Asia,”
      So they sanitized it to ‘hat’

      Anyway the name is established, but its also known as POV switch.

      Incidentally I always found the POV (or hat) switch hard to use in flight simulators, just doesn’t feel natural somehow, maybe because it switches view so rapidly so you don’t really experience it as looking around.

      But you can assign it to anything of course.

  3. Perhaps my brain is muddled by V-day planning, but how can a 3-D joystick have 8 axes of freedom? I count X,Y,Z,pitch,yaw and roll which is 6, whenever more dimensions are discussed it is in reference to a multi-jointed device like a robotic arm, was he planning on also measuring the arm positioning in addition to hand positioning in 3D space? Otherwise 8 degrees of freedom doesn’t make any sense.

    1. It does not have to be one joystick. It can be two analog thumbsticks, some analog triggers and maybe a couple of pedals. Or like NATO pointed it out, it can be actually a data logger for something completely unjoysticklike.

    2. Hmm, good point, but you could have the hat-switch to look around be a small joystick on the joystick, which would require an additional 2 axis, while still being a single joystick as it were

      1. If you’re able to help with testing such encoders on actual PC or Mac software, please join that forum conversation!

        You’ll need a real Teensy 3.1 and some encoders to test. (full disclosure: I’m the creator of Teensy and author of the Teensyduino extension for Arduino)

        I really am interested in create new USB device types that offer these expanded capabilities. I’ve got the hardware and low-level USB programming covered, but the big limitation is always the experimenting with what can actually work with available software and operating systems. I truly do need your feedback and help testing.

        1. Hi Paul,

          I’ve got some of your teensy’s and some input components. I’d like to create a HID hub that other dumb peripherals plug into. The hub with teensy in it would take the form of a desk mounted Button Box with a few switches and pots/encoders. Plugged into the hub via network connectors would be such things as:

          Custom flight stick with pitch and roll and say 10 switches/ buttons,

          Separate view controller/ mini joystick with pitch, roll, yaw on a two axis slider base for lateral movement and a thumb scroll for zoom,

          Throttle with a few switches,

          Rudder pedals

          and also ideally a real life output dash gauge or two. (I realise this isn’t covered here but wonder if there is still enough remaining comput for it to be added?

          I’d like to avoid pc Sim software if possible so I’m guessing I would need to use “Processing” to parse a game plugin .txt for telemetry and send it to the teensy over serial or enable udp?

          Do I need to start a branch from this thread, It seems like this would be a great starting point?

          Do you think this might be possible?

          Thanks

          Scott

    3. Yeah… I have a 6DOF joystick/controller I can’t imagine fitting any more axes…axii..axises? I know how to say the plural out loud but not spell it. ANYHOW. Possibly in addition to those, you could have inertia, like in a Wii nunchuk

      1. Do you or anybody else here happen to know of a commandline type of utility to activate the vibration of joysticks/joypads? I used to play a game with the mouse, since that was the best way for that game IMO, but a joypad I had connected would rumble at appropriate times, and I had that joypad on a shelf under my desktop and found it was a nice feature, since you could feel the vibration while using a mouse. Best of both worlds as it were. So if I could make my own rumble notifications that way it would be useful.

    1. Yes, it’s possible, but it is possible on any PC-based operating system to read more than one mouse in any meaningful way? If you try plugging more than one into your PC, you’ll see the operating system merges all their data, so they all move the same pointer and their buttons are become logically OR’d.

      1. Actually, the USB mouse on Teensy 3.1 sends high resolution absolute coordinates.

        In your sketch’s setup() function, you use Mouse.screenSize(width, height), to tell it the screen resolution you’re targeting. Then in the rest of your sketch, you can use Mouse.moveTo(x, y) to send the mouse pointer to any pixel position on your screen.

        1. Hmm, but isn’t there a difference between a mouse, as being detected as a mouse at the USB port, and the final coordinates as used for the cursor? Does windows if it sees something ID’d as ‘mouse’ not expect it to be relative? Or is that translated at low level driver level to in the end always have absolute as the data windows gets?

          And while on the subject, that sort of annoys me about so called touch pads for windows, I don’t think you can make them work as absolute so that where you touch it is relative to the screen position, it’s only drag-the-cursor kind of stuff. Which is odd since touch screens DO obviously tell absolute position. So I guess we need to use a teensy to make a touchpad which then emulates a touchscreen if we want a touchpad that works as 1:1 device. And although that would perhaps not be handy on a pre-w8 desktop with hard to determine positions, it would be good if you have an interface with fixed elements, like a custom program or a tile-like UI, you could put a picture of tile-outlines on the pad to orient yourself, and once you got the start position any dragging would be intuitive.

  4. Let’s assume the pictured board were actually used as a controller, perhaps for a synthesizer. Last year I fully read a datasheet for a trimpot for the first time, and found it was only rated to “200 rotational cycles”. This was a bit surprising, but not really. Trimpots are often used in situations where they may only be adjusted once in their operating life, and so might be built as cheaply as possible. I’m curious how they hold up in the real world under frequent adjustment. Anyone have a story to share?

    1. i have that exact same potentiometer,
      200 rotational cycles?
      no wonder it’s wearing out already!

      i know i might be overloading it but usually when you do that they become useless,
      but mine still works okay.
      it was in storage for years and worked like new,
      6 months of breadboard useage later
      (fast rotations)
      it is now a bit scratchy but not burnt out.

      but for DC its fine with capacitor on output

  5. I would like to have 128 pots to set the 128 harmonics that are in ZynAddSubFX. I don’t know weather the program will let that be done. Hammond organ types have just 9 controls by comparison.

  6. I have been working on a similar device for the Arduino Uno to control Virtual DJ via HID (not MIDI) and it is fully functional (128 buttons and 48 * 8 bit pots) so I can confirm this project will also control any DJ software that supports HID. (Ableton & Serato)

    1. i need a midi control with 128 button, 16 pots fader and 4 rotary encoder.
      im using arduino mega 2560 and from what i know i must use matrix for the button.
      but i dont know how to make the sketch code.
      can you help me with that? im begging you…please show me how im gonna finish my work
      thankyou….

Leave a Reply to otharCancel 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.