ohMorrissey

FOR ROCKET USE ONLY: A Kerbal Simpit Build Log

Recommended Posts

FOR ROCKET USE ONLY: A Kerbal Sim-pit Build Log

A name derived from the first piece I bought, a racing car ignition switch with "FOR RACING USE ONLY" printed across the top. This Project started mid 2016 and while its a matter of months off being in a completed form, like most maker projects, I don't ever think Ill be "Finished" with it

SrLn0dm.jpg

MRK8gRc.jpg

Aim

My aim is to make a sim-pit that surrounds a keyboard that includes a joystick (microswitch, not POTs) and as many switches and buttons I can.

After many months of looking at layouts and design themes, I've settled on going for the most Raster Prop Monitor looking IVA theme I can, basing a lot of my panels on this mod.

If you don’t know RPM it adds a fully usable IVA into Vessels and looks so aesthetically pleasing:  EDIT: This is actually the command pod from the ALCOR mod

2015-01-20_00001.jpg

 

The Idea is to go more for fun to use than practical. I want as many missile switches and pointless (but useful) knobs and flashing lights as I can. Basically I really want to go for that Arcade, really fun to use feeling even if its not overly practical.

Hardware/Software

I'm currently using two Arduinos and coding with Arduino's IDE;

  • Arduino Due
  • Old Arduino Uno knockoff (Freetronics Eleven if anyone cares)
  • Arduino Mega

The Due uses the <Keyboard.h> library to emulate button presses to control KSP. Flicking a switch will emulate a keyboard pressing a button, for example, flick the light switch, the Due sends a “U” to the computer. But because the switch can be stuck in the on position, the Due only sends the command when there is a change in state. *** The <Keyboard.h> portion of the project has been scrapped in favour of using Kerbal SerialIO's control functions. This means I have lost some functionality meaning a keyboard is still necessary however there are also a lot of pros of doing it this way.  This completely removes the use of the Due. The keyboard emulation may return if the build gets an upgrade/increase in size. ***

My KSP uses a mod called Kerbal Serial IO by Zitronen, the mod does nothing to the game but sends data packets to and from KSP to the Arduino via Serial communication. Way too technical for me but once I got mine working, it has infinite potential. I'm able to access data from KSP and either print it or use it as logic for warning lights. Their is infinite possibilities with this thing. I have also been able to get my code working with WIN10 as some people couldn't get the control packets working on windows 10, the bug has been fixed and I am now using the control packet to control KSP.

I am using two DuinoTech 128x64 Dot Matrix LCDs as my HUD. Arduino has its <LiquidCrystal.H> library making it so easy to code for the screen. Controlled by four buttons to switch between different data sets relevant to different situations and a neat little protoPCB to make all the wires a lot neater.

The whole build is designed on five identical sized panels to allow for easy modular use incase I rebuild the enclosure (thinking about a full seated simulator in the future, maybe)

Current Stage

Here's a few things I've currently got working

Currently Built/Working:

  • Staging Button and Stage lock Switch (Prototype) Toggle Switches emulating keyboard press (Controls SAS, RCS, LIGHTS, GEAR)
  • Dual LCD Heads Up Display with real time Data from KSP (currently only displays speed)  Fully implemented as of early 2018 
  • Communication from KSP to Arduino (KerbalSerialIO Mod) with onscreen *LED connection Status indicator
  • Control Packets sent from the Arduino to Kerbal via Kerbal SerialIO 
  • LED warning Matrix 
  • Apollo Style toggle switch guards
  • Laser Cut acrylic panels
  • Custom Enclosure surrounding Keyboard

SVQXHyb.jpg

giphy.gif

jHrRMwz.jpg

MRK8gRc.jpg

g5zD0Os.jpg

Planned:

  • Custom Enclosure surrounding Keyboard ({Implemented Mid 2018)
  • Joysticks for Attitude and for Throttle (Purchased but not coded and implemented) 
  • Controls for LCD Screen changing the Data printed on screen  (Implemented early 2018)
  • Possible second LCD for more Heads up Data (Implemented early 2018)
  • Warning LED matrix (Designed and built early 2018)
  • Laser cut acrylic panels with back lit text. (Implemented early 2018, no backlit text.)
  • Possible custom analogue throttle

Resources + Credit 

Ill post all my code but most of it for the Uno is Zitronen’s “Demo16” Code which I have modified. I'll make it clear in the Code what is mine and what was original.

All code for my keyboard emulating Due is original. I will comment in code if that changes. *Due removed from build

I’ll also make sure to give credit where it's due (in the forum or in the code) as I’m taking a lot of inspiration from other Build logs as I find the fascinating. If I miss something, I apologise.

GitHub Code  Not really updating anymore, will post final code when done, not posting every iteration 

Build Logs

Edited by ohMorrissey
Keeping Updated

Share this post


Link to post
Share on other sites


For Rocket Use Only - 18/12/16

At my local electronics store I found this

racing-ignition-switch-panelImageMain-51

Thought it would be perfect for a stage and stage lock switch and a perfect place to start. And gave me the code name: for rocket use only.

Got my Arduino Due in the mail and started looking at the keyboard.h library to be able to control KSP. I'm just using the Due as a keyboard emulator to simulate the button press (space for staging)

The Ignition panel is wired so that the button will only create a completed circuit if the missile switch is on. 

/* 
 * ohMorrissey
 * For Rocket Use only
 * Kerbal Space Program Staging Controller
 * 18/12/16
 */
 
#include "Keyboard.h"

int StagePin = 9;

void ButtonScan(int Pin, char Output){
  
  bool State = digitalRead(Pin);
  
if (State == 1)
   Keyboard.press(Output);

else 
   Keyboard.release(Output);
  
}
void setup() {
 pinMode(StagePin, INPUT);
 Keyboard.begin();
}

void loop() {

 ButtonScan(StagePin, ' ');
 delay(50);

}

I have considered KerbalSerialIO but it seems way to complicated for my coding knowledge so far

 

Top Post

Share this post


Link to post
Share on other sites

First Prototype - 27/12/16

Whipped this up as a prototype, all works as it should plugged into the due, im using a state change recogniser so that the arduino simulates a button press when the switch changes state, rather than just holding the character key down.

sSEHnMS.jpg


This way I can flick a switch down which will press an action group (0 key) to deploy solar panels, flick the switch again (0 key) to retract panels. But on the controller it just looks like the panels are linked straight to the switch position.

void SwitchScan ( int Pin, char Output, bool& PrevState){

bool State = digitalRead(Pin);

if (State != PrevState)
      Keyboard.write(Output);

PrevState = State;
}

I have wired all my inputs with Pulldown resistors, this way I can wire the LED's into the switch circuit.

But because the Arduino Due runs on 3.3V, Ive had to wire the switches with LEDs with 5V to accommodate for the 2V drop from the LEDs.

 

Top Post

 

Edited by ohMorrissey

Share this post


Link to post
Share on other sites

Heads Up Display Screen 27/4/17

So I thought I might actually try to have a heads up display and have looked into using KerbalSerialIO. 

 

It took a fair while to get working properly but found out that the Chip in the Due isn't suited to the code so its currently running through an old Arduino Uno knockoff.

I went out and bought an LCD screen to learn to program and use. Once you find the liquid-crystal library it becomes relatively easy. The LCD behaves oddly as it prints on the 1st line, then 3 then 2 then 4. Using lcd.setCursor() its an easy solution to get around this. 

WrDT9lp.jpg

Using Zitronens demo16 and modifying it, (removing pieces of code that I wasn't going to use) and I could access the floating point of the Surface velocity (Vdata.VSurf) and display that on the screen. 
Rather than using LEDs to display whether or not it was connected I simply Displayed that on screen. 

 

GitHub Arduino Code

Top Post

Edited by ohMorrissey

Share this post


Link to post
Share on other sites

Hi good afternoon.
How come the control data from the arduino over the serial interface to the kerbal program? How can you install this in KSPIODemo16?

Thank you.
greeting

Share this post


Link to post
Share on other sites
2 hours ago, funkheld said:

Hi good afternoon.
How come the control data from the arduino over the serial interface to the kerbal program? How can you install this in KSPIODemo16?

Thank you.
greeting

Im not quite sure if you mean control or access the data, 

Controlling the Data I use a different method, my code acts like a keyboard so it doesnt use serial IO, 

As for accessing data, you can use VData.AP for example to access the apogee data, you can use all the different data floats to make more as well, such as fuel percentages and what not

Share this post


Link to post
Share on other sites

Heads Up Display Screen 16/6/17

Been busy with Uni and exams so haven't worked on this much recently, but finally got the LCD code working with minimal flaws, I also have an intro to laser cutting at a fabrication laboratory tomorrow so I can start cutting my panels!

Most of the code is so that it displays the floating values in a readable way, eg velocity=1234567, will be displayed as 1,234,567m/s which is easier on the eyes. It also does some calculations to determine fuel percentages and what not. 

Ive also bought some 6v servos to try and make dials, servos just seemed easier to control and I can make them look however I want. 

Heres a demo video of what it can do at the moment: (Don't mind; Framerate;Halo Theme; Video Quality, use of mechjeb)

 

 

 

 

V20170523

I'd also like to change it to display the info like this, it makes it more difficult to understand but more realistic and I can display more at once, (Data is just example, not from KSP). But this will take a lot of re-coding.

2C7cT2J.jpg

Id like two of these screens next to eachother to display 8 data points at once

Top Post

Edited by ohMorrissey

Share this post


Link to post
Share on other sites

Dual Screens and First Circuit Board 20180208 Update

So obviously this project had been left alone for a while, I got a HTC Vive for my 21st and had been between using that and concentrating on uni, moved jobs a couple of times and left this on the back burner. After a very insightful meeting with someone in the Project Management industry he encouraged me to pick this back up again. I have been working on it for the last couple of months and by the time of posting this, I've actually almost finished, but i'm going to post updates sporadically to keep things spaced out.

I have soldered up my first circuit board to save a ridiculous amount of wiring, it is wired to run to LCD screens independently but shared all but one of the wires (latch pin I believe). Using these Protoboards from Jaycar I can wire the several LCD pins straight to 5v and GND respectively, without having to have the long mess of wires going straight to the PCB at the arduino end. At the moment the wires are plugged in to mirror the screens but they are able to be controlled separately. So far my plan is to have four buttons controlling the info selection mentioned in the previous post, and control the screens together instead of independently while still displaying different info.SVQXHyb.jpg

The Connections just use basic headers and female to female jumper wires that I didn't pull apart after buying. You can see the resistors for the LCD backlight and the 7 input headers in the middle. The group of four control serial communication and the other three are the two seperate latch pins as well as the clock pin. The final two headers at the back are just the 5v and GND connections. I still have to had pull down resistors and headers for the buttons to select what data the screens will show.

Top Post

Share this post


Link to post
Share on other sites

Autopilot controls, control via KerbalIO, 20180210 Update

So I've fiddled around with the output function in KerbalIO and it's working well with my Windows 10 and I've just figured out how to use it well with my build. At this point I want to scrap the keyboard emulator portion of my build which will mean only one arduino. I don't know how Kerbal serialIO will run with two arduino's plugged in so I may run some tests later but at this stage i'm axing that part so I will lose the game controls like the map function and camera control but I may bring that back if I ever make a full enclosure with no keyboard space. 

Using KerbalIO for the controls gives me access to using the autopilot modes at the touch of a button. Prograde, retrograde, maneuver node and target etc SAS modes. It can also allow for some more creative coding which gives me more functionality options than I had before when using Keyboard.h emulation for the controls. 

At this rate im sticking with the microswitch joysticks instead of pots even though Kerbal IO allows for custom analog axis. I still like the feel of the arcade style more than the realism feel. This may change if I get to building a full cockpit in enclosure 2.0 but I dont know until its all working

Top Post

Share this post


Link to post
Share on other sites

Warning LED Matrix 20180211 Update

Working on a matrix of warning lights to incorporate into the build. At this point im planing on having it 3D printed in the fablab reasonably cheap, I only have to pay for the filament I use. I want to spray paint the inside of the boxes white so the light reflects off all sides. 

N0oFmNk.png

pjgr4K9.png

This is the warning labels I will print off and have over the front, most likely laminated if it works well. I'm thinking about making them flash for the first 2-3 seconds when they turn on to catch your attention better  than just lighting up. 

2DzU7aK.png


Top Post

Share this post


Link to post
Share on other sites

Warning LED Matrix Completed 20180212 Update

Just finished the final touches on a warning light matrix,

I had the back section 3D printed and while I was looking at acrylic options for my final panels the guy at the store recommended this frosted clear acrylic to go over the top as a defuser.

XJBndxC.jpg

Regular LEDs weren't bright enough

I bought super bright LEDs from little bird electronics because they were a little cheaper than Jaycar and they squeeze perfectly into the holes, with a little bit of super glue to keep them in place.

I had paper for the labels originally but it was too grainy and while not even looking for another option my plastic store recommending the frosted acrylic and getting the labels printed on transparent sheets at office works.

6QPTer6.jpg

The plastic still didn't defuse enough and gave a centred focus light, so 1/8 of a cotten bud in each of the boxes absorbed enough of the light to make each section light up completely evenly.

It's unfortunate that I didn't notice till after glueing and soldering everything together that one or two of the lights are darker with a green tint but it's not too big of a deal. Using white means at this point I won't gave coloured warning lights but I actually love the final look.

giphy.gif

 

Top post

Edited by ohMorrissey

Share this post


Link to post
Share on other sites

Shift registers and PCBs Update 20180215

After making a speedsheer of all my IOs on my mega, I figured out I dont have enough pins for my build. (I know, running out of pins on a mega? How? Less than 60 Digital pins on the mega, more than 60 IO pins required for switches, joysticks, LEDs and LCD screens.)

Ive taught myself 99% of the build so far, shift registers couldnt be so hard?

After a decoder function, its fairly easy. So easy Ive actually decided to use shift registers on the back of every panel to reduce the wiring, Ill make PCBs like the one for the screen for every panel. I used a binary counter to test my warning matrix and it worked really well. 4 pins (3 for shift, one for extra IO) to control the whole matrix of 9 LEDs? You beauty

Top Post

Share this post


Link to post
Share on other sites

Final designs Update 20180216

The designs are somewhat final and ready to get laser cut,

They are all on a templated sized panel so I can interchange them as well making the build completely modular if I want to redesign the enclosure later (Hinting at a full seated simulator in the future maybe). The Red lines are going to be cut, all measured to fit all the switches and joysticks, the blue is going to be etched and coloured in with white paint.

faMdEsr.png

uuxmMAP.png

So because kerbal serialIO doesnt have the mode feature implemented yet, I thought id use a knob just above the attitude controls to swap between rotation and translation, but I also include a mode for fixed wing flight,

So that while landing a lander on a planet, the joystick x axis is for yaw you can switch to fixed wing and make the x axis roll. This gets around the one problem I hated about using a joystick for in KSP

Top Post

Share this post


Link to post
Share on other sites

Printed switch guard Update 20180222

Ever since I started, i've seen other use switch guards, some use evenly spaces U bolts to give that affect but I wanted to look close to the real deal, which are sold for about $20USD a pop plus shipping from America,. so I decided to 3D print them,

I designed them to slide over the switches and they have little grooves in the panel to slide into, so they can be discreetly hot glued in place from behind,

jHrRMwz.jpg

The end product looked really good even for a 3D printed finish, cost me $2.50 to print all four at the Adelaide FabLab, ~20mins printing time each

Top Post

Edited by ohMorrissey

Share this post


Link to post
Share on other sites

Final Laser Cut Panels 20180224

started looking at acrylics for my final panels, originally I was looking for a solid grey, but the only ones I could find were too light for my liking,

I found a frosted smoke colour that I loved and went to paint the back, the hardware store I went to didnt have white acrylic spray paint but suggested a self adhesive white laminate to do the same job. The splash back effect looks way better than I had hoped, the white text on the front casts a shadow on the splash back white of the back, 

The first attempt didn't work properly, the laser was set to cut 3mm acrylic, but (just a theory) the laminate on the under side absorbed too much of the energy which bowwed the sheet. so after a while the laser was out of focus but made for some cool fireworks, but didn't cut all the way through on 70% of the first cuts. ( as shown in the third photo)

rWX5r6m.jpg

aQ2PTVM.jpgvikuEkT.jpg

I just used a white paint pen and coloured over the etches, gave it 5 minutes to dry, then wiped the excess paint off with a paper towel and some isopropyl alcohol spray.

FwMQG8ng.jpg

I will post pictures of all the panels soon, with all components installed. These photos are from the first lot, the second has a few changes that Ill note.

Share this post


Link to post
Share on other sites

Enclosure 20180425

Busy life got in the way for a while but I am back on track for finishing the build, 

The enclosure was designed on Inventor like the rest of the panels, that way I can get the vector files for the laser cutter but this time I could also use the parts to make rendered assembly of both the enclosure and final product. The enclosure is made of 6mm MDF, laser cut and designed to fit together like a 3D puzzle. It worked better than I thought. 

ve20Yas.jpg

K1Zgrwa.jpg

g5zD0Os.jpg

 

As the edge left by the laser isnt perfectly straight, there are some gaps here and there, the execution wasn't perfect but still looks incredible. 
As I am trying to punch out the code before Uni gets really ramped up for the semester, it shouldn't be too long until this bad boy is working fully. Ill record a video of it working, I am thinking of starting a proper YouTube channel and start doing a lot more builds as we are building a big workshop on the new property. Possibly thinking an R2D2 next as it has been a dream since a kid. That might be a 2019 job as I am really knuckling down on study.

Top Post

Share this post


Link to post
Share on other sites

This is fantastic! I'd love to see a video of it in action.

I use RPM to make IVAs, but I've been really busy with life. This is inspiring me to get back to (Kerbal) work!

Share this post


Link to post
Share on other sites
On 4/29/2017 at 9:08 PM, ohMorrissey said:

For Rocket Use Only - 18/12/16
At my local electronics store I found this
<pic>
Thought it would be perfect for a stage and stage lock switch and a perfect place to start. And gave me the code name: for rocket use only.

 

71Gs-D2s5TL._SY355_.jpg

You need one of these to print out "ROCKET" to stick over "RACING". :sticktongue:

Share this post


Link to post
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.

Guest
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.