Kerbal Space Program: 10 Axis Controller

Project to interface Arduino Mega with Kerbal Space Program, and create an adaptable controller to suit different vehicles and flying styles.

The scope for this project was to replace the typical keyboard game controls, with a far more interactive, intuitive and fun Analogue Stick control layout. I wanted to be able to assign different controls depending on whether a Rocket is being flown to orbit, a Spaceplane is lining up on final approach to a runway, or a Rover is being driven across the surface of The Mun.

The controller runs off an Arduino Mega 2560 and uses the Kerbal SimPit Mod installed in the Game Data folder of Kerbal Space Program. The ready-made Arduino library, Kerbal SimPit is available from the Arduino Library Manager, and this handles all the communication between the controller and the game.

Flying Space Shuttle Endevour

Piloting the Space Shuttle Endeavour


Functions:

As well as the typical flight controls, Pitch, Yaw, and Roll, the controller also handles translation controls, i.e. movement in the X, Y and Z direction when the Reaction Control Thrusters (RCS) are enabled and Rover Wheel commands, Throttle and Steering when in Rover Mode.

To be able to control each of these parameters in unison, I used two 3 axis joysticks that would operate most of the main flight controls, and two 2 axis joysticks to cover rudders in plane mode and some of the RCS translation controls. This is way more options than is really needed, but it gives the pilot scope to adapt the controls to suit different vehicles and flying styles.

A simple slide pot enables fine control of the Main Engine Throttle, which makes precise landing burns easy and fun to pull off. No more need for parachutes, just make sure you have enough fuel to complete your suicide burn!

A large Staging button in the centre of the console takes the place of the spacebar. Press this button to blast off, but remember to check your staging before hitting the button.

Once underway, its often prudent to lock the staging button until it is required again. A handy toggle switch is provided to lock the staging button, ensuring your rocket doesn’t break into different pieces at an inopportune moment.  

The other switches let the pilot raise and lower the gear, apply brakes, toggle SAS (Stability) and RCS modes, or trigger any of 10 or 20 different custom actions depending on which other mods are installed.

Of course, any Rocket is incomplete without some way of aborting the flight and saving the cosmonauts when everything is going wrong.

In case of RUD, Rapid Unscheduled Disassembly, pressing and holding the Abort Switch prompts the pilot to press the stage button to engage Abort Mode.

If the staging button is pressed again, Abort Mode is Initialized, and the Astronauts are reminded in calm yellow lettering, not to panic.

Once Abort Mode is engaged, there is no turning back. If you have set it up your actions correctly, the crew capsule separates, the abort motors fire, and the crew is dragged, kicking and screaming away from any impending explosions, and…


…are safe.

You did remember to pack parachutes, right?


Operation:

On boot up, if the Arduino finds a config file saved to the SD card it applies the last saved settings, if it cannot find a file it boots with factory settings, and creates a config file to save settings into. It then runs a self-calibration to make sure all the joysticks are outputting zero.

The OLED screen displays various actions, like which SAS mode has been triggered, and the status of Brakes and Gear. It also lets budding Astronauts change and save the different options for each of the flight modes, Rocket, Plane and Rover, run the calibration routine, and set the SD card to restore the factory config file on bootup.


Design:
The front panel was designed in Fusion 360, and 3D printed to fit an off the shelf Hammond Console Case, although this version was measured slightly inaccurately and required a small amount of filing to get some parts to fit.

The wiring was planned using DIY Layout Creator, I wanted every connection on header pins, allowing easy maintenance and future expansion or improvements. All the power, GND and Signal wire to and from the front panels, including pull up and pull-down resistors would be spread over two daughterboards.

Kerbal Controller V3 Wiring Diagram

Wiring Plan – It all looks so simple like this

Inside
Organised Chaos, Imagine how it would look without careful planning

Improvements:

Due to the limitations of the mod and the game functions, several of the switches for the SAS autopilot do not function as well as hoped and occasionally cause the game to crash when operated.

These controls are also assigned to the keyboard numpad, so a second controller could be used to handle these commands, as well as some other keyboard shortcuts the game relies on, like changing camera views and controlling the time warp functions. This could run on an Arduino Leonardo, which would show up as a keyboard or Joystick input to the computer.

I would really like to improve the front panel, possibly make it into a single PCB that can have the control labels silk screened directly on. This could also save all the offboard wiring, and a single ribbon cable used to connect the Arduino to the control panel.

For the source code for this project, see my GitHub repo @:

github.com/PanGalacticTech/Kerbal_Controller

Full instructional writeup due at some point.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.