pyGestalt

Logo

A control system framework for personal automation.

View the Project on GitHub imnp/pygestalt

Communications Protocol

Standard Gestalt Packet Frame

All communications between the pyGestalt virtual nodes and Gestalt-based physical nodes rely on the standard Gestalt packet format, shown below:

Byte Position Description
Byte 0 Start Byte (72 = unicast, 138 = multicast)
Byte 1 Destination Address (Byte 0)
Byte 2 Destination Address (Byte 1)
Byte 3 Destination Port
Byte 4 Packet Length
Byte 5 -> N-1 Payload
Byte N Checksum

Serial Communication Protocol

Gestalt nodes typically communicate over a asynchronous serial connection, often via a USB-to-serial converter. The format is 8 data bits, no parity bits, and 1 stop bit.

Standard Baud Rates

Node Type Baud Rate
Standard Gestalt Node 115.2 kbps
Arduino-Based Gestalt Node 38.4 kbps

The standard baud rates above were based on the clock frequency of the microcontroller. Custom Gestalt nodes use a 18.432Mhz crystal, which was selected to have zero rate error at 115.2kbps (and all standard baud rates). Because Arduinos rely on a 16Mhz crystal, communication speeds are limited by the rate error. A non-standard speed of 76.8kbps would have been ideal, but is unsupported in Linux. Therefore, we use a standard baud rate of 38.4 kbps. This has a rate error of 0.2%.

Typical Packet Exchange Rates

Packet throughput is limited not only by the communication baud-rate, but also internal delays in the USB-> serial device driver, the operating system, and within the pyGestalt framework. We measured the actual round-trip packet exchange rate, measured in packets per second, for several types of nodes. You can see the full results here (including how to run the tests yourself), or the summaries below. The pyGestalt framework itself is currently able to process 385 round-trip packets per second as an upper limit to overall system throughput.

Arduino Uno Node, pyGestalt running on Mac OSX:

Payload (Bytes) 0 5 15 20 25 45 55 115 200
Packets per sec. 93 63 55 35 29 28 16 10 8

Networked Gestalt Node, pyGestalt running on Mac OSX:

Payload (Bytes) 0-15 20 25 30 40 85 100 150 200
Packets per sec. 63 52 44 41 37 28 19 14 14