Jump to content

[Hardware, Plugin] Arduino based physical display + serial port io+ tutorial (24-11-19)


Recommended Posts

There is a piece of regular paper on the backside of the acrylic that lights up when backlit by a LED, but there is no bleed through. Try it and see if you like the result, a cardboard prototype is done in an hour.

Link to comment
Share on other sites

a little Question: i have a 5kOhm slider (2Ch, with 2x3 pinouts, 2x5k resistors on board) for throttle, but at peak the KSP shows ca. 98 percent. the slider corresponds on both channels very well to the keyboard on config value 2 (override by x/y keys)
default code for constrain/mapping:
CPacket.Throttle = constrain(map(analogRead(THROTTLEPIN),THROTTLEDB,1024-THROTTLEDB,0,1000),0, 1000);

PS: solved it.  just had to change the 1024 to the real pot value of ca. 950...  


Edited by sec3
Link to comment
Share on other sites

  • 1 month later...

I tried this project with a slightly modified code that was copied from A Kerbal Player's Guide And I made this project but expanded. This is what happens: 

  1. I load the vessel onto launchpad
  2. When it is loading, The handshake LED lights up for 2 seconds, then fades out.
  3. Not a bit a signal after that
  4. The second launch, absolutely no lights
  5. Same with all the launches that follow
  6. After I reset the Arduino and bring the vessel to the pad, steps 2-5 repeat.

Why does this happen? Any comments and suggestions will be welcome!


Link to comment
Share on other sites


A very uncertain guess is that the arduino experiences timeout. How long does it take for your vessels to load? If this is the culprit, there is a Delay setting in the plugin ini file that you can try to increase to see if it helps. At work now, cannot direct more specifically. If that does not solve it, you might want to upload your code somewhere we can see it, and check KSP.log for suspicious messages. I am unfamiliar with the work you cite.

Link to comment
Share on other sites

The  "handshake" led will light up everytime it recives some data. Lighting up for 1-2 sec means arduino recived handshake but most likely not answer to your pc. Watch RX and TX leds. When handshake comes trough, RX led will blink, when arduino answer back, TX will blink. If TX not blink, then your board do not talks back to computer.  

Possible issues are 1. Bad settings in com porst or com speeds 2. Your ship take way too long to loads as mentioned and you miss time while plugin waits for answer on handshake 3. If you are on W10, there is bug in W10 that break comunication with arduino (original boards, china copies works in most cases).   

Link to comment
Share on other sites

  • 5 weeks later...

Hey All! 
It's been far too long (I don't even know where to begin)... Needless to say, I'd like to think I'm back :P :D 

I've updated to the current version of KSPIO (demo16 + KSPSerialIO_019_) --
[Well, I did just add the updated elements to my existing code, which I think was just the additional VesselData stuff; everything else looked the same]

Everything seems to be working under KSP 1.4.3 (x32 / x64).

One issue I've noticed (and I can't recall if this is historic - nor if it was fixed) is that when you 'switch to' vessels, there will be an initial comms with the arduino / controller, but then drop out (no active data going through); It usually re-connects, and data starts flowing both ways: however the length of time this takes varies (it's usually between 30 ~ 60 seconds) - and, add to this: it seems to be inconsistent / intermittent (it doesn't happen all the time).

Has (or is) anyone else experienced this issue, or am I alone in this? :)
It's not a big problem, and I'm happy to troubleshoot my setup to see if it's something here - in the event I'm the only one getting this!

Link to comment
Share on other sites


So me and a few others made this with your guys help figured you would think this is cool. It's a two player control panel to play KSP on It's not entirely finished because it needs be made to look nice and installed in the structure but as long as the electronics are working my part is good ^.^

I honestly can't figure out how to attach an image of the full control panel since I'm not used to this form so if you guys can help me attach an image I can send the full view of it.

Link to comment
Share on other sites

@Sputnix Welcome back, long time no see. I do not experience timeouts when switching vessels, so I am afraid I cannot help you there. A first thing to try would be increasing HandshakeDelay in config.xml. If there is some kind of timeout due one part waiting on the other, it might do the trick. This is however a shot i the dark.

@EccentricTea I remember you popping in something like a year ago, nice to see something came of it. An impressive scale of build you got there, dwarfs the possibilities the rest of us have.

Link to comment
Share on other sites


indeed i had the same problem with the new files. it´s connecting and drops out and the switches gone bad.

changing handshake delay  and  refresh rate   helps a little bit. 



Link to comment
Share on other sites


I finish the first part of my KSP controller, wich is basicly sixteen buttons who are wired to an arduino, I saw the KSP Serial IO project I download the files but I don't understand what I  must do with the files. Thanks 

Link to comment
Share on other sites

@Tobit Welcome to the forums.

I am not entirely certain how far you got with the project, but unzip Demo16 in your projects folder, and extract the mod files to gamedata. In \GameData\KSPSerialIO\PluginData\KSPSerialIO there is a configuration file, change the port to the one you are using for programming your Arduino. In the initial post in this thread, there are instructions on what to connect to an Arduino to use the code in Demo16, which you can open in the Arduino IDE and upload to your board. If you can get that working, you can try to add things to it, and change what it does. Otherwise, try to ask for specific help, it will make advice a bit easier.

If you are entirely new to Arduinos, run a few of the tutorial codes, understand what they do, and try to change a bit here and there. Controllers are quite daunting when you start from scratch, but definitely doable. I had not written proper code for 10 years when I started my projects, had never written in C before, and my knowledge of electrics was just about Ohms law and little more.

Link to comment
Share on other sites

Just checking: Do you run Windows 10? This plugin has issues with Windows 10 and select boards. If that is the the case, set HandshakeDisable to 1 in config.xml. If doing that enables the leds, you can only use the plugin to receive data. A workaround would be buying a seperate USB->serial adapter like this one. It could also be that you run a lot of mods on a rig that takes a bit of time to change scene, then the plugin experiences timeout. That can be helped by increasing HandshakeDelay. I run mine at 3000. Is there any sort of message related to KSPSerialIO either on screen or in KSP.log? That could help narrow down the possibilities.

Link to comment
Share on other sites

58 minutes ago, Tobit said:

Well I'm  on W10 so I modified the XML file but it do anything, the RX and TX led do nothing, I have also a Due if it can help

Still sounds like it's probably the outstanding Win10 issue (mainly from the lack of comms). 

As for the Due -- watch it! 

It's 32Bit, so you need to adapt it slightly -- 

You can do a search for 'Due' in this thread / topic and see all the references and discussion.

It might be tedious, but I actually encourage most to read through the 80 pages of discussion. I did that before I embarked on my journey (I think it was about 40 pages back then) - and I learned a lot, and got to know the capabilities pretty well of KSPSerialIO. 



Edited by Sputnix
Link to comment
Share on other sites

16 hours ago, Tobit said:

So apparently you have it in a folder called:

"KSPSerialIO-master" (line 79)

Try renaming that to just "KSPSerialIO"

Because there's nothing actually happening in yours otherwise. Not even an attempt;


In a non-connection, you'll have:

[LOG 17:21:08.332] [AddonLoader]: Instantiating addon 'KSPSerialPort' from assembly 'KSPSerialIO'
[LOG 17:21:08.334] KSPSerialIO: Version 0.19.0
[LOG 17:21:08.334] KSPSerialIO: Getting serial ports...
[LOG 17:21:08.334] KSPSerialIO: Output packet size: 200/255
[LOG 17:21:08.335] KSPSerialIO: Found 2 serial ports
[LOG 17:21:08.335] KSPSerialIO: trying default port COM7
[LOG 17:21:08.347] Error opening serial port COM7: CreateFile Failed: 2
[LOG 17:21:08.348] KSPSerialIO: trying port \Device\Serial0 - COM1
[LOG 17:21:12.857] KSPSerialIO: KSP Display not found
[LOG 17:21:12.857] [AddonLoader]: Instantiating addon 'KSPSerialIO' from assembly 'KSPSerialIO'

A successful connection will have:

[LOG 20:04:57.422] [AddonLoader]: Instantiating addon 'KSPSerialPort' from assembly 'KSPSerialIO'
[LOG 20:04:57.423] KSPSerialIO: Version 0.19.0
[LOG 20:04:57.423] KSPSerialIO: Getting serial ports...
[LOG 20:04:57.423] KSPSerialIO: Output packet size: 200/255
[LOG 20:04:57.425] KSPSerialIO: Found 3 serial ports
[LOG 20:04:57.425] KSPSerialIO: trying default port COM7
[LOG 20:05:01.452] KSPSerialIO: found KSP Display at COM7
[LOG 20:05:01.453] [AddonLoader]: Instantiating addon 'KSPSerialIO' from assembly 'KSPSerialIO'


Would you agree @Freshmeat ?

Link to comment
Share on other sites

From the OP:


Load the arduino code below. Start KSP and build a simple ship. The green led will turn on at launch, yellow led will turn on when G > 5 or fuel < 10%, and red led will turn on when G > 9 or fuel < 5%. These warnings can of course be customized in the arduino code. Since version 0.15 the warnings are for current stage fuel, not total.

Gratulations, you are a one step further. Now break the code in all possible ways :D

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...