UPDATE (9/1/2014): If you are looking to build a project like this, see my post on the Rabbit Engineering Model I1 device.
Confession: This project is the geekiest, nerdiest thing I have done yet. More so than spending a year writing code to support an indie tool to a major anorak piece of software. This one reeeeally takes the cake. It is almost of benheckian proportions. I built the actual hardware almost two years ago, but only this last weekend did I get round to tweaking the software bits to get it to work right.
What it is is building custom hardware for Flightsim. Yes, hardware. In this case a knock off of the Boeing Mode Control Panel, which is used to control the autopilot and autothrottle. During a regular scheduled flight, about 80% of the flying is done by tweaking on this panel, so it is a nice bit of hardware to have.
You can buy these things for flightsim, but they are not cheap. Until recently, the best model to go for was the one by Opencockpits, but it goes for 335 Euros – ouch. Recently I saw a review for a new MCP Combo by VR Insight, which looks just awesome – it is an MCP and a bunch of other functions too (see review at AVSIM here), but again, $375.
So I started thinking – how can you get a bunch of dials and buttons to talk to a PC which is compatible with FSX in a simple way? I knew how to make pushbuttons talk to a PC as if they were programmable key via Ultimarc’s IPac board (which is very reasonably priced at $39), because I used that for the joystick and buttons on my homebrew arcade cabinet. But what about the rotaries?
The IPac, by the way, is dead easy to use. It has rows of connectors (one earth, and then one for each of the 32 buttons it supports), and an USB plug. It takes power from USB, so no batteries or power supply needed. When you plug it into your PC, Windows (or even Mac and Linux!) sees it as a regular old PC keyboard – no special drivers or anything needed. But, if that was not enough, you can program it so that each of the 32 lines produces just the keypress you need. It is a really awesome little device, and perfect for this sort of project, because you can just map a particular key in FSX, and then program the IPac to generate that keypress when you press your button.
A little research showed that you can get a magical part called a rotary encoder. This gizmo turns turns in both directions (like a potentiometer), but clicks as it turns – and each click is a single button press. So you can encode button presses for clockwise and anticlockwise turns as you need. So that’s what I needed. Mouser sells the encoders at $4 each, and Jameco has the push buttons and switches (I used the kind that return to center after toggling them) for $1.50. So that would be pretty cheap. The next problem was the enclosure – a nice box to put it in. You can get lots of plastic enclosures, but they start at about $20 (and I am too cheap for that). A little more web research showed that some companies will send you a single free sample. So I dug up OKW Enclosures, and asked for a “sample” box, which is nit very exciting (sort of off-white and very square), but it does the job great.
Once I got all the parts, the next step was some planning. I drew up a rough sketch of what functions I wanted, and how to lay them out. I also had to be sure not to use up more than 32 button slots on the IPac (that’s all you get on my model). Each rotary eats two, so I scrounged a bit, and ended up needing only 29.
Then came time to lay out the buttons on the enclosure face, and make sure everything fit physically. It is vital to not screw up here, otherwise you will mess up the enclosure. Luckily I had enough space on the faceplate for all I needed, but it was a pretty tight squeeze. In the end it looks good because there is not a lot of empty space, but there is still enough room to fiddle with all the controls.
Here you can see the pushbuttons (square and black), a toggle switch (that’s the flight director toggle between the two columns of buttons), and a rotary encoder (next to the open hole). Notice I soldered a good long length of cable (single core, pretty stiff so I could bend it into shape) to each control as needed before I put them on the face – I did this to avoid burning the face plate if I slipped by accident.
The cabling is pretty simple, even if there is a lot of it:
- Pushbuttons: Each has two cables – one goes to earth, then other to the IPac’s input for that function (important – these must be the ‘push to make’ buttons which do not stay engaged, like a normal key)
- Rotary encoders: Each has a two earths (you can wire them together), and then one line for clockwise and one for anticlockwise. Each one of those goes into an IPac function input .
- Toggle switches: Like the rotaries – two earths, and one line for upwards push and one for downwards push. I used the type that springs back to center, because having the type that stays up would have led to a continuous signal to the IPac, effectively the same as keeping your finger down on the key.
The trick is to go slowly so that you don’t confuse yourself, because there are a lot of wires. And have a multimeter nearby to figure out what cable connects to what!
To know if the thing was plugged in, I added a green LED to the +5v line on the IPac – to do this you also need to add a 100 ohm resistor on that line. After that, I could plug it into my PC and test it – after fixing some loose soldering, it was ready. It was at this point that I got busy on my PhD and work, and the whole project languished for almost two years. When I was packing up for the big move, I decided to put the project into my air shipment, in case I got the chance to work on it during the first few months. And this weekend was that chance. This is what is looks like now (including amazing 1970’s style lettering on the controls!):
I used two shelving brackets to hold it up, and the plywood base is from an old curtain rail. Notice I used butterfly nuts to attach the enclosure to the bracket, as this lets me angle the box as I need (you need to tighten it quite a lot, because the toggle switches and buttons are pretty stiff). Here is a picture with my sexy hand to show you the scale:
The hard part of the project was actually getting FSX to recognize the control, which surprised me. To program the IPac itself is no problem under Vista – just be sure you run the app as administrator (Grrr…). You then upload to the device, and then you can test it by just opening Notepad and pushing the buttons to see you get the right keypresses out.
Now I expected that I would just start up FSX, open the key mapping control and just enter the keypresses into the autopilot functions. And you can do that for some of the functions, but not all for some unexplained reason. For example, increasing and decreasing the altitude readout on the autopilot is not on the key mapping control. So what to do now…
Fortunately, you can access all they keyboard events through hacking the correct XML file. The one in question is called Standard.XML, and you can find it (in Vista anyway, look for it in a similar place in XP) in C:\Users\<your login name>\AppData\Roaming\Microsoft\FSX\Controls\Standard.XML. If you crack open that file, you will see FSX events (as you find in gauges) mapped to keys in XML blocks that look like this:
So you just need to add the events you need to this. One caveat – this file controls the keys which are set before they apply they keys you set in the interface in the game. So if you have used the Q key in your standard.xml, but the have set the Q key to control something else using the key mapping interface in FSX, then the function you set in the game will take preference. So be sure you have removed any duplicates in the interface, or your buttons will mysteriously not work (ooh, some frustrating moments discovering that…).
And there you go! The whole thing cost me significantly less that $100 (probably around $70 or so), a fair bit of work, but it is very satisfying to use.