Jump to content

T.A.P.O.R. KSP SimPit Oddyssey


T.A.P.O.R.

Recommended Posts

This is the first step in building my own KSP custom control rig.

While I am no stranger to electronics, I am not a professional and the closest thing I've done in terms of "code"

is a bit of HTML & Javascript back in the early 2000's and writing Macro's in Excel.

Not exactly applicable, but hopefully that experience assists with debugging.

I've got my prototype up & running with a few switches and LEDs embdded into a scrap of MDF.

The rectangular holes were done with a coping saw & tidied up with a chisel.

To make testing various things easier, I've wired up a basic shield, so that I can unplug my control panel quickly and transfer between the UNO & Leonardo.

Initial BOM

  • A bunch of SPDT switches
  • Cheap 7 Segment LED modules
  • 1 x Arduino UNO
  • 1 x Adruino Leonardo
  • 1 x LCD shield
  • 20 x chrome LED bezels.

IMG_0391.JPG

As is plainly obvious in the first gif, it didn't work very well when trying to debug on my own.

8segLed.gif

As you can see in gif #2, that has now been fixed, thanks to this thread and AmeliaEatYaheart for the solution below.

output_rwboDL.gif

Note: these displays are wired serially and did not suffer from the overheating problem present in K4TEE and AmeliaEatYaheart's 7 Seg modules.

With some PM help from AmeliaEatyaHeart I managed to get my 7 Seg LED Displays and my controls working!

Here's the fix:

Tab: KSPIODemo10



#include <LedControl.h>

#define LEDClkPin 4
#define LEDChipSel 3
#define LEDDatain 2
//these pins were set up for an Arduino Uno, adjust as appropriate.

LedControl lc=LedControl(LEDDatain,LEDClkPin,LEDChipSel,2);//1==num of 8x8pixel arrays in line. can be up to 8.


void setup()
{ Serial.begin(38400);

[B]LedControl lc=LedControl(LEDDatain,LEDClkPin,LEDChipSel,2); //number of displays is the last variable, will be 1-8.
blankLEDscreens(); //initialise screen, and show display number examples.[/B]

initLEDS();
InitTxPackets();
controlsInit();

LEDSAllOff();
}

void loop()
{
input();
output();
}

Tab: Utilities


{
[B]printNumLED(0, (long)(VData.AP), 'A', 3);//will display apoapsis, with the decimal point separating km and m.
printNumLED(1, (long)(VData.RAlt), 'B', 3);//will display Radar Alt in same format.[/B]

caution = 0;
warning = 0;

caution += VData.G > GCAUTION;
warning += VData.G > GWARN;
caution += VData.LiquidFuelS/VData.LiquidFuelTotS*100 < FUELCAUTION;
warning += VData.LiquidFuelS/VData.LiquidFuelTotS*100 < FUELWARN;

if (caution != 0)
digitalWrite(YLED,HIGH);
else
digitalWrite(YLED,LOW);

if (warning != 0)
digitalWrite(RLED,HIGH);
else
digitalWrite(RLED,LOW);

digitalWrite(SASLED,ControlStatus(AGSAS));
digitalWrite(RCSLED,ControlStatus(AGRCS));
digitalWrite(CG1LED,ControlStatus(AGCustom01));

}
void Indicators() 

Don't forget to include AmeliaEatYaheart's LedControlFunctions tab from this sketch.

Tab Utilities


{ analogWrite(VUAPIN, round(VData.LiquidFuelS/VData.LiquidFuelTotS*250));
analogWrite(VUBPIN, round(VData.LiquidFuel/VData.LiquidFuelTot*250));
}

I've been considering a few options as I've collected a lot of stuff over the years.

Do I go a small SimPit with basic controls, repurpose an old faceplate from an unknown device or re-purpose a vintage gaming console?

IMG_0396.JPGIMG_0400.JPG

4_VeiKvph8rxXBUCQNL2OqFDp9C3yuocFI6lYvylKnI=w613-h264-noIMG_0395.JPG

Edited by T.A.P.O.R.
Link to comment
Share on other sites

Small update, I've expanded my prototype with VU's from some old audio console & a non-backlit LCD (and lots of hot glue).

Neither are connected at the moment as I've run out of pins on the arduino & am trying to get my head around shift registers.

I've ordered a mega2650 (just in case I can't figure out shift registers) and some different displays.

IMG_0406.JPG

Link to comment
Share on other sites

Thanks Stibbons,

I couldn't in good conscience chop up the Atari (I don't even know if it works).

This proto-panel is the result of no planning whatsoever.

When I bought the big red button, I didn't realise that the switching mechanism would protrude quite so far out the back.

Hence the unused space toward the front.

Another thing that I hadn't anticipated was the toggle switch covers make it harder to see the switch position.

On my next Proto, I'll probably split it into two parts:

a horizontal control board to sit behind the keyboard & under the monitor

a vertical display board to sit adjacent to the monitor, for a more heads-up approach.

IMG_0390.JPG

IMG_0410.JPG

IMG_0411.JPG

IMG_0407.JPG

IMG_0408.JPG

Link to comment
Share on other sites

Wow, man! Nice work. I wish I had the knowledge in electronics and coding to build one of these. Guess I'll just have to stick to Ye Olde Keyboard.

Hi Gmack85,

You can get a simple simpit going for under $20 and with no soldering.

I did my first altimeter with an Arduino Leonardo & a 1602 LCD Shield, simply plug in the shield to the Arduino, and the Arduino to your compute.

Then add a little code to Zitronen's Sketch & you're in business :)

KSPIO%2BLCD%2BShield%2BAltimeter.JPG


[B]//This goes at the top of tab one

[/B]#include <LiquidCrystal.h>
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

[B]//This goes down the bottom of tab one

[/B]void setup(){
Serial.begin(38400);


// initLEDS();
// InitTxPackets();
// controlsInit();


// LEDSAllOff();

// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.setCursor(0,0);
lcd.print("GForce ");
lcd.setCursor(0,1);
lcd.print("RAlt ");

}


void loop()
{
input();
output();

lcd.setCursor(8,0);
lcd.print(VData.G);
lcd.setCursor(6,1);
lcd.print(VData.RAlt);

}

Link to comment
Share on other sites

And don't forget the simplest option for custom inputs - pull apart a keyboard and wire new switches in to it. :)

And remember, don't do what I did and tear the trace off the board in the process of learning the pinouts:(

Not a big deal really, but Arduino is a fair bit easier than the board I tried.

The guts were just two pieces of plastic with circuits printed on them.

Link to comment
Share on other sites

And remember, don't do what I did and tear the trace off the board in the process of learning the pinouts:(

Not a big deal really, but Arduino is a fair bit easier than the board I tried.

The guts were just two pieces of plastic with circuits printed on them.

If it's not too bad you can solder them back on. Or retrace them in solder

Link to comment
Share on other sites

If it's not too bad you can solder them back on. Or retrace them in solder

Oh no, I did a very good job of messing up the PCB.

I've got a stack of old keyboards, but then I found Arduino for cheap on the wide wide world of web ;)

Hej T.A.P.O.R! Awesome work!

Where did you get the analog volt gauges, and what sensitivity are they? Can they be opened and replace the backing-cards?

Thanks Mazubus,

If only you could see it in meat space, it's not very impressive.

Even if it does have a strut made from MDF & melted plastic :D

The analogue gauges came to me in a box of junk (stuff for recycling) from a guy who runs a synth building club.

There are two transparent panels in the middle of the two VU's that make me think it might have been pulled from an old tape deck, or maybe reel to reel.

From the looks of the light mount behind them, it predates LED's. There are no markings as to what it was actually a part of though.

I don't know the voltages, but I think they're about 3v as a couple of AA's can max them out.

They can be easily opened and the backing cards can be replaced (just tried this now), in fact they were held together by sticky tape & the pressure of the screws holding them to the old panel.

USgl82nz1bwDG0WmEU86ugoq2uhPt7vKMOtxAeQOiQo=w600-h450

There's a hipster 2nd hand dealer on the other side of town that has awesome vintage test & radio gear, but its really expensive.

Oh how I would like to have them as part of my KSP rig!

**corrected typo

Edited by T.A.P.O.R.
Link to comment
Share on other sites

I have been looking for some round VU meters in the 3.3 to 5v range, but had no luck in finding any that I can change the back card. :/ At least I have my OLED solution now. I think I will make a digital needle like meter or something akin to airbus or boeing instruments.

Link to comment
Share on other sites

In had a hunt about on the internet for a round VU with removable innards, but didn't have any luck either.

What I did find was a pair of 20 segment 3 coloured led bar graphs.

These will come in handing for one thing or another.

I've managed to get LEDs to go on my shift register, but getting an LCD to work?

Nope.

I've tried heaps of options, even went back to the regular way of driving an LCD to make sure I hadn't broken anything and it was fine, something I'm doing wrong :'(

Link to comment
Share on other sites

H marzubus,

I have two, one was off the shelf at a local electronics supplier and another made by Optrex that was in my box of junk.

They both have the same pin designations.

I've tried this example and others that are similar, but all I get are a series of rectangles on the LCD.

No matter, Ihave a 4 x 20 screen coming with an i2c adapter to minimise the amount of pins required, and my Mega should be here tomorrow, so I'll have pins galore :)

Link to comment
Share on other sites

I try to stick to lcd modules which are supported by u8glib, and I believe you can have a custom communications procedure for the custom defined modules.

See https://code.google.com/p/u8glib/wiki/devicedesign

Might be worth a try if ur module is supported. that said, I've never tried. ;)

Yeah all those mega pins!!! There area couple of really nice lcd modules on aliexpress! It's super easy if u find one that has the same chip as u8glib supports!

Link to comment
Share on other sites

The mega has arrived!

too bad I have to wait all day before I can go home and play.

I shall checkout that store as I've not used it before. Thanks for the tip!

** Transplanted pins from the UNO to the Mega and uploaded the same sketch.

It works perfectly.

I'll need to reassign the pins in order to free up the PWM functions for my VU's

But as far as LCDs, LEDs & switches go, I'm all set and don't need to mess about with hard stuff like shift registers for the time being.

That brings me to another piont.

Do I need all the Action Groups on the board, when I can do them all on my flight stick?

I think yes.

Edited by T.A.P.O.R.
Link to comment
Share on other sites

LCD Works, Analogue VU kinda works...

I have 10k reistor in series.

I've placed this:

analogWrite(VUAPIN, round(VData.LiquidFuelS*255/100));

in "Void Indicators" and it appears to sit at roughly the right value.

But as I burn, it goes to zero fairly quickly then springs to the dial maximum and repeats down to zero until the fuel is depleted.

Is this just a case of needing a higher value resistor, or am I missing something?

I don't know the spec of my VU's as they're out of an old machine and have no markings that are of any use.

Link to comment
Share on other sites

I guess u could push 3.0v to the VU and see if it reads max. Else have you got a stable power supply? One with lcd screen and all. Try ramp it up to determine the actual max voltage. Carefully though.

Ur using a 5v Arduino right? So ur pushing 5v to that thing at peak I guess. Else maybe a cap or something to smooth out sudden shifts in value? I'm just guessing here. ;)

LCD Works, Analogue VU kinda works...

I have 10k reistor in series.

I've placed this:

analogWrite(VUAPIN, round(VData.LiquidFuelS*255/100));

in "Void Indicators" and it appears to sit at roughly the right value.

But as I burn, it goes to zero fairly quickly then springs to the dial maximum and repeats down to zero until the fuel is depleted.

Is this just a case of needing a higher value resistor, or am I missing something?

I don't know the spec of my VU's as they're out of an old machine and have no markings that are of any use.

Link to comment
Share on other sites

Yep, just powering off the usb at the moment.

I've got a regulator kit (1.5-12v)in my workshop(I ARDUINO in the dining room/office), so I'll try that when I get home.

I will also post another gif showing the weirdness, for posterity.

In other news my oled arrived, it's so small!

I laughed when I pulled it out of the bag, as it's about twice the with of my thumbnail.

Link to comment
Share on other sites

It's so hard with all these secondary workspaces. ;) what oled did u buy?

Yep, just powering off the usb at the moment.

I've got a regulator kit (1.5-12v)in my workshop(I ARDUINO in the dining room/office), so I'll try that when I get home.

I will also post another gif showing the weirdness, for posterity.

In other news my oled arrived, it's so small!

I laughed when I pulled it out of the bag, as it's about twice the with of my thumbnail.

Link to comment
Share on other sites

Ok, looks like the VU maxes out at 0.8v

I fixed the weird cycling issue by changing my code and added 11k of resistance in series.


{
analogWrite(VUAPIN, round(VData.LiquidFuelS/VData.LiquidFuelTotS*250));
analogWrite(VUBPIN, round(VData.LiquidFuel/VData.LiquidFuelTot*250));
}

Now I'm getting a weird staging bug when I engage SAS, but it only happens for the first stage.:confused:

Nope, nothing wrong with the code, but possibly my eyesight.

My stage button is set to 10, but I'd plugged it into 13!

This somehow (I don't have the foggiest) enabled SAS to stage.

Now for a shaky test video!

Edited by T.A.P.O.R.
Link to comment
Share on other sites

It's so hard with all these secondary workspaces. ;) what oled did u buy?

Yeah I guess....The dining room is also my office and the workshoppe is kinda crummy, but I built it myself (so I can only blame one person for the crumminess).

OLED Specs:

SPI Interface

Driver IC: SSD1306Pin Definitions:

VCC:3.3-5V

GND: grounding

CLK: clock module

MOSI: Data input

Cs: Chip select signal

D/C: Command / data change

Here's some perspective that I was missing from your OLED pic, though I guess the USB plug should have been a bit of a giveaway.

I had thought it would be about the size of the Nokia 5110 display below.

IMG_0416.JPG

85Zos3gSz8cMQfrokEYjykFKw88uyAmXkjT6Tdd0KTc=w540-h551-no

Thanks for your explanation of your OLED code by the way, I didn't understand a word of it, but I tried reading before my morning coffee.

Link to comment
Share on other sites

Hi! Yeah that's the same oled driver. Sorry I didn't clarify its size. My plan with these was to emulate a single analog style VU each. I bought six of them because I got them cheap.

You should be able to use my code as is for that particular display. Is it the monochrome or 2 color version?

I am still shopping for a display double that size. If u find any other well priced ones, just check if the chip is mentioned in the u8glib drivers wiki.

Link to comment
Share on other sites

I don't mind, it was cheap :)

yellow/blue

There is one rgb OLED that I found that is about $50aud (way overpriced IMO) and a teensie bit bigger than the ones we have.

"Active display area 28.8 x 26.8 mm, (1.5 inch diagonal) "

XC4270gallery1-300Wx300H?context=bWFzdGVyfGltYWdlc3w3ODk0NXxpbWFnZS9qcGVnfGltYWdlcy9oOTcvaDkwLzg4MTU2MzUyMDIwNzguanBnfDQ2YjA5ZTNlNTZiZTJkMDE3MGEwYzMzYTQyNjliZmQ3MmQ5MmQyYTFlYmIyOTA3YWM2M2IwYWU0NjdlZDFiM2Q

Edited by T.A.P.O.R.
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.

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.

×
×
  • Create New...