I bought two servos Dynamixel, the AX-12A, which are the basic servos version of the Korean company Robotis inc.
Dynamixel servomotors are like Ferrari in the world of the cars : the best servomotors on the market.
Some characteristics of these servos:
- Operational Torque: 144 oz-in (10.4 kg.cm)
- 1 / 2 duplex multi-drop serial bus
- 1M bps serial communication
- Reports position, speed, load, voltage, and temperature
- Full rotation mode
- 300 ° angular position in 1024 increments
- Speed and torque control in 1024 increments
- Built in LED status indicator / alarm
- Shutdown on max / min voltage, load or temperature
- Single cable network connection
They are not particularly expensive: about $ 45 U.S., in Europe about 45-50 euros.

These servomotors have difficulty connecting to the Arduino. In fact, the half-duplex communication to 1Mbps requires additional circuitry to make connections to Arduino if there are several servos to be connected. A single servo can be connected directly to the Arduino, in the case of several actuators it is necessary to use a tri-state buffer, which is placed between the Arduino and AX-12A. A simple tri-state buffer is the 74LS241N.
74LS241
The Dynamixel protocol is a serial protocol, so, Arduino side, the buffer 74LS241 must be connected to the serial port and then on pins 0 and 1. This is a problem: if the serial port is used byDynamixel, how to display information through the Arduino IDE Serial monitor?
We need another serial port. The Arduino library NewSoftSerial can help us, but we also need a USB-serial converter. I chose the converter USB2Serial built from Arduino team.
This is a picture of all the components needed to use the Dynamixel Servos.
The 2 ‘strange’ components: the 74LS241 and the USB2Serial converter:
These are all the components wired:
This is the wiring schema (sorry for the manual drawing):
Dynamixel servos require a software library to work with Arduino. An awesome library, realized by Savage Electronics, can be found here. Instructions can be found here.
This is a short video showing the Dynamixel servos in action. It is possible also to see the values printed in the Serial monitor with the NewSoftSerial throw the Serial port between the pins 8 and 9.
This is the code used:
#include <Dynamixel_Serial.h> #include <NewSoftSerial.h> NewSoftSerial mySerial(9,8); //9=tx, 8=rx int k=0; void setup(){ // Configuration Ax12.begin(1000000,2); //2=data control mySerial.begin(9600); //speed of serial port used by NewSoftSerial } void loop(){ // move servo 1 and 2 randomly Ax12.move(1,random(200,600)); Ax12.move(2,random(200,600)); mySerial.print("Number:"); mySerial.println(k++); delay(1000); mySerial.print("Number2:"); mySerial.println(random(100)); }




#1 by Lentin Joseph on 4 September 2012 - 11:55
Quote
Hi
This post looks interesting. Can we work RX and EX series dynamixel servo using this library?
#2 by robottini on 4 September 2012 - 16:28
Quote
Yes, i think that it can be done with a RS-485, but I haven’t a RX or EX servo to test it.
#3 by idee on 11 September 2012 - 23:48
Quote
Hello I was wondering how you would go about setting a servo ID to dynamixel servo.
~Idan
#4 by robottini on 12 September 2012 - 05:24
Quote
You can use this istruction: setID(ID, newID);
Where ID is the current ID and newID is the ID you want
If you don’t know the ID of the servo, you can first reset it.
for(int i = 0; i < = 255;i++)
Ax12.reset(i);
Pay attention, because this code reset all the servo linked. So you have to link only the servo you want reset.
#5 by idee on 13 September 2012 - 01:20
Quote
Thank you so much, this will really help me out.
~Idan
#6 by idee on 23 September 2012 - 21:20
Quote
Well, the circuit is working perfectly, I finished getting it put together a day or two ago. The NewSoftSerial references could to be changed to SoftwareSerial, because the NewSoftSerial library as been included in the Arduino development area as SoftwareSerial. I think this was of because the Dynamixel library been updated or something, so
#include
needed to be changed to
#include
and all of the Ax12. changed to Dynamixel.
And I can’t find why but the
setID(1, 2);
code isn’t working for me the error msg im getting is
sketch_sep23b.cpp: In function ‘void setup()’:
sketch_sep23b:8: error: ‘setID’ was not declared in this scope
If you have any ideas on how to fix that or how I screwed up I would be thankful for the help.
~idan
#7 by idee on 24 September 2012 - 01:47
Quote
Never mind the part about setID(1,2); I tried Dynamixel.setID(1, 2); and that worked
~idan
#8 by carlos on 4 January 2013 - 13:40
Quote
Hello,
Can it work using a normal USB serial adaptor, (with the typical FT232RL), instead of the USB2 serial converted, that it is show here?
#9 by robottini on 4 January 2013 - 15:06
Quote
Really I don’t know. I think should work, but never tried.
#10 by valerio on 15 March 2013 - 18:57
Quote
Hello,
thank you for this post, it’s been very helpful!
I have a problem with the serial monitor: when I open it, the program I loaded to the Arduino stops and nothing happens. When I close it, the program starts running again. What am I doing wrong?
#11 by robottini on 16 March 2013 - 19:12
Quote
Can you check the wiring? Usually the other reason is the power supply not good.
#12 by Zer0 on 20 March 2013 - 23:51
Quote
It looks like ROBOTIS is coming up with a new microcontroller for controlling Dynamixels.
Check it out:
http://www.robotsource.org/xe/Circle_CM9_Developer_World
#13 by Nanda on 7 April 2013 - 21:46
Quote
I’m trying to run just one MX-64 Dynamixel to the Arduino. How do I modify the code to register that? In addition, do I need a USB2Serial converter even for the one servo?
#14 by robottini on 7 April 2013 - 21:50
Quote
sorry, I never worked with the new model MX-64. I don’t know.
#15 by Leo on 8 April 2013 - 09:42
Quote
hi, i am using arduino ax-12 for my project too.
but i have problem reset the motor ID. I use the Buadrate_and_ID_setup lib code and change the SERVO_ID to the desired ID, but it doesnot works. Is there any other parts that i need to change too?
#16 by robottini on 9 April 2013 - 11:17
Quote
This are the only commands you have to use. I don’t know why they don’t work for you. I think that Josué, the guy of http://savageelectronics.blogspot.it/ can help you