Here’s my custom controller and display for Kerbal Space Program.
Last year, after seeing this custom controller, I was suitably inspired. I wanted to build a simple physical device to control launch/stage, throttle, landing gear, lights, and maybe some custom stages. I knocked up a quick hack just to get a feel for how well it worked, using cardboard, a handful of switches I already had lying around, and a Teensy development board which can act as a USB keyboard.
Using a simple controller with physical switches and buttons as alternatives to keyboard keys was fun to use, but I was soon annoyed every time my hands had to go across to the keyboard – and especially the mouse – when checking things like radar altimeter, periapsis, time to apoapsis etc.
I soon wanted not just switches but screens and dials I could glance at. I especially knew I needed a physical radar altimeter. (Landing safely is hard!) What I needed was a way to get the data out of KSP.
Ideally, I thought, someone would have written a KSP plugin to give me easy access to live data about velocity, altitude, fuel levels, periapsis apoapsis, time to periapsis and apoapsis, height from terrain, velocity, surface speed, vertical speed, sensor data etc. Ideally something simple, lightweight, readable by a hacky little program that could pass the data on through USB serial to the controller.
I was really looking for a CSV or JSON plugin for KSP. It took a bit of digging to find it, and I feared I might have to write it, but I was delighted to find the Telemachus plugin which adds a nice simple JSON API to KSP and has a fully featured web interface built on that API. I don’t use the web interface but the JSON API is great. Getting live data out of KSP and into Ruby was a nice moment.
Now I had an approach that I knew would work, I started putting together a wishlist of parts and putting together a simple paper prototype; a rough sketch of what components I wanted where.
Having seen various voltmeter clock projects I knew I wanted to use an analog output on an Arduino to have it display live data about altitude, fuel, velocity etc.
So I started playing with LCD screens and voltmeters to work out how to display different things simultaneously.
Next I went shopping for a good range of switches
A higher fidelity prototype came next, with holes punched in the cardboard where I thought the switches screens and meters needed to be. At this stage, I learned a lot about what felt comfortable, and moved a few things around.
Starting to put it all together.
The displays all go in to the base
Feels satisfying already
Testing the displays
Preparing to drill the holes
Drilled and Dremelled
Everything in place
Source code
- Teensy code for creating key presses from switches
- Simple Arduino code for controlling LCD screen and voltmeters
- Beginnings of a Ruby script for passing values from the Telemachus plugin to the Arduino
Components
- Telemachus plugin – forum post and github page
- Teensy USB development board – the Teensy 3.0 is rather cute. Lots of helpful docs here. NB: uses 3.3v rather than 5v, making it unable to control the LCD screen or voltmeters I used. I ended up using both a Teensy and an Arduino but there are lots of alternative approaches.
- Small volt panel meters – these ones are quite widely available, fairly cheap, and and are only 44mm2. Plus are compatible with this lovely blank faceplate template from Hipsterlogic.
- LCD screen – I went for this one from SainSmart and found these pointers rather helpful
- Large toggle switch with cover guard – there are a few out there, but I tried this one which has an LED in the switch and has a pleasingly chunky feel. It’s slightly counterintuitive to wire up though, and these comments on Sparkfun were really helpful.
- Key switch – this one is a bit flimsy. I’d like something a bit more satisfying. (Incidentally, I also badly want to build something War Games like with two that have to be turned simultaneously.)
- Switch with LED ring – these are rather cute. Two contacts closed when pushed, two contacts for the LED.
- Red mushroom emergency switch – I went for this fairly small one which I use to kill the throttle
- Coloured momentary push switches – I like these ones from Brimal available in a few colours
- Small momentary (on)-off-(on) toggle switches – these are ok
- One large momentary (on)-off-(on) toggle switch with waterproof boot
- WiiMote Nunchuck I had lying around
- This WiiChuck adaptor which works nicely on the 3.3v Teensy and apparently the Arduino too.
I’ve subsequently seen this astonishing mission control desk which I now very badly want to make for my son / self.