Reference

Last revision 2026/01/30

Communication Protocol Description

Standard Commands

#<ch> P <pw> S <spd> ...# <ch> P <pw> S <spd> T <time><cr>

  • : Servo channel number, 0 - 23
  • : pulse width(us), 500 - 2500; the destination position
  • : single-channel speed (us/s)(Optional)
  • : carriage return, the symbol of the end, ASCII code 13 (Required)
  • : Cancel the current command, ASCI code 27

Example Commands

#5 P1600 S750 <cr>

The servo on Channel 5 will move to 1600us position at the speed of 750us/s.

#5 P1600 T1000 <cr>

The servo on Channel 5 will move to 1600us from any position after 1000ms.

#5 P1600 #10 P750 T2500 <cr>

The Servo on Channel 5 will move to 1600us position and servo on channel 10 will move to the 750us position. They will arrive simultaneously after 2500ms. This command can coordinate multiple servo speed, even if the initial position of two servos are very far, you can make they start to rotate and stop at one specified position. This command is very suitable for humanoid bipedal robot

Pulse Offset

#<ch> PO <offset value> ... # <ch> PO <offset value> <cr>

  • : Servo channel number, 0 - 23
  • : 100 to-100us
  • : the end of the carriage return, ASCII code 13

To rectify the pulse width of a channel, then humanoid robot could rectify the position without mechanical hardware.

Digital Output

#<ch> <lvl> ... # <ch> <lvl> <cr>

  • : Servo channel number, 0 - 23.
  • : channel output logic level high 'H' or low 'L'.
  • : the symbol of the end, ASCII code 13.

The channel will output a level after received carriage return symbols in 20ms.

Example Commmand

#3H #4L <cr>

This command makes the channel 3 output a high level(+3.3 V), Channel 4 output a low level(0V).

Byte Output

# <bank>: <value> <cr>

  • : 0 = 8-15,2 = Channel Channel Channel 0-7,1 = 16-23.
  • : decimal output (0-255), Bit0 = LSB.

This command allows the 8-bit binary write-once and simultaneously update all channels in the bank, the update will be completed within 20ms after receive carriage return symbols

Example Commmand

# 1:123 <cr>

This command enables bank output 123 in decimalism, 123(decimal) = 01111011 (binary), bank 1 for channels 8-15, then channel 8 and 13 in bank 1 will be 0, the other channel will be 1.

Query State of Motion

Q <cr>

If servo is rotating, it will return "+", if servo has moved to a specific location, it will return "." The return value of this command will delay 50us to 5ms.

Query Pulse Width

QP <ch> <cr>

  • : Servo channel number, 0 - 23.

The return value is one byte (binary), which means the servo current pulse width, resolution: 10us, for example, the pulse width is 1500us, then it will return to 150 (binary). This command can query multiple servo pulse width, each servo has a byte, the return value will delay 50us to 5ms, typical value is 100us.

Principle

Relationship between Steering Angle and PWM Signal

Formula

Run Time (sec) = pulse width (us) / Speed (us / sec).

e.g.The initial position is 750us, the finial position is 2250us, the speed is 1000us/s The running time;

T=(2250-750)/1000=1.5s

So the running time is 1.5s.

Other Supplementary Information

DO NOT PROGRAM THIS SHIELD!** We have uploaded the firmware to Maple RET6 already. Please do NOT upload any sketch to the chip carelessly. Or it will be defective and cannot read any command by serial port anymore.

We have made a special software--DFServo to drive Veyron.

You could click here to check DFServo tutorial.

Was this article helpful?

TOP