Major changes to protocol

A project log for Universal Controller

One controller to rule them all! A PS2 controller crossed with an AVR and XBee / Bluetooth, to use in multiple physical computing projects.

the-big-oneThe Big One 09/03/2014 at 02:420 Comments

I had to think long and hard about whether it was a good idea to do this or not.  One of the major goals in the Universal Controller was to keep things as simple as possible.  Having all messages fit within one byte definitely helped this goal: there was no need for framing, escaping, checksums (I am assuming the link layer, XBee, keeps things sane here), etc.

Unfortunately, life is not simple.

While working on changes for Stubby to allow more fine grained programmatic control from a computer, I started running into limitations with the one byte messages.  A major problem was that I had completely used the bit space; I had no spare messages which I could use to inform Stubby which controller was talking to it.  Furthermore, I wanted the ability to send debugging information such as battery levels, etc (which is going to especially be needed when I start working on an RC airplane controlled by this Universal Controller... sometime... probably next year, once the Hackaday Prize is completed).

To alleviate this problem, I implemented a relatively simple bi-directional multi-byte protocol.  This is included as a library for the AVR, and so can be used by multiple projects (and in fact I am already using this library in both Stubby and the Universal Controller).  A single message in this protocol consists of the following sections:

In the library itself, there are a number of commands defined for common things (ACK, EnableDebug, DisableDebug, RequestBattery, SendBattery, etc).  These are all in the range 0x00 - 0x0F.

In the Universal Controller implementation, there are other commands defined.  These include things like ButtonPush, ButtonRelease, JoystickMove (for allowing the controller to push state to the client) as well as things like SetPollFrequency and SetAnalogFrequency (to allow the client to configure the controller).  All of these commands are in the range 0x10 - 0x1F.

So, in order to use the Universal Controller to control Stubby, both must be compiled from the code committed after today (September 2 2014).  I sincerely apologize for any inconvenience, especially if you are using it to control other projects.  If you have questions about how to implement this protocol support on the client side, please feel free to email me and ask.