UPDATE (9/1/2014): If you are looking to build a project like this, see my post on the Rabbit Engineering Model I1 device.
#1stworldproblems – I have a lot of very old joysticks. Too many? No, don’t be silly, no such thing. This hoarding habit is related to my collection of 80s and 90s flight sim paraphernalia in general.
It’s not too bad owning a lot of old flight sim software, because you can just crank up an emulator like DosBox or VICE and enjoy your clunky old untextured polygons. But using your retro flight sim hardware is not quite so easy. You can get an adaptor that allows you to use even the more complex joysticks such as the Thrustmaster FCS, but they have two problems: (1) They only convert PC 15 pin joysticks, and not the Atari/Commodore 9 pin digital sticks and (2) where’s the fun in that? Anyway, what I really wanted was a converter that:
- Accepted 9 pin and 15 pin joysticks, including those using the CH Flightstick Pro and Thrustmaster FCS hat switch standards
- Accepted two retro joystick simultaneously to allow for joystick/throttle/rudder combos
- Converted an analog 15 pin joystick into digital output (for use with emulated 8 bit games)
- Converted a digital 9 pin joystick into analog USB joystick (for using digital joysticks with PC sims)
- Converted a digital 9 pin joystick into USB mouse input
- Accepted arbitrary switches and converted them into joystick buttons for creating new custom input devices (like my previous Strike Fighters 2 radar/armament panel project)
That’s a tall order – this will need to be a microprocessor based project (my first). My first instinct was to use the Arduino Leonardo, which I really like and already have some experience with, but a couple of things put me off – it’s light on memory (2.5k), which limits growth potential for code; it has few digital inputs (20) and although it can be HID-configured as a joystick, it’s not trivial to make it be simultaneously a HID joystick, mouse and keyboard. Plus, it’s physically pretty big. Instead, I went with the Teensy++ 2.0, which uses the AT90USB1286, an 8 bit AVR running at 16MHz. It has 128k of flash, 8k of RAM, 40 digital inputs, 8 analog inputs, and more importantly, it can be easily configured as a Joystick (6 axis, 32 buttons), keyboard and mouse on the same HID device. It’s the size of two postage stamps, and costs $24. And it’s manufactured in the garage of an adorable Portland couple. Perfect.
First thing was to work out the electronics and firmware. For the two analog devices (15 pin joysticks), I would accept one as a full flight stick (i.e. 3 axis plus hat switch plus 4 buttons), and the other would be two axes and four buttons (I only have six output axes after all) – this one would be used as a throttle and/or rudder pedals. This step was fairly easy – get the pinout for a PC joystick, and then remember that PC joysticks use their potentiometers as voltage dividers – this means you need to add a 100kΩ resistor between the Teensy pin and ground:
This is required for each axis. The buttons are a simple case of connecting the Teensy’s digital pin to ground. The hat switches are a bit more complex, because CH Products and Thrustmaster came up with quite different ways of implementing those – more on that in this post. Now for the digital devices (9 pin joysticks), which are very simple – the joystick just connects the input to ground. I decided to expand slightly from the Atari standard by allowing two buttons (like the Commodore Amiga used). Here is the pinout. I also added a 37 pin input to expose all 32 buttons for a custom devices – it surfaces one pin per button, plus one for +5v and one for ground.
Those are the device inputs. In order to implement the various modes for the device, I also needed to add some support inputs:
- For each digital device input, a ‘gain’ potentiometer to scale the amount of output on the mouse/joystick.
- Because the digital and analog devices share joystick axis outputs, a switch to inhibit the digital devices (otherwise you get interference between them)
- A switch to select joystick/keyboard mode output on digital device 1
- A switch to select joystick/mouse mode output in digital device 2
- A switch to select if analog device 1 uses Thrustmaster FCS or Flightstick Pro hat switch
- A switch to select if analog device 2 outputs keyboard or joystick signals
- A reset button (needed to reprogram the Teensy).
I also decided to add LEDs to indicate the whole box was live (plugged in), and another to show if the digital devices were inhibited. When you lay all that over the Teensy’s pins, this is what you get:
Note that not all the Teensy’s pins are surfaced on its two side edges – some are in the center of the board. Once all that was locked, I soldered 0.1″ pitch headers on some perf board, and plugged the Teensy in (like a shield). I then got to soldering headers for all the plugs and switches. At this point it is worth pointing out that this is project that used a lot of soldering – somewhere around 400 points. Here I was taking a hand-cramping break:
This took several evenings, because I decided to go slow and test each set of connections as I finished them. As there was a lot of cables in a small space, I would not be able to reach every spot at the end to fix issues.
Notice how I added little labels to connections – this is because I wanted to easily be able to determine which switch connected to which part of the board. When the rat’s nest was all wired up, it would not be possible to visually trace the connections.
As I added physical connections to the board, I updated the firmware to expose the functionality. The code itself was fairly straight forward, and didn’t require a lot of bells and whistles (I did add some code to automatically detect when an analog device was unplugged which I am very chuffed with).
So much for the electronics – now on to the enclosure. I decided to keep the design simple; it would look avionics panel like and hardcore – I took inspiration from the great Cockpits of the Cold War. Last time I tried this, I used a large decal to add the captions to the panel; but after a couple of years, the decal corners have lost their glue, and are peeling slightly. I would avoid that this time by using a sheet of acrylic, with a printed overlay behind it. I also wanted the enclosure to have a clamp so that I could attach it to my desk, and flip switches without it sliding around. Here is the OpenSCAD render of the final design:
The clamp would be the difficult part, so I started on that. The original plan was to have one large, monolithic 3D printed PLA clamp piece (in yellow above), and then have another printed PLA part – essentially a threaded bolt – that would screw upwards to attach the clamp to the desk. Unfortunately that did not work, because the clamp and bolt had to be printed in different orientations which led to the threads sticking horribly. Because the clamp part took a little over 5 hours to print, I decided I wanted to keep that. So I switched to a #6 steel threaded rod and built an adapter for the clamp. This consisted of a tube that holds a steel nut in the hole of the clamp, sandwiched between two flat parts which are glued (using Super Glue/Cyanoacrylate) in place. Here is the tube with one half of the sandwich (the nut is already embedded in the tube):
And here it is sandwiched and glued into the clamp:
This wheel is what applies pressure to the bottom of the desk. It also has an embedded nut which accepts the threaded rod:
The enclosure body is just two simple flat U-shaped halves glued together with the help of some interior straps. Here is the whole thing (probably around 12 hours of printing in all these parts):
The back of the enclosure would be 1/8″ MDF (sprayed black), while the face plate would be 1/8″ acrylic. The faceplate really was the key to the whole thing. To ensure the profiles for the plugs, switches and buttons were the right size, I first did a trial run on MDF (which costs around 15% compared to acrylic) on the CnC router. Amazingly, I got the sizes right on the first try:
Then came the real cuts – I am not a fan of cutting acrylic on the CnC because the plastic melts and sticks to the router bit, slowly increasing it’s diameter, which leads to inaccurate cuts. Apparently you can get around this by increasing cutting speeds, but I have not yet gotten that to work for me. Another way to solve that would be to buy a laser engraver, but I don’t really want to drop $11k to improve my plastic parts by 10% or so (hardly seems worth it when you put it that way, Dave). Here is the acrylic, still with the blue adhesive protector in place. Actually turned out pretty well:
Once that was done, it was time to design the faceplate art (which labels all the switches, etc). I used OpenSCAD’s projection() function to export the outlines as DXF to Inkscape. Once there, I used the miso font to finish up the art:
I printed the art on my regular printer. Now onto the cutting. This had to be done carefully as the plugs have no bezel, so the edges of the cut would be visible. I used a plain old Exacto knife with a new blade and a lot of patience:
And then add in all the switches and plugs. This is actually the most fun part of the project, because you start to see the interface take shape. You need to be careful not to scratch the acrylic while you do this (which of course I did, but luckily it was a small one):
Instead of using regular screws, I decided to use some Hex-headed 3mm screws, which give a nicer aircraft panel-like look.
You’ll remember that part of the design was two LEDs – one to show if the device is live, and another to show if the digital devices have been inhibited. One of the pictures I saw in the Cockpits book showed indicator lights where the text itself lit up – this was very cool and I decided to replicate that. I 3D printed some housings for the LEDs in natural PLA (which is translucent). This is basically a square cone with the LED at the apex, and a transparency with the caption text at the base. I painted these (except for the base) using silver enamel paint to prevent the light from leaking out of the back of the housing. The entire thing is then attached to the face plate with two screws:
The effect is very cool – while the LED is off, the text is barely legible, and then really lights up in the color of the LED when it is turned on. I will be using this trick in future projects. Here is the entire enclosure coming together:
Next I hot-glued glued the perf to the back plate using some 3D printed standoffs (needed to provide space for the cables beneath). I also, as is my wont, signed the plate with my bunny sketch. You should be aware that when you make your own, this is an optional step:
I decided to done one last round of thorough testing before trying to stuff everything in the enclosure. There are many, many cables in this project:
Here you can see how the LED housing is bolted to the faceplate (top center of the plate):
It’s actually kind of hypnotic trying to see where all the cables connect. You can see why it was important to label everything before we got to this stage:
And here I am testing the mouse functionality – the Atari stick is actually moving the mouse cursor around. Very cool!
I also found a number of bugs around how the switches were labelled relative to what the code actually did (e.g. in the image above, the switches are set to use joystick mode, but the code was actually running in mouse mode). I also found one short circuit which nulled out one of the analog device axes. It always amazes how some bugs manage to hide till the bitter end.
Once everything was tested, it was time to compress it into the enclosure. I had to unplug everything, bolt the back plate (with electronics now attached) to the body, and then re-plug everything in (using tweezers) inside the enclosed space. In order to get everything to fit, I pre-folded some of the ribbon cables so that they collapsed in predictable ways as you squished them in. Then finally I grabbed an Allen key and bolted the faceplate in place:
Looks pretty good. Here it is with the desk clamp fitted, and running – notice how the light housings give you nice illuminated text captions (the red LED is brighter than the green):
I did some final testing by setting up Strike Fighters 2 to use the device, plugged in my Thrustmaster Top Gun Platinum stick, jumped in an Israeli Mirage IIIC, and started a huge furball with some Syrian MiG-21s. These two aircraft are very well matched, so there was a lot of stick pulling and grunting, but I got away with two kills before I ran out of ammo and had to run home with bingo fuel. Fantastic! My next round will be to set up Dos Box and use my CH Flightstick Pro to play through the US Navy Fighters Crimea campaign again.
This was a difficult project for sure – large 3D prints, lots of electronics/soldering and firmware coding on top of it all. But being able to use all my old controllers again makes it totally worth it. Total cost in parts was probably around $40 (the only “expensive” piece is the Teensy – the rest is plugs, switches and ribbon cable). If you’d like to make your own, you can get all the STL files as well as the source code for the firmware at Thingiverse.
[…] one to let something like this get him down, [Dave] set out to build his own microcontroller-based interface module. He calls it […]
[…] one to let something like this get him down, [Dave] set out to build his own microcontroller-based interface module. He calls it the […]
Do you have any idea if this will work with Stickworks/Bob Church digital-upgraded sticks, like my Thrustmaster F22? That’s something that I have been missing, for a long time, ever since the deletion of game port support, post Windows XP.
Digital sticks, like my upgrade F22, will never work with USB-gameport adapters.
I love the Atari 2600 console and C64 computer. Do you sell these unique pieces?
I do not – but if you visit Thingiverse.com, you can download my source files for free, and then go to a hackerspace or other venue that has a 3D printer and print one out for yourself.
[…] the iPac distribution box, the SF2 controller, the Arduino Leonardo keyboard experiments, and the Multijoy_retro; so I was confident I could pull it off in a month or […]