Jump to content

My KSP control panel


stibbons

Recommended Posts

Glad you like it. :)

Current status is that all of the control inputs are working. I've got some of the status lights up, but the annunciator and the seven segment displays don't really have any code at all. And this evening was a fairly frustrating one struggling with the power supply and trying to get it running on my OSX laptop. I really want to shoot a video, but to be honest I'm not happy doing it right now. Will definitely work on getting some footage explaining how it works once it's finished.

- - - Updated - - -

Opaque Perspex would also work with the transparency over it (just trying to think of ways to diffuse the light the best).

Though, that's at least another $20 Aus.

I missed your remark about the perspex before, sorry.

The instrument panels are cut from 3mm opal perspex that I've painted on one side. I bought a square metre of the stuff for this project and still have maybe a quarter of it left untouched. It could work, but I don't think I'd want to use something that thick as a diffuser for the annunciator because of light bleeding across compartments.

I might drop by Reverse Garbage this weekend and have a rifle through their perspex stock to see if they have anything that might suit.

Link to comment
Share on other sites

One step forward, several steps back.

First, I picked up some transparency film to redo the annunciator display. That stuff is relatively expensive, I paid about a dollar an A4 sheet. But it seems to be a pretty good compromise - just thin enough to let plenty of light through without being able to see inside. Looks darker when it's turned off, and much brighter when it's running. Now you can see where I dropped the annunciator box and broke a corner off. ;)

kc17uAA.jpg

And then I started writing test code to actually control the LEDs. Started by lighting each one in turn, just cycling through all 31(!!) one after the other. That revealed what looked like communication issues because I was powering the LEDs separately to the arduino, and didn't have a common ground. So this evening I arranged a common ground plane and tested again. That looked better running one at a time, so I started updating my actual controller code to start lighting up appropriate LEDs. Having a few of them switch on and off depending on how switches on the display were set was working fine, so I figured it was time to start testing in-game.

This led to problem number 2. I just could not get the arduino talking properly to KSP on my mac laptop. Granted, it's an underpowered Mac Air that struggles to run the game at all, but I couldn't do anything to reduce the number of dropped packets. There were enough packets getting back and forth that I could say it... probably works OK. But I won't be able to move my gaming PC up to the maker space I've been keeping the controller at the last couple of weeks until Saturday. It makes testing things pretty annoying.

So I put that aside for a while and started working on the one other feature I'd like out of this panel - a demo mode that doesn't render data from the game, just strobes random colours and some canned messages across the displays. I want it to look vaguely interesting while not playing a game. So I started testing code that would write random colours to all of the LEDs in my string. And that's how I discovered the third problem. Lighting up a handful of LEDs is OK, but writing values out to all of them reasonably rapidly leads to major issues, eventually the whole string seemed to just stop updating. I couldn't figure out where this was coming from, and my troubleshooting only made things worse. The whole experience was remarkably similar to installing OpenBSD. At various points I was accidentally shorting out the signal cable, feeding the LED signal in to the throttle motor, and trying to push data in to the out pin of a few lights.

I've completely rewired how the LEDs are getting power and checked all of them to make sure there's no brownouts. Right now I have a vague suspicion one or two of them have had their controller cooked by my shenanigans, so will start trying to bypass them to confirm tomorrow.

EDIT: Oh man, I forgot the best bit. For the display controller I'm using a SparkFun Pro Micro board. That thing has a tiny little micro-USB connector soldered on to the end, and a couple days ago I discovered that it's fairly fragile. An accidental hard yank of the cable pulled the connector right off the board. I was able to solder it back on after a couple of tries, but one of the solder pads carrying power had been ripped off so I had to power the board externally. And that attempt didn't last too long either, it came off again and I'm not sure I can fix it. There's another one coming to me express post, but if that doesn't arrive tomorrow it's really going to make my plans for getting the seven segment displays running.

Edited by stibbons
Link to comment
Share on other sites

You know, I've heard a few stories about the micro USB breaking of some Pro Micros. What I've been using instead, Are the Pro Minis. They have no USB on them. Instead, they just have a header. you get a USB to serial adapter that has a female header, and you use the header to program them. If you are concerned with the USB socket, then just get a tiny box and mount it all inside, with just the header sticking out the end. That header will be far stronger than the USB. Unless you plan to do the entire project using the Pro micro (in which case I'd see why you want to have the USB), I'd say the Mini is better suited as a "sub" arduino. The Uno or Mega makes more sense as a primary unit, to me, just due to the beefier USB, and the more connections (incase you expand your controller).

Here in the USA, I was able to buy 4 Arduino clone Pro Mini 5v versions for $3.99 USD each. I bought 4. They even have the headers already soldered on! Also picked up a pair of Mega2560 R3 for $9.99 USD each. They were on sale at a place called Microcenter. Not sure what prices are like elsewhere, but i thought that seemed like a good deal. The USB adapter was $7.99, but you only need one to program the unit.

I plan on using one of my Mega2560s as my primary interface for everything, mainly just cause it has a LOT of I/O, and a lot of PWM outs. I have like, 14 analog gauges across everything, So I'll actually need to use EVERY single PWM line on the Mega2560! I plan to do my FDAI sine generators on their own arduino, so it doesn't have to juggle tasks. If I can fit it on one of the Pro Minis, I'll use that, and communicate with it via serial from the main arduino. I'll need 10 digital I/O as a chip select for my 10 DACs (Pro Mini has 14 Digital I/O, so I should be good). If, it doesn't have the RAM and or storage needed to execute the sine program, then I'll just use my other Mega2560, or possibly pick up and Uno.

Bummer about the issues though... ;.;

I must say though... That annunciator looks SWEET! :cool:

********

**EDIT**

********

I see that the Micro differs from the Mini in that it has an integrated USB interface, and can emulate keyboard or mouse, as an option. I can see how that could be useful for some applications, such as an HID mode. It looks like one option to consider might just be soldering a USB-B socket via a small cable to the board, and then mounting that in the controller housing.

Edited by richfiles
Link to comment
Share on other sites

Yeah, I'm a big fan of proper arduino-compatibles, but stay away from outright imitations. That usually rules out the ultra-cheap ebay boards. Went with the pro mini because I wanted a Leonardo based board. Normally I'd use something like a Leostick for that, which adds both ICSP and a much sturdier USB connector, but here we are.

Luckily the replacement arrived this afternoon, so I can go and start hacking on it some more after work. The original board still works fine, so once I've got the code down pat I may hold the connector on and flash it, keep this one for another project.

Link to comment
Share on other sites

I think I like these Microcenter ones. Microcenter has brick and mortar stores, as well as an online store. They carry both the original Arduinos, as well as clone versions. The clones don't say arduino anywhere on them, nor use the logo, though the packaging says They are manufactured from the original Arduino schematic. They are all "Inland" branded. They had other stuff, but these were the ones on sale. Normally, they are $7.99 for the minis and $19.99 for the Megas. The sale was a real deal!

If you have access to lead based solder, I honestly find it to be far more forgiving of stress than lead-free. Lead free solder seems to be harder/more brittle. The red ring of death / yellow light of death on Xbox 360s and PS3s... That was due to lead free solder balls not he bottom of BGA chips cracking due to thermal expansion and contraction related stress fracturing. If you have problems with the retention of the socket, and have lead solder, try to reflow it with lead solder, before it breaks. Depending on the region where you live, you might not be able to legally sell the part commercially, but since this is for a personal project, there should be no issue.

Here in America, we still make certain items with lead solder. I happen to make a cable used to power and control a surgical tool. We still use lead solder for it's construction, because lead solder is more reliable than lead free solders. Lead solder is more pliant to stress (softer/more ductile), and the most common ratios (60/40 and 63/37, for example) also don't suffer from whisker formation. Some lead free solders can form "whiskers" of metal deposits that crystalize from the surface, especially when under stress. Tin whiskers caused the failure of the Galaxy IV satellite in 1998, a nuclear plant shutdown, due to false alarms triggered by shorts, and have even allegedly been cited as a possible (though currently denied) cause of the unexpectedly accelerating Toyotas a few years ago.

Long story short, if you can snag a little bit of lead based solder... It can actually be quite nice for enhancing high stress solder joints.

- - - Updated - - -

Yeah, I'm a big fan of proper arduino-compatibles, but stay away from outright imitations.
Any reason with this?

Arduino is an open source platform, but the original Arduinos (made in Italy) help to fund development of new designs and shields and libraries and stuff like that. Some people like to buy at least one legit original, just to chip in. A person doesn't have to, but it's certainly courteous toward the future development of the platform. The clones are cheaper, because they aren't charging the development premium that the branded originals carry.

The difference between a clone and an imitation is that clones are just simply Arduino compatible devices. They are designed and marketed as just that. They use the open source design and are marketed as being arduino compatible, or based not he original arduino.

Imitations are designs that try to imitate the appearance of the legit Arduinos, for the sole purpose of trying to sell cheap hardware on a false premium, Sometimes they even go so far as to even print Made in Italy on the boards, when they are clearly made in China, or even try to copy the logo. These boards are either marketed as "cheap Arduinos" or worse, to confuse people into paying more for cheap hardware. That's the difference. It is literally dishonesty in making something that's already free to make... I mean, come on! Really? :mad:

Link to comment
Share on other sites

I think I like these Microcenter ones. Microcenter has brick and mortar stores, as well as an online store. They carry both the original Arduinos, as well as clone versions. The clones don't say arduino anywhere on them, nor use the logo, though the packaging says They are manufactured from the original Arduino schematic. They are all "Inland" branded. They had other stuff, but these were the ones on sale. Normally, they are $7.99 for the minis and $19.99 for the Megas. The sale was a real deal!

If you have access to lead based solder, I honestly find it to be far more forgiving of stress than lead-free. Lead free solder seems to be harder/more brittle. The red ring of death / yellow light of death on Xbox 360s and PS3s... That was due to lead free solder balls not he bottom of BGA chips cracking due to thermal expansion and contraction related stress fracturing. If you have problems with the retention of the socket, and have lead solder, try to reflow it with lead solder, before it breaks. Depending on the region where you live, you might not be able to legally sell the part commercially, but since this is for a personal project, there should be no issue.

Here in America, we still make certain items with lead solder. I happen to make a cable used to power and control a surgical tool. We still use lead solder for it's construction, because lead solder is more reliable than lead free solders. Lead solder is more pliant to stress (softer/more ductile), and the most common ratios (60/40 and 63/37, for example) also don't suffer from whisker formation. Some lead free solders can form "whiskers" of metal deposits that crystalize from the surface, especially when under stress. Tin whiskers caused the failure of the Galaxy IV satellite in 1998, a nuclear plant shutdown, due to false alarms triggered by shorts, and have even allegedly been cited as a possible (though currently denied) cause of the unexpectedly accelerating Toyotas a few years ago.

Long story short, if you can snag a little bit of lead based solder... It can actually be quite nice for enhancing high stress solder joints.

I've been aware of this for a while now too -- I can understand the reasoning for limiting lead in electronics (especially when idiots don't e-cycle); but I've heard these stories far too frequently too.

From what I know, you can still get lead-based solder here down-under, but I'm not sure where. Every store I've ever been to has been lead-free all the way.

Arduino is an open source platform, but the original Arduinos (made in Italy) help to fund development of new designs and shields and libraries and stuff like that. Some people like to buy at least one legit original, just to chip in. A person doesn't have to, but it's certainly courteous toward the future development of the platform. The clones are cheaper, because they aren't charging the development premium that the branded originals carry.

The difference between a clone and an imitation is that clones are just simply Arduino compatible devices. They are designed and marketed as just that. They use the open source design and are marketed as being arduino compatible, or based not he original arduino.

Imitations are designs that try to imitate the appearance of the legit Arduinos, for the sole purpose of trying to sell cheap hardware on a false premium, Sometimes they even go so far as to even print Made in Italy on the boards, when they are clearly made in China, or even try to copy the logo. These boards are either marketed as "cheap Arduinos" or worse, to confuse people into paying more for cheap hardware. That's the difference. It is literally dishonesty in making something that's already free to make... I mean, come on! Really? :mad:

Oh, I'm aware of this :)

I was more curious as to why Stibbons chose to avoid the clone-duinos. I'm using a clone mega2560 without any issues, and would get the same 'brand' clone again - simply cos I know it works (even after doing obscure shorts... like plugging my slider into digital i/o pin 4, instead of analogue 4 :P ).

Like you (and others) I'd love to be able to afford a proper brand-name one to support the work the guys do (even though it's not exactly revolutionary...) however, at about $100 for a mega board, I think I'll wait till the exchange rate is either better, or I have more disposable income :P

Link to comment
Share on other sites

It's a licensing thing. I'll happily buy arduino-compatible boards from anybody, as long as they respect the Arduino licence. I won't buy from counterfeit manufacturers making fake "official" Arduino kit.

- - - Updated - - -

This evening I ripped out and replaced all of the slightly dodgy wiring connecting my LEDs and replaced it all with slightly less dodgy wiring. Careful checking during that found three dead LEDs. Chalking that up to carelessness.

The rest were reconnected and seem good so far. Unfortunately I'm out of spares, so it might be a little while before I can replace seem. Such is life.

Link to comment
Share on other sites

My Saturday was nearly a disaster. Woke up early to discover reports of issues running KSPSerialIO under Windows 10. I'd just upgraded my gaming rig to a new machine running Win10 (Microsoft's online store only seemed to sell the one version in Australia, go figure). So fired it up and, sure enough, a test sketch running on a spare Arduino just wouldn't connect. There's some interesting leads in the KSPSerialIO thread about resolving the issue, but I'm under some time pressure to get my build complete and functional so I eventually sighed and dug out the old Windows 7 retail box I had hiding in the back of a drawer. Then I sighed again and yanked the DVD-ROM drive out of my media centre machine so I could get it installed.

While that was catching up with eleventy Windows updates I tidied up the hardware for my build. Routed all the cables neatly and taped them in place. Cleaned and vacuumed the inside of the enclosure and made sure everything that needed labels had labels. Finally I made button caps for my little illuminated tactile buttons by cutting circles from my translucent perspex and glueing them to the buttons. And then I had to disassemble some of them to remove the glue that was gumming up the action. :P

At this point I'm considering the hardware 1.0 complete. There's still a couple of blown LEDs that need to be replaced and my analogue gauges are purely decorative right now, but unless there's an emergency I'm not touching any of it for a few weeks.

After one final test to ensure all of the control inputs were functional, I plugged in and ran an in-game test. That was the first time some of this stuff had been used, and the first time I'd ran any of the other panels for a couple of months. Everything ran beautifully, and even without the displays functional it was great to be able to prove to everybody else in the maker space that this huge lump of wiring I'd been poking at for ages actually does something.

iX8B0nZ.jpg

And then I brought it all home again. Right now the controller is occupying... pretty much all of the coffee table in my living room while I write the display code. Turns out it's way too big to fit on the desk in the study, so it's here until I arrange a new one.

Link to comment
Share on other sites

Aww man! Freakin' Windows... :mad:

It's wonderful to hear that it's more or less functional, save for minor LED repair and display code! My solution to the desk issue is gonna be a saws-all with a fresh blade! :sticktongue:

Link to comment
Share on other sites

Lots of hacking the last few days.

I have four seven-segment displays, each with exponent indicator lights (kilo, mega, giga), and illuminated push-buttons to select what information the display will show. All of those lights had to be checked, and I had to make sure that the input multiplexer was relaying all of the button signals that I needed. That part wasn't too bad, and worked great.

Then I wrote the code to handle a single selection for each display, and lighting up the appropriate indicators for that. Much more fun, but again a fairly straightforward problem to solve.

Finally was the code to take floats from KSPSerialIO, and render them down to engineering notation with four significant digits, to be written to the displays. I had an outline for code that I wrote a little while ago for that, which turned out to be slow and almost but not quite completely broken. After a couple of attempts I eventually gave up and looked for somebody else's code. In the end I've adapted an unmerged pull request to the Arduino's Print library to support rendering floats in engineering notation. Pared it back to stick ints in to a fixed array instead of writing them to a serial port, and I was in business.

Finally, late this evening, I had my first launch with my fully-functional controller.

5uDYLui.jpg

Everything works, but there's still a bunch of work I can do to improve the experience. Right now the displays show seconds as decimals, when I'd rather have it flick between "seconds.fractions", "minutes.seconds" and "hours.minutes". They also render low numbers < 100 or so untidily, and break down entirely with things like inclination < 0.1.

I need to redo the demo mode, which will just blink random lights across the panel. And I really need to arrange backlighting. Right now the lettering can be fairly hard to read, but quick tests with a spare lamp in the enclosure show it lighting up quite nicely. I think the first version of the backlight will just be a cheap table lamp or something bolted inside.

Edited by stibbons
Link to comment
Share on other sites

At this point I'm considering the hardware 1.0 complete.

I know the feeling ;)

Great effort though.

I remember the first demo code I wrote to ensure all lights were connected to where I thought was way off :P

You have a controller now; you can have fun, and design a v2 if you feel so inclined! xD

[i know I probably will at some point ;) once I actually complete my v1 :P ]

Could you please share a link to that print library? I suspect it might be useful to a few of us :)

Link to comment
Share on other sites

The first very very rough pass that works for my incredibly narrow use case is engnumber.h and enbnumber.cpp. It was based on a thread on the arduino forums about optimising the Print::printFloat method, but I've modified it to take a struct containing an array for the numbers, and ints for exponent and position of the decimal point. That's all there is right now, but I'll tidy it up and make an actual library next week.

Link to comment
Share on other sites

Yeah, it's pretty large. 800mm wide, and the control panel is 450mm deep. I always wanted it vaguely arranged this way, most controls along the bottom and displays above. And after that, well, I saved myself a cut using MDF that was 450mm wide. :)

The electronics are currently mounted on the back of the lid in the top left corner. Future plans are slightly vague, but include a brightness knob and rotary switch for display presets. And a smallish screen.

In the immediate term, though, there's enough space to stick a small keyboard in the top left corner (because you still need one for quite a few things, sadly). And I have a 7" tablet that'll fit in the space in the top right that I'm trialling KeRD on.

Link to comment
Share on other sites

Went down to my local hardware shop last night and picked up a portable 15W fluorescent tube work light and quickly taped that to the inside of my enclosure as a panel backlight. This'll do quite nicely for making it the lettering bright and readable during the day. In the dark it shows through the paint on the panels a little too much though. If/when I remake the panels I'll add a couple more coats of paint, and try to be a little more careful with the lettering.

Still, it's a pretty great effect.

PS5LJbi.jpg

I've since added some masking tape on the back around the annunciator box to stop light coming through. Would like to get something in place for the slot for the throttle slider too, but that's on the back burner for now.

Edited by stibbons
Link to comment
Share on other sites

The brightness is mostly because of my camera phone. I swear it's nowhere near that bright in real life, but I am thinking about putting diffusers over the seven segments to dim it a bit further.

I wanted to write things to the displays while the system was idle, so came up with a list of phrases that can be spelt out with seven segments. "launch it" is on the list, so is "crash it". Now that I think about it, there's nothing about landing. Um.

Link to comment
Share on other sites

  • 2 weeks later...
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...