[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.
>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 ?
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
Thanks for the correction Paul. I updated the main link and crossed out the Linux mistake.
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.”
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”
I hereby nominate you for class dunce for your failure to perceive the phrase “joystick controller”
Really? It controls the joystick? Does it make it move by itself? WIll it dance??
I hereby rename you “troll of the day”.
Would it work with something like Ableton as kind of Midi Controller?
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).
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.
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.
@Tig3rch3n
It will control Ableton but not as a MIDI controller but as a HID controller, at a better resolution than MIDI.
He is called [Paul Stoffregen] not [Paul Stoffergen]
Could use something like that in an arcade cabinet or a jukebox.
What is a Hat switch?
It’s the four-way button *on top* of a joystick. As in, a directional control for your thumb.
Thanks for defining that. Never was good at joystick games…
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).
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
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.
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.
Don’t forget the 4th Dimension, Time! Would Haptic feedback count as an axis? What if one feedback was vibration and another was electrical shock? (tongue in cheek)
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.
Well you could have: motion for 3-degrees, orientation for another 3-degrees and then scaling for another 3-degrees.
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
Thrust for every engine, Flaps, trim surfaces….
BTW, a couple rotary encoders could be a nice adittion for flight sims.
thrust would be a slider though not an ‘axis of freedom’
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.
Surely a teensy 3.0 would also do? There are way more of those floating about.
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
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
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.
For vibration feedback the device has to accept a return HID packet to initiate the stepper motors, at present this project doesn’t accept return packets.
Actually, this could be useful for a motion capture puppet.
Hmm, if you labelled each button with different alphanumeric and symbollic characters, you could use it for text entry.
Perfect for USB Oscilloscopes, or any other PC hardware you want to interface with without touching your mouse.
Is it possible to enumerate as a Keyboard + 8 mouses instead ? :)
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.
There is/was a driver for windows XP that let you control two cursors with two separate mice. I used it for a bit, but no software actually supports two cursors so it was kinda futile.
http://www.ohloh.net/p/cpnmouse
GlovePIE allowed/allows you to read and script 2 mice simultaneously too
Mice send relative information though, not absolute values. So you’d have to think of a new library for that, and then think up what the hell to do with it in a practical sense :)
Wait I found a use, register as 8 mice and windows will probably crash, you’d have a crash dongle.
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.
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.
“testing the joystick on Windows is an exercise in futility for reasons no one can figure out.”
Probably cuz it’s not WHQL listed?
There is already HID class device support in Windows, so no need to install WHQL (kernel) drivers.
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?
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
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.
The MIDI controller to end all MIDI controllers with 17 pots and 128 buttons?
You obviously are too focused on using an arduino and have missed the midibox…
Ultimate Mame arcade cabinet anyone ? 4 players = 4 joysticks..4 spinning wheels.. 32 player buttons.. 12 controls buttons … and be fool.. add 4 trackballs…
Nice build, but it will be a real challenge to create a control panel for that all, and to wire everything to the PCB.
A whole lot of time ago (around 2005) I made a 48 button, 8 digital + 4 analog axes HID interface (running perfect in both Windows + Linux), including a (yet untested) arcade monitor video amplifier + protection interface: http://kernelhacks.blogspot.com/2012/04/amuse.html
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)
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….
Escluse me but the schematic for all? And the ino file for all “THE 128 BUTTON, 6 AXIS, 17 SLIDER, 4 POV HAT SWITCH JOYSTICK Controller”?