Jump to content

YAKK Mk 1 - Yet Another KSP Kontroller


MrOnak

Recommended Posts

So... yeah... another KSP hardware controller in-the-making thread.

at2mY35.jpg

You could split this project in three phases:

  1. USB Keyboard and Joystick to control KSP crafts manually
  2. An Apollo-style DSKY (display and keyboard) to retrieve information from KSP
  3. A flight computer that automates parts of the flight

Phase one - manual control

is done through a standalone circuitry that is recognized by the computer as a standard USB Human-interface-device (HID) and runs without drivers. It's based on an Atmel ATMega328p (the microcontroller on an Arduino) and the V-USB library. I'm aiming for a total of 6 analogue axis, digital joystick buttons and 56 keyboard keys.

The 6 analogue axis are

  • pitch
  • yaw
  • roll
  • throttle
  • lateral x
  • lateral y

Sadly the ATMega328p only has six analogue inputs so I can't implement the lateral z axis in an analogue way as well. A rocker switch will step in.

The circuitry for the USB HID is finished as of December 6th. It fully implements the joystick and all 56 keys. I've split the circuit up over two perfboards connected through an "expansion" port due to space constraints. The finished circuit looks like this:

3GtxYxN.jpg

For those interested, the schematics and the C code for the microcontroller are in my github repository.

Phase two - telemetry and status display

Instead of having tons of displays of some sort, each of which are predefined to display a single metric like liquid fuel, altitude and so on I wanted something more interactive. More specifically I wanted to be able to display only the information I need, at the time I need it, on only a few display segments. Basically I want to be able to tell the controller "display remaining liquid fuel on display X". The DSKY that was used during the Apollo program was a natural choice, really. Especially due to the quirky way to program the display and how it actually came to be like that - SO worthy of KSP - find the answer to the "What's the deal with "verbs" and "nouns"?" question here if you want to know more.

If you're unaware what the Apollo DSKY was I strongly suggest checking the Wikipedia article and if you really into that stuff, the Virtual Apollo Guidance Computer Project.

I'll use the KSPIO Plugin by Zitronen for communication with KSP.

Right now I'm about two thirds through with this phase - soldering the display of the 7-segments of the DSKY itself and the extended displays (7-segs, bar graphs, LED infolight panel) is complete, so is soldering the controll circuit that will drive the display panel through Zitronen's plugin. Programming the microcontroller to take the data provided by Zitronen's plugin and display what I want, where I want and when I want it, on the various display elements is left.

Javascript is disabled. View full album

Phase three - automatic guidance

This one is more in a concept stage at the moment. The basic idea is to implement algorithms to aid in automatic ascend, maneuver node execution, landing etc. I have a collection of scripts in kOS which work just fine but I think it'd be awesome if the DSKY part of the controller could actually be used in the sense of "load circularization program into the guidance computer", have it fetch a .hex file from a flash card and actually program a third circuit with a guidance computer which then will in turn asume control.

Naturally this phase comes last as everything else has to be ready before this can even be attempted. But one microcontroller programming another one is not a big deal so I guess I'll get to it eventually.

Final tally

Some numbers, for those of you that are curious:

Oh, total tally of this project:

  • over 100g of solder
  • 5 full perf boards
  • 37 7-segment digits
  • 30 LEDs for infolights
  • 3 bargraph displays
  • 2 ATMega328p microprocessors
  • 205 resistors
  • 63 electrolytic caps
  • 6 caps
  • 10 transistors
  • 31 ICs of various kind
  • way too many wire bridges and pin headers too count

Circuitry

For the brave of heart, here are two of the three circuit boards. Maybe maybe maybe I'll add the third circuitry and the board with all displays when everything is done.

What is left?

  • lots of wires to connect the various boards via pinheaders
  • more wires to connect switches to the boards
  • building the enclosure
  • bringing the various code bits into one cohesive whole

Edited by MrOnak
added circuitry
Link to comment
Share on other sites

is that a low pass filter on each button channel? i take it your handling denounce in hardware then (i normally matrix and do software debounce). and are those shift registers? 74hc165s <3

Edited by Nuke
Link to comment
Share on other sites

is that a low pass filter on each button channel? i take it your handling denounce in hardware then (i normally matrix and do software debounce). and are those shift registers? 74hc165s <3

Yeah that's a low pass on each button. the usual RC magic plus a Schmitt-Trigger for maximum smoothness ;). I know... overkill.

Link to comment
Share on other sites

Is this an arduino? if so is it UNO or MEGA?

Erm... kinda. The microcontrollers I'm using are the same ones that make up the "brain" of an Arduino Uno. But I'm not using the whole periphery that's on the arduino board, just the bare chip.

Link to comment
Share on other sites

Right, initially I wanted to build up the DSKY circuitry to light up all those LEDs but I didn't have time to finish the perfboard design from the EAGLE schematic so I sucked it up and did what I should have done a long long time ago... build the 24 button extension for MOAR BUTTONS erm for the USB Human-Interface-Device that I'm using to drive all inputs from the YAKK Mk I controller to KSP.

Javascript is disabled. View full album

Maybe maybe maybe there'll be more progress to write about tomorrow.

Link to comment
Share on other sites

  • 3 weeks later...

Small update: The extended front panel for the DSKY is ready:

F5Up3oKl.jpg

FRfCslHl.jpg

Man am I glad that one is done. Too many wire bridges to count (mostly hidden underneath the 7-segments)...

But I now have the display part of the "classic" Apollo DSKY ready (left half: PROG, VERB, NOUN with 2 digits each plus three rows of 5 digit displays).

On the right half of the board you see what I call the "extended DSKY" with 2x8 digit displays on the bottom, three bar graph displays in the middle plus 24 status lights on top.

All 5-digit and 8-digit 7-segment displays will be programmable to display anything that KSPIO has to offer, plus - when I get to it - additional information such as delta-V remaining, air pressure, time-to-touchdown etc which will have to be calculated.

The bar graphs again will be programmable to display anything where I can gather a percentage from what KSPIO gives me - fuel remaining in stage or total, electrical charge, monoprop, ...

With "programmable" I mean that during the mission in-game I'll be able to assign values to be displayed on each of these displays by entering the respective VERB/NOUN combination with the keys which will be below the display - see first post for a vector graphic.

The status lights will be used for all sorts of things from uplink confirmation, SAS, RCS, ..., indication lights for the left side panel such as error indication, PROG/VERB/NOUN indication, standby and reset indicators as well as warning lights (bottom row) for velocity, altitude, fuel, g-force and electric charge. The bottom row of status lights have one yellow and red LED each, i.e. set to 10% and 5% fuel warning.

Three of the indicator lights remain unused as of now, plus I do have two additional pins available in the schematic to add more but they are not wired yet.

The schematic for the final perf board (the one that will use Zitronen KSPIO plugin) is ready, I just need to find a day to make the sucker and then I can finally begin to assemble the whole thing :)

Link to comment
Share on other sites

With "programmable" I mean that during the mission in-game I'll be able to assign values to be displayed on each of these displays by entering the respective VERB/NOUN combination with the keys which will be below the display - see first post for a vector graphic.

You, Sir, are crazy. But the coolest kind of crazy! :cool:

Link to comment
Share on other sites

@stibbons: Thanks! Once I have the DSKY logic working on the ATMega (I got it working in my browser ;) ) I'll have it up for grabs on github.

@Hakan: Crazy was NASA which never rejected that ludicrous VERB/NOUN syntax which was pretty much invented on the fly for a public demo. ;) Seriously though, once I learned that NASA actually had that sort of mad--- erm no, kerbal-ness on board the Moon landers I had to have that in KSP ;).

And by the way it has a practical use as well since it severely reduced the number of 7-segments on my panel - but who cares about practicality in this game.

Link to comment
Share on other sites

its such a 1970s way of doing things. i attempted designing a video card from 7400 series logic and ultimately gave up and bought an fpga dev board. i still havent built that video card one way or the other.

Link to comment
Share on other sites

It is done :)

IcQujUcl.jpg

This is the last of the circuits that needed soldering. As you can see from the missing ICs, lots of functional testing still has to be done but electrical continuity tests suggest that I found all errors ;).

Time to fire up Zitronens plugin and get to work!

- - - Updated - - -

Also, updated the initial post with a new summary picture on top and a rough list of parts on the bottom.

Link to comment
Share on other sites

First (f)light!

5q9PEyv.jpg

Woot!

update

Explanation of the numbers:

left side, top to bottom:

"12" the "prog" (program) display, currently fixed

"34" the "verb" display, currently fixed

"56" the "noun" display, currently fixed

"00641" current orbital speed, working

"04332" seconds till apoapsis, working

"41210" altitude in meters, working

right side:

bar graphs:

left: fuel

middle: RCS, working

right: electricity, working

"00577226" altitude of apoapsis, working

"00037194" altitude of periapsis, working

Edited by MrOnak
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...