Future Proofing for 2.0

A project log for Kerbal Flight Control

This is an input focused control panel for Kerbal Space Program.

Matthew PeverillMatthew Peverill 08/22/2019 at 19:330 Comments

So Kerbal reddit is aflame with news of Kerbal Space Program 2.0! Time will tell how the new team does with it, but what we've seen so far is pretty cool. I'm not hugely in to the far future stuff, but it looks to be a bigger game in general, which is awesome.

But more relevantly: it would be a shame if we had to rebuild this thing entirely for a new system! How can we guard against that? My feeling is that there will be some analog of kRPC or equivalent that I can talk to, but it may take some time to be feature complete. In the meantime, it would be nice if we could do this without complicated software. How can we do that? By emulating a joystick!

The ATMEGA328P, which is the chip that powers most arduino based controllers (and both of the ones I've used with this project so far) is too slow to emulate a USB device. But the ATmega32u4, which is in the Teensy 8 bit microcontrollers as well as some of arduino and adafruit's lineup, can. So can the 32 bit chips in Adafruit's M0 line. Possibly I should just go for that, but 8 bit just feels so nostalgic (plus I don't need to do a pass over all my designs to convert them to 3V logic). 

1. The USB plug: classic arduino uses a USB-B cable. I've been a bit stubborn about this one, because I feel like the micro cables might be less resilient, but at this point everyone has a million of them lying around, so I can probably let it go.

2. Power: The Arduino has the option for an external power source, bumping up the available power from 400mA or so to about 900mA. One thing we'll need to do during testing is calculate how much power everything takes in operation (we can always install our own power jack separate from the microcontroller's supply).

3. How big a joystick can we make? We have 11 analog controls and up to 64 digital on this sucker, and even the mightiest HID device can't support that many. BUT we can do a workaround: one board can emulate multiple HID devices, so we can present as more than one joystick. Problem solved.

This should be a good option to make the board more flexible for either KSP version.