Dynamixel Protocol Tutorial

Last modified by Eric Nantel on 2022/04/05 14:56

Many hardware devices communication with the computer using a serial protocol. Some are simple ASCII-based protocols, but others can be more complex binary ones that require checksums. No matter, both can easily be made in FlowBotics.

We've already covered the Lynxmotion SSC-32 protocol as an example ASCII protocol, now let's use the Dynamixel servos as an example of a binary protocol.

We made a small project to show how this can be done. You can download a copy of it here. Here's the main screen:

dynamixel-protocol-front-panel.png
Here's the main schematic of the project:

dynamixel-protocol-main-schematic.png

Inside the "Dynamixel Protocol" module, you can see how the bytes are prepared. Since the Position and Speed are 16-bit integers, they need to be separated into their most significant byte (MSB) and least significant byte (LSB) to ensure they are sent in the right order (see endianness). We store them in an array to make them easy to process in the checksum calculation.

dynamixel-protocol-message.png

Inside the "Encapsulate" module, you can see how the message is assembled into a single hexadecimal string. The "COM Port" component (inside the "COM Engine" in the main schematic) has a Hex data parameter, so we don't need to worry about converting to binary.

dynamixel-protocol-encapsulation.png

 

Finally, inside the "Calc Checksum" module, you can see how we used a small clip of Ruby code to help generate the checksum.

dynamixel-protocol-checksum.png

 

Questions? As usual, ask us in our forum!
<< Back to Developer Zone

 

Tags:
Created by Eric Nantel on 2022/03/16 14:33
Copyright RobotShop 2018