Close

Serial

A project log for KAPCOM

Yet another hardware controller for Kerbal Space Program. Leveraging Telemachus, Python and Arduino to drive joysticks, buttons and displays

lawnmowerlattelawnmowerlatte 02/06/2015 at 06:010 Comments

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

Discussions