Arduino/Rasperry Pi Communication

From Drogon Quad Wiki
Jump to: navigation, search

The Arduino and Rasperry Pi communicate via the Serial interface. The protocol is line-based with a single character prefix determining command type.

Arduino Originated Commands

Debug Message

A debug message from the Arduino.

Prefix: D
Data: The message.

Log Message

A data log message from the Arduino.

Prefix: L
Data: A tab-separated list of values of:

  1. Timestamp in milliseconds since Arduino start
  2. Last run duration in microseconds
  3. Accelerometer X-axis
  4. Accelerometer Y-axis
  5. Accelerometer Z-axis
  6. Gyroscope X-axis
  7. Gyroscope Y-axis
  8. Gyroscope Z-axis
  9. Motor Adjust (increase/decrease in output from stabilization algorithm) front-left
  10. Motor Adjust front-right
  11. Motor Adjust back-right
  12. Motor Adjust back-left
  13. Position: X-rotation
  14. Position: Y-rotation
  15. PID A (FL/BR) error
  16. PID B (FR/BL) error

Raspberry Pi Originated Commands


Arm the Arduino motors and engage control.

Prefix: A
Data: "1" to arm or "0" to disarm.

To Arm:


To Disarm:


Motor Speed

Sets the master motor speed.

Prefix: M
Data: Motor speed between 0.0 and 100.0 as a percentage of max speed.

To set to 50%:


To set to 12.5%: