3D printing a HOTAS
Content
- intro
- the joystick build
- the throttle build
- the macropad
- mounting everything
- arduino code (utilizing this joystick library)
Intro
I have a friend who got me into No Man's Sky many years ago. I still really love that game and the team who makes it and I often go back for more --
But as anyone with a passing interest knows, the space simulators are numerous. Another friend got deep into Elite Dangerous and had been evangelizing it to me for years, often telling funny stories of emergent or in-game events and showing off some truly beautiful screenshots.
For some reason or another, I finally caved...Perhaps it was because picking up the game would mean having an excuse to see if I could print and wire up a full HOTAS (Hands On Stick And Throttle). Elite Dangerous is arguably more of a space flight simulator for a lot of the gameplay so I thought having these sort of controls would be super fun to learn.
It's probably not worth going into examples of how complicated and expensive a sturdy pre-built and designed HOTAS might be...and suffice it to say I had the hubris to immediately think I could slap an arduino in a printed shell and be done with it. I didn't have a lot of an idea of what I needed, so my only requirements were that I had a joystick with some buttons and a throttle and that both should report their rotation axis' using magnetic hall effect sensors for minimal wear & tear.
The Joystick build
Naturally we're standing on a lot of shoulders here; I was lucky to find this small but helpful wiki purely for 3D printing flight sim gear. Through that I discovered the apparently popular Olukelo Gimbal – a 2 axis joystick gimbal.
For the actual Joystick and Throttle I ended up finding a creator on Cults3D who designed what looked to me to be pretty awesome gear. I could see the Olukelo Gimbal in the photos for the Joystick so I knew it would fit somehow and the purly rendered photos of the Throttle made it look very cool and well thought out. That's honestly about as much thought as I put into it since I have no real flight sim experience... these looked "good enough" (well, they look great) and had at least some documentation on the build. Thanks Miso988!
Get ready for some 90's Nickelodeon colors, because that's the filment I had most of the time I was working on this build – first up was the gimbal because I wasn't sure if my crappy little printer could print something "this mechanical." I've really only ever printed keyboard parts and other small, static things.
So yeah, it actually went really well! this gimbal was a neat little design and I'm really glad I got to put it together like this. You might have noticed in that video but there's already a little cavity in the center of the main axis bearing carriers for little cylindrical magnets -- that's where we'll measure the rotation for the arduino controller.
Onto the actual stick! It doesn't look like anything to me!
I gave it a light (er, shitty) sand to soften it up a tad. There was also this little thumb button (the green one in the pictures) that was supposed to slide into this spot with this little collar and – well I was a little incredulous it was actually going to sit in there. So I tested that here as well as the cable routing through the gimbal. Foreshadowing: 2 wires for one button as pictured here is a dumb strategy and there's gonna be more of it before there's less.
Look -- it's starting to seem familiar! As a joystick...not the other thing.
The top of the stick (where most of the buttons will be) wasn't too bad, though I did hate soldering these push buttons and then trying to slide them into the little jig for the directional input in the center here:
The rest of the top is split in half so that you can install a little leaf switch for the main trigger, which has a satisfying click:
There is a secondary trigger that I had to set similarly, thought this will sit at the bottom of the shaft, er..stick.
Here's me holding it where it'll end up for proof:
Then it was time to screw all those parts together!
Now I had already started to sweat on the number of wires coming out of this thing – for some reason I sent two wires out per switch just out of some kind of weird or bad habit.
Sure enough, this bundle was too thick to get through the gimbal channel. Time to take it all apart and rewire the buttons so that one lug of each button was tied to one single common wire inside the stick.
This would allow me to use the buttons as ACTIVE LOW inputs to the logic I would program later.
Basically, we can take that common wire that all switches are connected to and send one wire through the channel to connect that to ground.
In the arduino code we will then set the button input pins to use an internal pullup resistor to tigh those inputs HIGH be default. Then, when the button for any given pin is pushed, it will shift from that tied HIGH to the common ground wire.
This allows us to check if arduino pins are LOW instead of high to know if a button is pressed, but more importantly cuts our wire bundle from the stick in half.
Probably the only picture I have of this ordeal... but hey there are less wires!
And they all fit! got the joystick on the gimbal and programmed the buttons to test all the connections and the code (I'll share the link to all that below).
The buttons work! using a simple game tester site to make sure.
Okay so that was all great news...but to be honest I still hadn't decided or figured out how I was going to do the hall effect stuff for the actual joystick axis, arguably the most crucial part of the build.
Orginally I bought some SS495A
Linear hall effect sensors, thinking I just needed anything with an analog output but of course that was under thinking it a bit.
The other main way the SS495A
packages work is that they detect magnetic poles from the front of the little transister-esque body. As you approach the front of the package with one end of a cylindrical magnet (the kind we are embedding in our bearing carriers) the signal voltage goes toward the positive voltage rail. Approaching with the other end of the magnet, and the signal voltage goes toward ground.
There is no way to mount this sensor in such a way that it will work for our use case, however. Our magnets are not approaching our sensor no matter how we mount them -- they aren't really approaching anything. They rotate inside the bearing carriers.
So the SS495A
was the wrong part for the job. After some searching however I did find a different package that was still in production, the AS5600
. This is a rotary position sensor for magnets and is meant to be used for contactless knobs and encoders, but it should work perfectly for our purposes as well.
When they finally arrived the analog output was busted on the board that was sent over...big box stores and their bullshit... Luckily clipping out a resistor that fixed that hah.
My new problem was mounting these on the gimbal securely. they were kind of a perfect size to just be slapped on top of the bearing carriers so the chip sat right over the magnets, but I decided to print new carries so that I could mount it properly & securly (after attaching it to a protoboard to give it some width).
Once I finally got these mounted I slapped the gimbal back together with these new bearing carriers and testing right on the scope – success!!
I got the other axis wired up anddd
Flight! Now onto the throttle....
The Throttle build
The throttle as modeled has two axis and, lucky for me, is designed for the type of package that those SS495A
linear hall effect sensors are! These little square magnets sit between the columns and must be placed correctly so that opposing poles are facing "inward" of the little magnet mounting piece.
The SS495A
gets glued in this little channel and given some longer leads for the rest of the way out.
Slather it with some hot glue so it doesn't move in there....
I could then thread & mount these together and in the box! I would later weight this down so the top heaviness of it all would be less of an issue
Overall the throttle was a lot less painful than the Stick since there's no real gimbal to worry about and the hall effect design was more straight-forward. However, there are a lot more of those directional "hats" on the throttle control which meant more delicate wire soldering for small push buttons.
But I managed to get it all in there (with some more hot glue, of course)
You might see there I've also added the triggers to the posts which will push those buttons on the bottom of the grips that you can kinda see in that last picture.
Then I could screw the actual grips on the posts!
Cool, now I just gotta get all those wires to another arduino... I ended up using a ribbon cable this time so that the arduino board could just be soldered to a header and the rest could be a little more modular. I would eventually go back and re-do the end of the Stick wiring to use the same strategy.
then I tied the wires up and added a bunch of tire weights to the bottom of the box where there was still room to balance the weight out.
I ended up going into Blender and splitting the top plate of the throttle into two so I could get it on...I didn't think too hard about how that should have all worked and honestly this solution is fine for me. But having that top plate allowed me to also install the designed "stoppers" which was useful to me for a few reasons – mostly though the hall effect sensors were working great but at some point in the back-travel they would flip power rails and I didn't want to take this all apart and try to sort that (or, hell, try and code for it. That's some 'fix it in post' energy).
Also at this point I shoved a rod into an open hole on both the throttle posts to "join" the axis together and ended up cutting one of the hall effect sensors out of the arduino code entirely simply because having 2 thrust axis in Elite Dangerous wouldn't make a ton of sense. I can always remove this post and put the other axis back in the code if I need to.
But that was it for the throttle! Not as much re-doing or experimentation as the stick which was a nice change of pace.
The Macro pad
There are a lot of mappable controls in Elite Dangerous and it's pretty nice to have quick access to many of them, so I also decided to create a small macropad for anything else I would want a button for.
I also really wanted to try out these really cool looking keycaps from KBDCraft
Once they arrived, I started getting a rough idea of how I wanted the keys to be laid out for a single-hand ergo macropad
and then modeling a "plate" in blender to print and test the layout on
once I was happy with the placement on the test plate, I modeled the rest of the "case" for the keyboard, keeping it very simple and low profile. The bottom of the case would attach which several magnets around the edges of the inside of the top.
on the underside of the case I also added some extra rails for rigidity and some negative space to glue the microcontroller in place.
the switches themselves also ended up in little wells on the top so that the keycaps would sit in a way that would hide the switch bodies
Then I added the magnets, soldered up the switches to the controller, and made some choices on cap colors to wrap it up
Mounting everything
This is the thing that is probably most subject to change but mounting these so they weren't just sitting on top of my desks was important – they sit kind of tall so if I did that I feel like it would be like riding one of these motorcycles (no thanks).
An obvious choice was a VESA mount, especially since I have an extra monitor arm lying around at the moment.
Unfortunately the best way to mount the arm was "upside down" which is tricky since it wants to spring up against something as heavy as a computer monitor. It works, though, and I can leave it attached to my desk at all time since it swings in from the outside, it actually tucks away nicely!
But I also couldn't just leave the stick gimbal exposed and the microcontroller dangling by wires that were going to be moving back and forth a lot... so I had to get back to blender to model an enclosure that would house the gimbal and a hold a microcontroller rigged up with a ribbon connector
once that was all re-housed and re-wired to the controller I could put it back on the VESA
For the throttle for now I just tossed it on an old G5 tower (I have so many of these lol) and just slide it out as needed.
Then I just tossed the macropad on the laptop stand I use when this desk is for actual work and that was that! It took a bit to map all the controls in Elite but it is extremely fun and I'm surprised in the end how well it all worked!