Chapter 14. Adding Hardware to the Game

There is only so far the keyboard can take you, only so far you can immerse yourself into the game, without having a big red flip switch with a molly guard1 and lights that blink on and off. Even today, in the age of the glass cockpit, a lot of the switches on real space hardware are firmly in the physical for psychological reasons. It just feels better.

So in this chapter we’ll be building hardware and making Kerbal Space Program talk to it. We’re going to take a look at the two most common mods used to get data in, and out, of the game: the KSPSerialIO and Telemachus mods. As you’ll see, they take very different approaches, both in the game and out of it, to accomplish that task.


Some of the code in this chapter is based on example code released under the CC BY license by the developers of the KSP SerialIO mod.

On the hardware side of things, to make our lights blink on and off, we’ll use the Arduino.


This chapter covers some intermediate-to-advanced hardware topics. In order to make use of this chapter, you should have at least some experience in electronics.

The Arduino

The Arduino started off as a project to give artists access to embedded microprocessors for interactive design projects, but it may well end up in a museum as one of the building blocks of the modern world. It allows rapid, cheap prototyping for embedded systems. It turns what used to be fairly tough hardware problems into simpler software problems (and ...

Get The Kerbal Player's Guide now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.