Table of contents
Communication frame
Data is transmitted via sound, from the sender (computer or smartphone) to the receiver (robot). This data is contained in a custom 13bit frame.
Start bit
A correct frame always starts with a 0 as the first bit.
Command
The next two bits describe the command sent to the robot:
- 00 - Forward
- 01 - Backward
- 10 - Turn right
- 11 - Turn left
Parameters
The next eight bits desribe the parameters for the command sent, as an 8bit unsinged integer. If the command is Forward or Backward, the parameters are the distance the robot must travel, in centimeters. If the command is Turn right or Turn left, the parameters are the angle the robot must turnn in degrees. They always are an 8bit unsigned integer.
Parity bit
The next bit describes the parity of the previous bits sent:
- 0 - even parity
- 1 - odd parity
This allows for error checking of the received frame.
Stop bit
A correct frame always ends with a 1 as the last (13th) bit.
Examples
Here are some examples of frames:
- 0000100101101 - Start bit correct, Forward command, 75cm to travel, even parity, stop bit correct.
Here are the different parts of the frame:0_00_01001011_0_1
- 0100010110001 - Start bit correct, Turn Right command, 44° to turn, even parity, stop bit correct.
Here are the different parts of the frame:0_10_00101100_0_1
And here is an audio file of an example frame (Turn Left 90°):