Crea sito

Archive for category Auduino

Dynamixel AX-12A and Arduino: how to use the Serial Port

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
  •   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.


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






I have two friends that play “industrial music” (link).  It is a sort of mix between noises and sounds, very interesting. You can like it or not, but anyway it is interesting. They saw in the Wired magazine, the istructions to realize an Auduino. It is a synthetizer made with an Arduino and some potentiometers. It is very simple to realize. They asked me if I could make this Arduino, because they are always searching for new instruments, new sounds, new noises.

The link to Auduino explanation:

So I realized an Auduino. Because to use an Arduino Uno for a stand-alone application is not a wise decision, I built an Arduino in a breadboard, using these instructions (link)

I modified a little the schema to be more simple. This is the result:




This is Auduino in action: