Jump to content

It's time to science! (Custom controller build... I hope)


Duke23

Recommended Posts

Okay, so I'm deep enough in the money pit that I have to actually "do" something now. I've been contemplating the idea of building my own custom controller for KSP or any game really. I don't have a clue what I'm doing as far as the Arduino Due clone I bought, but I have a (very) small amount of knowledge in programming (VB.Net to be specific) and basic electrical systems. This thread is just a general project thread that will hopefully continue past the first post. I put it in this forum because I wasn't sure it was entirely KSP specific at this moment but it eventually will be, I think.

First was the microcontroller itself. Right now it's in a configuration for a test sketch I was running... Basically what it does is I give it input over SerialUSB and it forces the 'virtual keyboard' to type it back to me, with a short pause and a blink of the LED for each character. Simple, but you have to start somewhere.

20140702_152854.jpg~original

Next is the fact that I don't feel like spending a bunch of money on a 3 axis joystick plus potentiometers and such for my testing phase, without knowing how far I'm actually going to go with this. Next best thing, and a learning experience in the process? Cannibalizing an old RC helicopter remote for some pieces so I can nail down the concepts here.

20140702_152728.jpg~original

One problem... The cheap-o 15w soldering iron I bought (once again, I don't know what I'm doing here!) doesn't get hot enough to actually do anything useful, much less desolder anything. I managed to get some of the excess off but it's still holding on pretty tight. So I went to Radio Shack today to buy a 40-60w plug in soldering iron, but I accidentally the whole store. I walked out with about $80 worth of stuff, although the $30 IR Thermometer isn't entirely related to this project (it's just really cool... err, I mean useful for diagnosing computer and car problems and generally knowing the temperature of things). I ordered the helping hands online along with the solder pump and wick, and the first (red) battery operated soldering iron. So much for not spending a bunch of money.

20140702_152019.jpg~original

And here's the rest of my arsenal:

20140702_154400.jpg~original

So my first order of business will be to get some of these useful components off of the remote and wire something up to accept joystick inputs. Or something similar. I'm debating whether I'll try to use Zitronen's plugin to make it act like a "real" joystick (I haven't even looked at the plugin yet, so that's another rabbit hole altogether), or just start by manually calibrating a threshold at which it will emulate a keypress (WASD). By the time this is said and done I definitely want it to act like a real joystick to fine tune everything, possibly with a custom precision mode wired to a switch assuming that's possible.

Goals for this project:

-Learn how to use an Arduino. I might be a little in over my head with the Due, I bought that one against my better judgement and the advice of pretty much anyone who has ever used one, as they aren't very beginner friendly. What can I say, I'm hard headed and I wanted the extra pins. Luckily I'm usually pretty good at "figuring stuff out."

-Learn how to use an Arduino properly. I can't state enough that I'm not entirely sure what I just got myself into.

-Learn electronics. Most of my electrical knowledge is from 12v automotive related stuff and a tiny bit of 110v house wiring.

-Prove to myself that I can do it.

-Bring a new sense of enjoyment to playing my favorite sandbox game.

-Joysticks for ship control and camera rotation, possibly one for RCS alone. Preferably 3-axis to avoid clutter, and possibly a "4 axis" (hardware button) for SAS or precision mode toggle on the main stick.

-Buttons or switches for RCS, SAS, stage control, view control (staging, map, IVA, etc), gear, lights, brakes, precision mode, pot slider or knob for throttle, a few actions groups, ?????

-LCD display for time to x (maneuver node, AP, PE), altitude, relative speed, vertical speed, stage fuel levels, ????? (some of these may end up being analog meters)

As you can see I'm still wrapping my head around all this. Any input, suggestions, comments, questions, etc are welcome and encouraged. I'll post updates here as I go, but I'm not going to promise anyone including myself any sort of specific schedule, and I hope it won't be considered a necro to update my own thread if I fall behind a bit.

Link to comment
Share on other sites

"It's time to science!"

*SCCCCCCCCCCCCCCCCCCCCCCCCCIIIIIIIIIIIIIIIIIIIIIIIEEEEEEEEEEEEEEEEEEEEEEEENNNNNNNNNNNNNNNNNNNNNNNCCCCCCCCCCCCCCCCCCCCEEEEEEEEEEEEEEE

Anyways corrections aside are you considering:

- This controller's equivalent of an X key? Shutting down the the engines with one button press?

- The opposite of that?

- A meters per second counter or/and an altimeter?

- A form of Nav-ball?

Link to comment
Share on other sites

"It's time to science!"

*SCCCCCCCCCCCCCCCCCCCCCCCCCIIIIIIIIIIIIIIIIIIIIIIIEEEEEEEEEEEEEEEEEEEEEEEENNNNNNNNNNNNNNNNNNNNNNNCCCCCCCCCCCCCCCCCCCCEEEEEEEEEEEEEEE

Anyways corrections aside are you considering:

- This controller's equivalent of an X key? Shutting down the the engines with one button press?

- The opposite of that?

- A meters per second counter or/and an altimeter?

- A form of Nav-ball?

I thought the potentiometer slider or knob might negate the need for the 100% / 0% throttle buttons, but that's before I see how fast it will respond in game. If it's anywhere near as slow as using shift and control then yes, I do plan to include those at some point.

I mentioned altitude, vertical and relative speed but the better option would be to make the relative speed toggle between orbit, surface, and relative. Of course I don't know how to actually implement any of that yet so I'll start small and work my way up once I get to the point of trying an LCD. Or for aesthetic reasons, I may choose to use an analog meter for vertical speed and relative speed.

Probably not a nav-ball. That seems a bit too complicated for me especially when you consider that I'd want prograde / retrograde markers and more. Also I'm not sure I'd want to disable the on screen one since you almost can't help but see it while executing maneuvers under stress.

Corrections? It's a bad sign if I've already messed up and I haven't really even done anything yet :D

Link to comment
Share on other sites

I thought the potentiometer slider or knob might negate the need for the 100% / 0% throttle buttons, but that's before I see how fast it will respond in game. If it's anywhere near as slow as using shift and control then yes, I do plan to include those at some point.

I mentioned altitude, vertical and relative speed but the better option would be to make the relative speed toggle between orbit, surface, and relative. Of course I don't know how to actually implement any of that yet so I'll start small and work my way up once I get to the point of trying an LCD. Or for aesthetic reasons, I may choose to use an analog meter for vertical speed and relative speed.

Probably not a nav-ball. That seems a bit too complicated for me especially when you consider that I'd want prograde / retrograde markers and more. Also I'm not sure I'd want to disable the on screen one since you almost can't help but see it while executing maneuvers under stress.

Nice!

Corrections? It's a bad sign if I've already messed up and I haven't really even done anything yet :D

Indeed it is.

MUST RESIST URGE TO USE HALT AND CATCH FIRE QUOTE.........

ERRRRRRRRRRRRRRRRRRRGGHHHHHH

Link to comment
Share on other sites

Err, I'm not sure I follow. lol.

So with my more powerful soldering iron I was able to desolder the joystick module from my remote and hook up one axis to my breadboard. At first I coded in a fairly big deadzone like I may or may not have mentioned before, past which it would hold down a key.

n.jpg~original

Then I added a rough segment to the sketch that emulates half / full position by using delays, like so:

kspsketch.png~original

You can effectively ignore any comments within the code... They may or may not have any real meaning outside of my head. This is just a concept basically so don't hate, I know it's not as desirable as some other options (like using the plugin that I have no clue how to implement right now) but it was easier to get this running quickly for the test. It functioned pretty much as expected (although a bit jittery at half position). Just a note to anyone else who may try using a Due, don't. No but seriously, it has two USB ports, one of which is "Serial" (which I used above for debugging info) and the other is "SerialUSB" which is the same port it uses to emulate a keyboard. For some reason mine is very flaky about sending information back to my terminal with SerialUSB -- as in 9 times out of 10 it just won't at all -- so I just use Serial and swap ports or hook up both when I need the terminal. It'd be nice if I could use SerialUSB so I only need one cord but it's not a big deal now that I can work around it instead of scratching my head and wondering why I don't get any output. It occurs to me that this could be an issue if I ever do get the plugin working, so hopefully I can find a solution other than buying a Leonardo or hooking up two cords permanently.

If this is any indication of what I'm up against, it's not going to be as hard as I thought to set up the hardware controls. I... think I need a few more breadboards. I soldered some wires to the x axis and tried to set up the y axis but I messed up and it was reading a constant 1 instead of ~500, but I'm pretty sure I know why and I can fix it with a little tweaking. I had a variable mixed up so it was probably that or maybe the fact that I was trying to improvise by using the voltage from a "pulled up" digital pin as a substitute for the board's 3.3v pin. It may or may not actually work that way, but I fixed the variable and I'm going to wire it up properly next time I play with it.

Edit: It seems I've had a small break of success with the joystick. It's not acting "quite" right and the serial output is garbage, but I was able to fly a rocket on a suborbital flight with it and twirl around a bit (with the plastic finger friendly piece added). I'm pretty sure this wiring is somehow wrong because the "not quite right" part is mostly while using more than one axis, but I'll figure it out when I'm not as tired.

20140703_030401.jpg~original

Edited by Duke23
Link to comment
Share on other sites

Err, I'm not sure I follow. lol.

IT'S A NEW SHOW ON AMC...

So with my more powerful soldering iron I was able to desolder the joystick module from my remote and hook up one axis to my breadboard. At first I coded in a fairly big deadzone like I may or may not have mentioned before, past which it would hold down a key.

http://i19.photobucket.com/albums/b161/duke396/Custom%20Controller%20Project/n.jpg~original

Then I added a rough segment to the sketch that emulates half / full position by using delays, like so:

http://i19.photobucket.com/albums/b161/duke396/Custom%20Controller%20Project/kspsketch.png~original

You can effectively ignore any comments within the code... They may or may not have any real meaning outside of my head. This is just a concept basically so don't hate, I know it's not as desirable as some other options (like using the plugin that I have no clue how to implement right now) but it was easier to get this running quickly for the test. It functioned pretty much as expected (although a bit jittery at half position). Just a note to anyone else who may try using a Due, don't. No but seriously, it has two USB ports, one of which is "Serial" (which I used above for debugging info) and the other is "SerialUSB" which is the same port it uses to emulate a keyboard. For some reason mine is very flaky about sending information back to my terminal with SerialUSB -- as in 9 times out of 10 it just won't at all -- so I just use Serial and swap ports or hook up both when I need the terminal. It'd be nice if I could use SerialUSB so I only need one cord but it's not a big deal now that I can work around it instead of scratching my head and wondering why I don't get any output. It occurs to me that this could be an issue if I ever do get the plugin working, so hopefully I can find a solution other than buying a Leonardo or hooking up two cords permanently.

If this is any indication of what I'm up against, it's not going to be as hard as I thought to set up the hardware controls. I... think I need a few more breadboards. I soldered some wires to the x axis and tried to set up the y axis but I messed up and it was reading a constant 1 instead of ~500, but I'm pretty sure I know why and I can fix it with a little tweaking. I had a variable mixed up so it was probably that or maybe the fact that I was trying to improvise by using the voltage from a "pulled up" digital pin as a substitute for the board's 3.3v pin. It may or may not actually work that way, but I fixed the variable and I'm going to wire it up properly next time I play with it.

Edit: It seems I've had a small break of success with the joystick. It's not acting "quite" right and the serial output is garbage, but I was able to fly a rocket on a suborbital flight with it and twirl around a bit (with the plastic finger friendly piece added). I'm pretty sure this wiring is somehow wrong because the "not quite right" part is mostly while using more than one axis, but I'll figure it out when I'm not as tired.

http://i19.photobucket.com/albums/b161/duke396/Custom%20Controller%20Project/20140703_030401.jpg~original

This is actually going well?

Looks like I'm out $3000.

In all seriousness, if this isn't nearly as a pain to get set up as it might seem, I would need one of these.

Link to comment
Share on other sites

IT'S A NEW SHOW ON AMC...

Sorry I don't watch much TV... It's mostly Netflix for me these days.

This is actually going well?

Looks like I'm out $3000.

In all seriousness, if this isn't nearly as a pain to get set up as it might seem, I would need one of these.

I wouldn't call it easy but with a little patience, a basic knowledge of electric / electronic components, and some light coding (most of which can be easily adapted from tutorials) it's really not that bad. The part that's caused me the most grief so far was the soldering / desoldering itself. I actually haven't gotten any farther than I showed above, just haven't had the motivation to get back on it yet and I'm waiting on some parts. But yeah if you like to learn then I say give it a go, the possibilities are endless. Note that only the Due (the one I have), Leonardo, and Micro (IIRC) can use direct keypresses like you see in my code. It'd actually be better all around if you can use the plugin and set up the joystick to its full potential.

Edited by Duke23
Link to comment
Share on other sites

Sorry I don't watch much TV... It's mostly Netflix for me these days.

A sad but true fact:

TV is crap, there is nothing good on nowadays.

I wouldn't call it easy but with a little patience, a basic knowledge of electric / electronic components, and some light coding (most of which can be easily adapted from tutorials) it's really not that bad. The part that's caused me the most grief so far was the soldering / desoldering itself. I actually haven't gotten any farther than I showed above, just haven't had the motivation to get back on it yet and I'm waiting on some parts. But yeah if you like to learn then I say give it a go, the possibilities are endless. Note that only the Due (the one I have), Leonardo, and Micro (IIRC) can use direct keypresses like you see in my code. It'd actually be better all around if you can use the plugin and set up the joystick to its full potential.

If I had the time I would've made a custom built ARMA 3 controller, but Arma's many buttons and a lack of time and experience (Coupled with the fact it looks all to daunting) have prevented me from doing so.

In short: I probably couldn't do this, I would try and could succeed but I'm that kind of person that says "This looks hard, I'm out" and this looks hard.

Err, plus the fact I probably wouldn't use the controller either.

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