Jump to content

Custom hardware / simpit repository. For people who take KSP a little too far.


Mulbin

Recommended Posts

Looking forward to it!

A note on the schematic: I made the eagle file after finishing the soldering on mine. (I always solder from pencil drawings, don't ask). Basically don't follow the schematic blindly, it might contain errors like having the ISP header pins flipped around one axis, a missing ground terminal or stuff like that - nothing that isn't obvious if you think about it though. The schematic will definitely give you an idea how to put it all together and how to multiplex all the inputs.

But like I said, the hardware part is not very complicated and not strict at all, you can come up with many different circuits more tailored to your personal needs.

Link to comment
Share on other sites

The final bits and pieces just arrived, I can finally build the enclosure for this:

board_commented.jpg

Disclaimer: Of course, the last bits arrive just in time for me signing up for a remote contract :(. Sundays is all I have in the workshop... this might still take a few weeks. Meh... Anyhow, if I get it done before KSP goes 1.0 I'm golden ;)

Link to comment
Share on other sites

  MrOnak said:
@Mulbin: Somewhere in the thread you mentioned using water slide decals for your ...well... decals. Are those the empty sheets for use with an inkjet printer or something different?

I'm asking since I have a bit of trouble finding something affordable that works with a laser printer and I really need some decals for my DSKY setup that's coming up.

Thanks a lot :)

Sorry, haven't checked in for a while (new baby), yes I used water slide transfer sheets in an injet. You can get them for laser printers too, they are actually easier to use with a laser printer as you don't need to spray varnish them to stop the ink running.

Search ebay or amazon for laser water slide transfer paper.

Hope this helps!

In other news will hopefully be moving house in the spring so should finally have room for a cockpit!

Link to comment
Share on other sites

  Mulbin said:
Sorry, haven't checked in for a while (new baby), yes I used water slide transfer sheets in an injet. You can get them for laser printers too, they are actually easier to use with a laser printer as you don't need to spray varnish them to stop the ink running.

Search ebay or amazon for laser water slide transfer paper.

Hope this helps!

In other news will hopefully be moving house in the spring so should finally have room for a cockpit!

Thanks Mulbin and gratulations on the newborn :).

I'm a bit shocked as to how pricey the water slide decals are actually, hence my question. But I guess I'll bite the bullet eventually. Thanks for the pointers :)

Link to comment
Share on other sites

  • 2 weeks later...
  AmeliaEatyaheart said:
By the way MrOnak, I love that circuit board you cooked up, you're a lot more patient than I am! :)

May I assume all those numbered caps are for button de-bouncing?

You're right, that'd be 36 RC-filters plus Schmitt-Triggers, 32 of which are piping the debounced signals into 74165 Shift-Registers so that I can read all that with only four pins on the Atmel. The remaining four are connected directly to the Atmel chip and act as digital joystick buttons. I must say I find soldering quite meditative so I really didn't mind making that board.

In case you didn't see it, the circuitry and code for that is available on GitHub: https://github.com/MrOnak/avr_usbhid_gamepanel

PLEASE read the readme before you send the eagle file to a PCB fab though, since I didn't use it to make my circuitry I can't guarantee that it is error-free.

Edited by MrOnak
Link to comment
Share on other sites

  AmeliaEatyaheart said:
The control panel will also flicker and (mostly) die if ElectricCharge runs dry...

It's looking great so far and I really love this idea and will probably borrow it. :)

Have you considered changing the staging and RCS lights when you run out of fuel/monoprop?

Link to comment
Share on other sites

hi guyz,

as it is already mid-november, I decided to write my letter to Santa (who said I was almost 30? :confused:). having seen what you guys have made, I think I will order a couple of electronic component.

this would be I think a cool little project to occupy winter time, and since I recently manage to fix my faulty joystick with a bit of soldering i feel like a god of electonic:cool:

so to keep this momentum going I gathered information on which type of components I should use and draw a couple of sketches, look here and there on the internet and a since I have no experience in such field some questions came up.

so Far I have settled on a desing with a 3 axis joystick, maybe a second, a couple of push buttons for action groups and a bunch of different toggle. Momentary switches as well as on/off switches.

First comes the question of the interface. I think I will go for the LeoBodnar Bu0836x as it seems simple to connect (no matrix wiring and stuff) and is well known in the "simpit commity". and as I understood it comes with a simple sofware.

push buttons should not be a problem but I have some questions about switches. Knowing how KSP works, I wonder what type of switches I should Get.

If I want to hook up SAS on a toggle for instance, what kind of switch shoud it be? SPST or SPDT?

SPST should be ok when I switch it on, but what about when I want to turn it off? Is the board able to turn it off in KSP? or should I get a SPDT switch, but the how should I wire it?

the is my main concern at the moment, but I sure will have more coming:)

but be sure I will show you how it goes

Link to comment
Share on other sites

  psychopoak said:
push buttons should not be a problem but I have some questions about switches. Knowing how KSP works, I wonder what type of switches I should Get.

If I want to hook up SAS on a toggle for instance, what kind of switch shoud it be? SPST or SPDT?

SPST should be ok when I switch it on, but what about when I want to turn it off? Is the board able to turn it off in KSP? or should I get a SPDT switch, but the how should I wire it?

the is my main concern at the moment, but I sure will have more coming:)

First off: I'm no expert on the full capabilities of Leo Bodnar's (or any similar) device.

I recon to use KSPs SAS toggle (default "T" Button) functionality you might need to use a SPDT toggle that is wired to two inputs that each emulate the same button. I don't think the Bu0836x is capable of doing so.

If it is a break-before-make type SPDT you could get away with wiring both circuits to the same pin. Glitches might occur if sampling is not fast enough... Additional circuitry could compensate.

If you use KSPs "hold to invert SAS" (default "F" Button) functionality you will get away with a SPST switch on a single input. Additional circuitry needed if you then want the "hold to invert" button too.

I did consider using the Bu0836x myself, but it seemed just too limited. Pokeys 56U is a more versatile alternative. It can be configured to emulate seperate button presses on press AND depress of one actual HW button (triggered mapping).

It also has output capabilities and supports matrix wiring, wich I consider essential. Otherwise you'll end up buying another 50$ device - that needs another usb connection - if you want any kind of output or more than 32 buttons.

Anyway, me personally, I'm going to use an Arduino Mega2560. It can do anything needed I/O wise and there is Zitronens plugin to get started with.

Edited by One Wheeled Panda
Link to comment
Share on other sites

that's a good advice. SPDT it will be then. And if I understand it correctly, SPDT could be use as a SPST if I don't wire one of the side pole, right?

BTW even if it does not work properly, it was not a huge loss as I grabbed 10 of then for litteraly a couple of bucks.

but you brought an other good point with the Pokey board. I think I will stick to leobodnar as I am not really that ambitious at the moment, and it seems pretty "straight out of box". Matrix wiring seems to me a bit confusing at the moment, but who knows what I will end up doing... ;)

at the moment a few components are on their way : 3 axis joystick, SPDT switches and buttons. I am looking for a slider to put throttle on it but I can't decide which length I should go for. Precision-wise, the longer the better. a friend of mine even suggested motorized slider, but that seems a bit complicated to manage. I will have to get input from the game to the pot and I have no idea how to make it. I suppose I will need a different/second board to hook everything up, but that means a lot more trouble.

I hear a lot about Arduino stuff, but seems to require programmation knowledge and I have none ^^

while parts are shipping, I should grab a piece of paper and a pen to sketch it all up.

anyway thanks already for your suggestions

Link to comment
Share on other sites

All of my toggle switches are SPST you only need a simple on/off switch if using an Arduino and Zitronen's plugin.

There are other alternatives to using Arduino, as you describe but you will run into many problems when your switch positions go out of sync with the game every time you load, dock or change vessel.

Let me explain:

In spaceship 1 you flip your SAS switch to "ON" and the SAS turns on.

You then switch to spaceship 2.

Spaceship 2 has its SAS off.... but your switch is still set to "ON". Your switch is now out of sync and does the opposite of what it says.

I knew nothing about Arduino or any type of programming before starting this project, I now know it is completely essential for a complex board. Zitronen has done 99% of the programming for you and the plugin will constantly communicate with KSP so when switching to a new ship it looks at your switch positions and sets the new ship up accordingly. This is the only way you can 100% rely on your switches.

Adding a line for a simple toggle switch is super easy and you'll get plenty of help on the plugin thread.

Not to mention the fact it also sends data the other way for reliable working dials and gauges!

Link to comment
Share on other sites

ok now I see why Arduino board would make more sense. As I am totally new to this world, my knowledge is pretty limited and Zitronen seems to have done all the work that I would need. not to mention more support than for the Leobodnar one, and directly aimed to ksp though.

I will have a look at this over the next days, but that seems to be a nice idea.

Link to comment
Share on other sites

I'd recommend at least for your first project just buying a generic Arduino clone as they are much cheaper than the official Italian made ones and work exactly the same and use the official software. They are made from cheaper components though so may not last as many years but they are great for beginners. All my boards are clones.

Have a look through ebay, for a relatively small project you could go for an Arduino UNO or if you want loads of switches you could try the Arduino Mega. Perfectly good clones available of both.

Here's an example... expect to pay less than $10 for an unofficial clone board.

http://www.ebay.co.uk/itm/UNO-R3-ATmega328P-Development-Board-For-Arduino-Compatible-USB-Cable-NEW-/201206991263?pt=LH_DefaultDomain_0&hash=item2ed8df099f

Link to comment
Share on other sites

You can also search ebay for starter kits, I generally buy a kit when I get a new card as it's a great way to stock up on cheap components that you might need.

Like this...

http://www.ebay.co.uk/itm/Sintron-Light-Starter-Kit-for-Arduino-AVR-learner-UNO-R3-Board-PDF-Files-/181159755808?pt=LH_DefaultDomain_0&hash=item2a2df68020

But have a good browse and look for one that suits you.

Link to comment
Share on other sites

A little tip I figured out while doing this stuff in FSX:

You can do all the inputs that only require momentary button actuation by buying a cheap USB keyboard and gutting it.

You can break out the row/ column buses to a perfboard and jump in momentary switches with a diode to simulate keypresses with momentary switches.

You can add support for dpdt toggles by using pullups and a few easy logic gates. I'll root around and see if I still have the scats around...

*edit* Took some doing, but I found it.

keyboardhack_zps6dbcda34.jpg

The circuitry can actually be simplified since KSP doesn't natively use complex keypresses like FSX does.

Theory of operation:

The resistor on the switch input is a pullup, placing a logic high so long as the switch is open. The logic high holds the single shot circuit (NAND, R/C, and NOT) in a low preset state with a high output. This keeps the NOR gate open, isolating the scanning row input from the column output.

Upon closing the switch, the NAND outputs a logic high , which triggers the RC circuit to bleed off to 0 in about 1 Msec. While that output is high, the NOT inverts it to a low. the NOR conducts the scanning row input to the column output, simulating a key press. Each key press is simulated through 2 of a total of 6 diodes, thus reproducing up to 3 simultaneous keypresses. 1 pair is reserved for CTRL, 1 pair for SHIFT, and the last is for the unique character.

Once the RC circuit has depleted, the output of the NOT is latched high, thus opening the NOR gate and disconnecting the scanning input from the output. This is it's stable "discharge" state.

When the switch is opened, the single shot is reverted to it's preset state, keeping the NOR open.

Since each "cell" contains 4 NANDs, 4 NORs, but 6 NOTs, there are 2 unused NOT gates in each gang. They can be used (if desired) to invert the action of 2 single- shots so that they cycle on their parent switches being opened instead of closed, thus generating 2 unique keypresses for a single switch depending on whether it's being opened or closed at the time.

The opposite side does away with the single- shot circuitry, simply connecting up to 3 row/ column connections each when a momentary switch is closed.

All the diodes are necessary in order to avoid "ghosting"; the phantom appearance of multiple keypresses being generated due to the closing of multiple nodes that make it appear as if you've made a connection that you didn't.

For KSP all the diodes are unnecessary when using the active circuitry. You can directly connect the desired row to the input of the NOR and the desired column to the output.

Best,

-Slashy

Edited by GoSlash27
Link to comment
Share on other sites

  psychopoak said:

push buttons should not be a problem but I have some questions about switches. Knowing how KSP works, I wonder what type of switches I should Get.

If I want to hook up SAS on a toggle for instance, what kind of switch shoud it be? SPST or SPDT?

SPST should be ok when I switch it on, but what about when I want to turn it off? Is the board able to turn it off in KSP? or should I get a SPDT switch, but the how should I wire it?

Honestly, what sort of switch will depend more on what software is sitting in between your switch panel and the computer interface for KSP. ST or DT is not a huge issue, I usually get DT switches just in case I want to modify my wiring later, but the important bit is whether they are latching or momentary. If you're using zitronen's code / arduino, and just modifying the code that he wrote, I'd recommend latching switches for RCS and SAS; same for most control groups if you use those as well :)

if you're proficient with code, but hardware is new, momentary switches can be more versatile though. Just remember, wire switches between Ground (-0V) and the desired input pin, and you code will be testing for input low, not high.

Example:


#define SASpin 4

void setup()
{
pinMode(SASpin, INPUT_PULLUP);//if no actual button connected, then staging will not misfire.
//... more code
}

//output tests:

if (digitalRead(SASpin)==LOW) //inputs are active low
MainControls(SAS, HIGH);
else
MainControls(SAS, LOW);

//...more code

Hope that gives you an idea of how to make the things work :)

Link to comment
Share on other sites

  stibbons said:
It's looking great so far and I really love this idea and will probably borrow it. :)

Have you considered changing the staging and RCS lights when you run out of fuel/monoprop?

Feel free to borrow as you please; it's great to be able to borrow and share ideas, it's how we all learn from eachother :)

I had not considered messing with the RCS light when out of monoprop, that's an excellent idea! :D i might add my flickering light code but get it to read monoprop instead of electric charge...

As for the staging light, it will only light up if the stage lock safety switch is armed - I wanted it to retain that feel of being under manual control at all times. It's one of the few buttons that still work if the 'ship' runs out of power as well :) I may add a red LED for zero stage fuel remaining, but that won't work for asparagus type staging.

(Though in all honesty... I did briefly consider auto-staging once the stage is out of fuel, but then I felt like it'd be like flying an autopilot)

Link to comment
Share on other sites

  AmeliaEatyaheart said:
I may add a red LED for zero stage fuel remaining, but that won't work for asparagus type staging.

I've got an RGB LED that's changing colour based on stage fuel, with flashing red when it's out. And you're right, asparagus staging throws off the stage calcs somewhat. Still useful for upper stages though!

  Quote
(Though in all honesty... I did briefly consider auto-staging once the stage is out of fuel, but then I felt like it'd be like flying an autopilot)

Hey, if it's an autopilot that you've build and programmed yourself it's totally legit! Especially if you're able to solve the asparagus thing neatly. Maybe by watching for sudden deceleration changes... argh stop making me want to implement this!

Link to comment
Share on other sites

  stibbons said:
Hey, if it's an autopilot that you've build and programmed yourself it's totally legit! Especially if you're able to solve the asparagus thing neatly. Maybe by watching for sudden deceleration changes... argh stop making me want to implement this!

What's working really reliably for staging in kOS at least is to trigger staging on sudden changes in fuel consumption.

Of course kOS has the advantage that it is either kOS or you that is handling the throttle but that doesn't really make things more complicated, the controller just has to watch "throttleVal * fuelConsumption" (asuming throttle is within 0 and 1) to calculate the value to watch.

Link to comment
Share on other sites

Oh, I never said autopilot was't legit, just that I didn't want flight to be controlled.

Also, you do realise that the navball values as well as G-forces (or, as MrOnak suggests, fuel consumption) are sent through the plugin? ;):D

Tell me, how do you calculate a flight / gravity turn as a function of speed and altitude?? /giggles

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