-
Fly by wire
02/09/2015 at 21:13 • 0 commentsI finally got around to troubleshooting the joysticks. It was actually much easier than I'd feared. The worst of the issues were introduced by the calibration. The main problem was that I wasn't using pullup resistors. Since I started using pullup inputs, the values are good enough not to need to calibrate anyway.
I did a bit more work to make axes investable to compensate for mounting and preference. I also required the joystick buttons to ground rather than 5v.
Now the joysticks work are tested and work great in game. The refresh is definitely fast enough.
While demoing this to some coworkers (shoutout to Jon for the inspiration for this project) I had a problem with the script thinking the antenna was disconnected. I think I might have to add some reconnect logic rather than waiting for user input.
Very pleased with progress thus far. Next up: buttons with indicators. This will be my first foray into displaying any sort of game output.
I was looking at other projects and I'm starting to like the idea of using a DSKY interface to interact with the displays (both 7-segment and bargraph). It should be fairly easy once everything is done, basically I would have a keyboard interface that would program which API token to use for a given display. I'm not thinking of going really overboard with realism like KK4TEE did, but I was planning on making some kind of input to select what is displayed. Originally, I was going to use a rotary switch, but the DSKY interface would be much more versatile. And cool. Perhaps something for version 1.5.
-
Autodetect Serial Ports
02/07/2015 at 06:17 • 0 commentsI was really planning on working on joystick diagnostics, but I ended up getting caught up adding niceties to the Python script. Serial ports are now auto detected, which is nice since my device changes depending on the port I plug into. I also cleaned up some things and added error handling so there will be fewer Python stack traces. Minor things, but it makes it look nice.
It's late now, so I guess joysticks will have to wait for another night.
-
Serial
02/06/2015 at 06:01 • 0 commentsI've been working on improving serial communication between the Arduino and Python components. Previously, they just threw data at each other and hoped for the best. It now operates on a call and response model with a ~35Hz refresh rate. There's room for improvement if I reduce the API key lengths or compress the data somehow.
I also upped the baud from 9600 to 250000 to improve speeds.
I also improved the script to display some stats on exit:
$ ./arduino.py Telemetry...Go Arduino...Go Calibration...Go Fly by wire...Go All stations are go. Waiting for input: {u'rcs': u'None'} {u'action_group_1': u'None'} {u'action_group_1': u'None'} {u'rcs': u'None'} {u'rcs': u'None'} {u'rcs': u'None'} {u'rcs': u'None'} ^C =======[ Stats ]======= Updates: 465 Retransmits: 1 Percentage: 0.22% Rate: 28.87ms Frequency: 34.64Hz
Really pleased with out this came out. I had some misgivings for a bit when I was really in the weeds with this. I even started looking at alternatives like the Pi and Edison. I like the Edison a lot actually, but it doesn't have the pin density I'm looking for. Anyway, it's working great now. I can't wait to move on to the next big thing. -
Successful Launch
02/01/2015 at 05:38 • 0 commentsI've had frustratingly little time to work on this the last month. I have however, gotten a functional test launch of a rocket in KSP.
To follow up on what I remarked on last post, I was able to remove the '?' from the JSON by simply removing it. Not 100% where that comes from, but that fixed the issue. I resolved the issue with compiling; I've found that not using pin 0 and 1 (which are also serial Rx and Tx) fixed the issue.
I actually got the "first" launch a few weeks ago, but soon found that it only worked for staging and that the abort button wouldn't work. It turned out that Telemachus expects "True" and "False" for some tokens, but staging is very liberal about what it accepts. I ended up having to shoehorn a toString() method that uses a 'format' object value to control what it outputs. I'm actually pretty happy with how it turned out, and now the staging and abort buttons work great.
The joystick values also make their way into the game, but the values are still wrong are still wrong. I have to take a look at that once I have some time. I did redo the Joy class to map directly to the range of -1 to 1 which is what Telemachus expects. It doesn't make any sense to use 0-255 internally and then convert it.
I am having issues with uploading sketches to my Mega. The issues are strange and ephemeral, if I change anything of significance it might fix or break it. It doesn't seem to matter what part of the code I change, but it does seem to change if the binary changes (ie. comments don't seem to have an effect, but code changes do).
Overall, it's a good day. Still lots of work to do, but I was able to overcome some obstacles and make real, measurable progress.
-
Getting Closer
01/08/2015 at 06:41 • 0 commentsI've been knee-deep in Arduino code, just hacking away at problems. I'm not really experienced with C, so I'm kinda fudging my way through at points. I managed to get vectors integrated with the project which makes it easier to have containers for each type of object and act on them as a group.
I also started working on wrapper classes for the 7-segment displays and bargraphs. I'm kinda getting ahead of myself here, but I wanted to get some of my ideas out of my head and into a file.
In addition, I've made serious progress on getting the Arduino and Python sides talking. I'm still having problems getting the Arduino to recognize output, but I can fool it into sending data anyway. I was hoping to have a first launch using the controller, but that was not to be. There seems to be an errant '?' variable slipping into my JSON which was crashed everything. I haven't been able to get the Mega to accept new uploaded code, so I'm going to turn in for the night.
Exciting times. Having a first working test will be very exciting. In addition, lots of parts from Adafruit, Tindie and Sparkfun are arriving. I haven't been able to play with them all, but it's exciting to have them here, waiting to be implemented.
-
Protoboard Testing
01/02/2015 at 06:44 • 0 commentsTested the reworked protoboard tonight. Turns out I missed a line I was supposed to connect, so I had to put that in. After that I was able to test all the 5v and ground pins were working. To test the signal pins, I decided to wire it all up so far and test it out.
So far, the buttons and switches are working excellently. The joysticks initially seemed as though they were working better than ever, but closer inspection of the output revealed that although they calibrate well (they report the full 0-1023 range and report the correct midpoint value), I'm getting very strange results. When the joystick is all the way up, Y and Z report minimum values. When it's all the way down, X reports a minimum value. Very strange. I'll have to have a closer look at the board to make sure there's no crosstalk.
Once I get that straightened out, the next step is to finish up the updated() and toJSON() methods for the classes. If I can get that working, I can do my first full test and actually launch a damn rocket.
I did some brainstorming on how to work with the 24 LED barograph I'm planning on ordering. I looked over the library to see what I can (and can't) do with it. I'm thinking I'll have a relatively simple resource display. x/24 bars lit for the resource; light in green above 50%, yellow above 20%, red below 20%; highlight the estimated usage for the next 5 seconds in the next color. This will work for most resources, but I'm not sure how I want to implement the electrical charge/draw graph. Maybe I'll implement it as a two bar system, charge in green and draw in red. Where they cancel out will be yellow. Now that I'm thinking about it though, it doesn't look like Telemachus provides charge/draw data, so I may just have one "delta" figure. In which case, maybe it just makes sense to map it directly onto the electrical charge graph the same as the rest...something to think about.
-
Point-to-Point Protoboard
01/01/2015 at 07:11 • 0 commentsFinished re-soldering the protoboard tonight. It's not pretty and I need a new soldering iron tip, but it's done. I have to test for unexpected shorts, but I think it'll be fine. I posted some project pictures of the results.
I didn't do a full prototype; namely I skipped the 2x16 digital inputs on the far side of the board. I do have the SPI and I2C headers ready for the parts I bought. This should be more than enough for the time being.
-
Shield Schematic
12/31/2014 at 20:33 • 0 commentsI just finished up my shield schematic for plugging into the Mega. I have a work in progress prototype using point-to-point soldering. I currently don't have the displays or bar graphs to test with yet, so I don't want to order just yet.
Here's a list of features it will have:
- 2 Joystick headers
- 8 I2C headers
- For interfacing with LED barographs
- 1 SPI header
- For interfacing with 7-segment displays (via daisy chain)
- 57 Data/5v/Ground Headers
- 8 Analog In
- 9 PWM
- 40 Digitial IO
- 15 5v/3.3v/Ground Headers
- Reset header
This is probably overkill, but should allow maximum utilization of the Mega in case I decide to expand in the future. The data pins will all use extra long male headers, but the rest will use normal male headers.
I'm currently looking at using seeed to produce the PCB. Unfortunately 8x6.5cm is an odd size, so I have to go with 10x10cm which is $19/5 boards. If anyone's interested in buying a board, I'd be happy to split the order.
The Fritzing file is available on GitHub, but you can see a screenshot of the PCB in the project photos.
-
Current Status
12/30/2014 at 19:42 • 0 commentsThe JSON to Python to PyKSP to Telemachus to Kerbal Space Program section is functionally complete. I am able to take canned JSON input and feed it all the way to KSP and take data from KSP and read it to the screen.
The Arduino section remains a work in progress. Much of the classes needed are complete — this included Pin, LockedInput and Joy. These are responsible for polling hardware and getting the values and abstracting some of the minutia so that the general sketch can remain fairly free of this. Hopefully this will make it easier for others to reuse the code.
I originally did the shield using conductive paint, but that has proven less than reliable. Fortunately it was water soluble so I was able to wash it off and start over. I am in the process of redoing the board and soldering everything, but I have a cheap soldering iron and am not the best at soldering in general, so it is slow going.
With a recent cash infusion from Christmas, I've been able to buy the next round of equipment needed, so I should be able to start making progress on the displays. These will need classes to wrap functionality as well.
Everything is currently in a shoebox for testing, but eventually I'd like to make a console something like this. I'd like it to remain desk sized at very least.