Dynamixel Servos

From Tekkotsu Wiki

Revision as of 06:55, 14 May 2016 by Touretzky (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Dynamixel servos are produced by Robotis, a Korean company that also makes the Bioloid robot kits and Darwin-OP humanoid robot. In the US, you can purchase these servos from Trossen Robotics or CrustCrawler Robotics. All three provide technical information about the servos.


The dynamixel_util program can be used to configure and test Dynamixel servos. See that article for more information.

USB-to-Dynamixel Interface

A USB-to-Dynamixel interface board makes the servo bus visible as a serial device. In Linux, this device will have a name like /dev/ttyUSB0 or /dev/ttyUSB1 or maybe even /dev/ttyUSB2. You need to know the correct device name in order to use dynamixel_util. You can get a list of serial devices by doing:

ls -l /dev/ttyUSB*

If you see multiple serial devices listed, unplug the Dynamixel-to-USB cable from the computer and see which device goes away.

Note: to ensure that your USB-to-Dyanixel interface behaves consistently and interacts nicely with other USB serial devices, you will need to take a few configuration steps. See that articles on Linux Udev Rules and FTDI USB Serial device programming for instructions. If you purchased a complete Tekkotsu robot with on-board computer, these steps should have already been taken for you.

Scanning for Servos

Let's assume that your USB-to-Dynamixel interface is /dev/ttyUSB1. To scan the Dyanixel bus for servos, assuming you know that any servos present will be in the range 1 to 9, do:

dynamixel_util Path=/dev/ttyUSB1 scan 1-9

The first time you do this, you may see a warning message about line noise, but if you do it again, you should get clean results. If you are consistently getting line noise errors, one possibility is that two servos have the same id, and they are interfering with each other. Two servos should never have the same id, but all servos come from the factory with their id set to 1, so after installing a new servo, collisions are inevitable unless you set the id to its proper value.

Another possible cause of problems is if a servo's baud rate is set incorrectly. dynamixel_util assumes a default baud rate of 1000000 (one million). New MX and RX servos come from the factory with a baud rate of 57600, and this needs to be changed.

Setting Baud Rate

Dynamixel AX series servos come from the factory with their baud rate set to 1000000 (one million), and do not need to be changed.

Dynamixel MX and RX servos come from the factory with their baud rate set to 57600. To change this to 1000000 (one million), do:

dynamixel_util Path=/dev/ttyUSB1 Baud=57600 baud rate 1000000

Setting Servo IDs

You can change the id of a servo using dynamixel_util. The most common case is where the id is 1 and you want it to be something else, say 3. To make servo 1 become servo 3, do:

dynamixel_util Path=/dev/ttyUSB1 set 1 3

Note: If there is another servo whose id is 1, you must disconnect that servo from the bus first, so you don't change its id along with that of the new servo. Alternatively, you could set the first servo's id to 99, then connect the new servo, change its id from 1 to 3, and then change the first servo's id from 99 back to 1.

Joining Servo Cables

The longest servo cable sold by Robotis is 7.25 inches. If you need something longer, you can join two cables together using header pins. When you do this, the connection must be asymmetric, as shown in the figure below.

If you accidentally make a symmetric connection between two three-wire cables, you will be shorting signal to ground and the servo bus will be inoperable until the mistake is corrected.

If you accidentally make a symmetric connection between two four-wire cables, you will be shorting signal to power and you will fry the servo! This can be a very expensive mistake.

Accessing Load Information

Dynamixel servos report load as an 11 bit signed value ranging from -1023 to +1023. Tekkotsu's Dynamixel device driver reports this information as a PID duty value by dividing the load signal by 1023.f, resulting in a value between -1.0 and 1.0. The value for servo j can be accessed as state->pidduties[j].

Servo Documentation

Robotis publishes technical descriptions of the servos on its web site.