Controlling Robotis Dynamixel MX servos with Arduino/ATMEL

Bioloid robot kit from Korean company Robotis; CM5 controller block, AX12 servos..
9 postsPage 1 of 1
9 postsPage 1 of 1

Controlling Robotis Dynamixel MX servos with Arduino/ATMEL

Post by PedroR » Fri Jul 27, 2012 4:42 pm

Post by PedroR
Fri Jul 27, 2012 4:42 pm

Hi all

We've been contacted by an animatronics company who was looking to use MX servos on their Robots for exhibitions and museums.

Their aim is to control the MX servos using either Arduino or mbed.

As you may know there is the excellent Arbotix library for Arduino for controlling AX servos and, since MX-xxTs use the same bus (slightly different memory mapping though), they should - theoretically - work with library.

We've sent the eval material and the software resources to the company and after a number of emails - and great work on their end - they managed to port the code to a normal Arduino (ie not MEGA, with only 1 UART) and have it running on the latest Arudino IDE.

Their work has been posted here http://arduino.cc/forum/index.php/topic,116011.0.html


In short these are the steps to use MX servos with Arduino:

a) The Arbotix library is designed for an Arduino MEGA and expects the servos to be on UART1.

If you're using a normal Arduino, you'll want to check out Pablo Gindel's modified Arbotix library available here: http://www.pablogindel.com/informacion/ ... urce-page/


b) Pablo's library was written for an older Arudino IDE version so the information on that page is partly outdated.

In order to get the library to work with the latest new Arduino IDE (v1) the following steps must be taken:

1) In the ax12.cpp file the "wiring.h" include must be renamed to "Arduino.h".


2) In the HardwareSerial.cpp file, which is now in hardware/arduino/cores/arduino/, the change described no longer works.

You now have to comment out everything after the store_char function up to the serialEventRun function. For the current version this is lines 88 - 160.

3) If you are using anything other than the Arduino Mega, all serial communications must either be commented out or removed as they interfere, due to there only being one serial port.

4) And finally, make sure the Arduino ground is commoned with the servo ground.

This is very easy to forget because plugging the Arduino into a computer provides the board with power, and this connection is often missed on diagrams.



c) If you're using Arduino MEGA, the procedure for step 2 is slightly different:

you only need to comment out the following:

SIGNAL(USART1_RX_vect)
{
unsigned char c = UDR1;
store_char(c, &rx_buffer1);
}



For the latest information you may want to check out the thread on the Arduino forum http://arduino.cc/forum/index.php/topic,116011.0.html which where the developer is maintaining the information.


Please note that while this was endorsed by RoboSavvy the Credit for software development must go to the developers of Arbotix, Pablo Gindel (for modifying it to work with normal Arduino) and finally to Crawley Creatures who have updated the code to work with the latest Arduino IDE and have successfully tested it with MX-xxT servos.

The code should also work with AX servos as well.

Regards
Pedro.

tags: arduino library, dynamixel, mx-28, mx-28t, mx-64t, mx-106t, robotis
Hi all

We've been contacted by an animatronics company who was looking to use MX servos on their Robots for exhibitions and museums.

Their aim is to control the MX servos using either Arduino or mbed.

As you may know there is the excellent Arbotix library for Arduino for controlling AX servos and, since MX-xxTs use the same bus (slightly different memory mapping though), they should - theoretically - work with library.

We've sent the eval material and the software resources to the company and after a number of emails - and great work on their end - they managed to port the code to a normal Arduino (ie not MEGA, with only 1 UART) and have it running on the latest Arudino IDE.

Their work has been posted here http://arduino.cc/forum/index.php/topic,116011.0.html


In short these are the steps to use MX servos with Arduino:

a) The Arbotix library is designed for an Arduino MEGA and expects the servos to be on UART1.

If you're using a normal Arduino, you'll want to check out Pablo Gindel's modified Arbotix library available here: http://www.pablogindel.com/informacion/ ... urce-page/


b) Pablo's library was written for an older Arudino IDE version so the information on that page is partly outdated.

In order to get the library to work with the latest new Arduino IDE (v1) the following steps must be taken:

1) In the ax12.cpp file the "wiring.h" include must be renamed to "Arduino.h".


2) In the HardwareSerial.cpp file, which is now in hardware/arduino/cores/arduino/, the change described no longer works.

You now have to comment out everything after the store_char function up to the serialEventRun function. For the current version this is lines 88 - 160.

3) If you are using anything other than the Arduino Mega, all serial communications must either be commented out or removed as they interfere, due to there only being one serial port.

4) And finally, make sure the Arduino ground is commoned with the servo ground.

This is very easy to forget because plugging the Arduino into a computer provides the board with power, and this connection is often missed on diagrams.



c) If you're using Arduino MEGA, the procedure for step 2 is slightly different:

you only need to comment out the following:

SIGNAL(USART1_RX_vect)
{
unsigned char c = UDR1;
store_char(c, &rx_buffer1);
}



For the latest information you may want to check out the thread on the Arduino forum http://arduino.cc/forum/index.php/topic,116011.0.html which where the developer is maintaining the information.


Please note that while this was endorsed by RoboSavvy the Credit for software development must go to the developers of Arbotix, Pablo Gindel (for modifying it to work with normal Arduino) and finally to Crawley Creatures who have updated the code to work with the latest Arduino IDE and have successfully tested it with MX-xxT servos.

The code should also work with AX servos as well.

Regards
Pedro.

tags: arduino library, dynamixel, mx-28, mx-28t, mx-64t, mx-106t, robotis
PedroR offline
Savvy Roboteer
Savvy Roboteer
Posts: 1199
Joined: Mon Jun 16, 2008 11:07 pm

Post by amartin2 » Sun Sep 23, 2012 9:57 am

Post by amartin2
Sun Sep 23, 2012 9:57 am

I am also trying to connect a MX-28T servo to an Arduino, but have had no luck. I followed the instructions carefully about changing the "Arduino.h" includes and commenting out the lines in the HardwareSerial.cpp, but I think my wiring is the problem.

When I load the program into my Arduino Mega 1280 using the Arduino 1.0.1 IDE, my serial monitor says the following:
deteccion: 0
ID detectado: 1
delay: 0
error lectura: 1920

posicion: 0
velocidad: 0
carga: 0

This is the same output as if I were to run the sketch with absolutely nothing connected. Here is how my wiring is set-up:

I chained 5 batteries in series to raise the voltage up to 12.71 since the recommended voltage of the MX-28 is 10-14.8 volts and the Arduino could only supply 9v.

The Arduino is being powered by the USB.

Ground is connected between the Arduino ground pin, the battery's ground, and the servo ground pin. I heard the ground between the Arduino needs to be connected the ground of the servo's.

The Tx1 and Rx1 are connected in the same row of the breadboard as the data pin for the servo.

If you want to see images, I posed the same message on the Arduino forum.

http://arduino.cc/forum/index.php/topic,116011.0.html

If anyone could offer any help I would be very grateful!

-Alonso Martinez
I am also trying to connect a MX-28T servo to an Arduino, but have had no luck. I followed the instructions carefully about changing the "Arduino.h" includes and commenting out the lines in the HardwareSerial.cpp, but I think my wiring is the problem.

When I load the program into my Arduino Mega 1280 using the Arduino 1.0.1 IDE, my serial monitor says the following:
deteccion: 0
ID detectado: 1
delay: 0
error lectura: 1920

posicion: 0
velocidad: 0
carga: 0

This is the same output as if I were to run the sketch with absolutely nothing connected. Here is how my wiring is set-up:

I chained 5 batteries in series to raise the voltage up to 12.71 since the recommended voltage of the MX-28 is 10-14.8 volts and the Arduino could only supply 9v.

The Arduino is being powered by the USB.

Ground is connected between the Arduino ground pin, the battery's ground, and the servo ground pin. I heard the ground between the Arduino needs to be connected the ground of the servo's.

The Tx1 and Rx1 are connected in the same row of the breadboard as the data pin for the servo.

If you want to see images, I posed the same message on the Arduino forum.

http://arduino.cc/forum/index.php/topic,116011.0.html

If anyone could offer any help I would be very grateful!

-Alonso Martinez
amartin2 offline
Newbie
Newbie
Posts: 4
Joined: Sun Sep 23, 2012 9:45 am

Post by amartin2 » Sun Sep 23, 2012 8:05 pm

Post by amartin2
Sun Sep 23, 2012 8:05 pm

I also tried the following things:

changing my baud rate to 57600 since I read that it's the default for a brand new the MX-28.

AX12::init (57600);

Instead of using Pablo's autoDetect function, hard coding the servo ID to 1, but no luck =(

motor.id = 1;

Thanks!

-Alonso
I also tried the following things:

changing my baud rate to 57600 since I read that it's the default for a brand new the MX-28.

AX12::init (57600);

Instead of using Pablo's autoDetect function, hard coding the servo ID to 1, but no luck =(

motor.id = 1;

Thanks!

-Alonso
amartin2 offline
Newbie
Newbie
Posts: 4
Joined: Sun Sep 23, 2012 9:45 am

Post by PedroR » Mon Sep 24, 2012 10:22 am

Post by PedroR
Mon Sep 24, 2012 10:22 am

Hi amartin

I was about to direct you to the post of the maintainer of the updated library, here http://arduino.cc/forum/index.php/topic,116011.0.html

However I can see you've already posted there, so I trust the author will be able to answer your questions there.

Furthermore, you must make sure you follow all the steps (including modifying the "HardwareSerial.cpp " file as described in the instructions.

Pedro.
Hi amartin

I was about to direct you to the post of the maintainer of the updated library, here http://arduino.cc/forum/index.php/topic,116011.0.html

However I can see you've already posted there, so I trust the author will be able to answer your questions there.

Furthermore, you must make sure you follow all the steps (including modifying the "HardwareSerial.cpp " file as described in the instructions.

Pedro.
PedroR offline
Savvy Roboteer
Savvy Roboteer
Posts: 1199
Joined: Mon Jun 16, 2008 11:07 pm

Post by amartin2 » Mon Sep 24, 2012 5:40 pm

Post by amartin2
Mon Sep 24, 2012 5:40 pm

Hey Pedro!

I will try downloading the Arduino software again, restore the "HardwareSerial.cpp" and modify the ax12.cpp and "HardwareSerial.cpp" once more.

What combination are you running? I'm using the the one below:

MX-28T servo
Arduino Mega 1280
Arduino 1.0.1 IDE
Dynamixel AX-12+ Arduino Library, v2.3

Thanks for the response! I spent all weekend trying to figure this out and haven't gotten that very expensive servo to move once! I'm sure it will be awesome when it does though =)

-Alonso
Hey Pedro!

I will try downloading the Arduino software again, restore the "HardwareSerial.cpp" and modify the ax12.cpp and "HardwareSerial.cpp" once more.

What combination are you running? I'm using the the one below:

MX-28T servo
Arduino Mega 1280
Arduino 1.0.1 IDE
Dynamixel AX-12+ Arduino Library, v2.3

Thanks for the response! I spent all weekend trying to figure this out and haven't gotten that very expensive servo to move once! I'm sure it will be awesome when it does though =)

-Alonso
amartin2 offline
Newbie
Newbie
Posts: 4
Joined: Sun Sep 23, 2012 9:45 am

Post by PedroR » Mon Sep 24, 2012 6:51 pm

Post by PedroR
Mon Sep 24, 2012 6:51 pm

Hi amartin2

This post http://arduino.cc/forum/index.php/topic,116011.0.html as well as Pablo Gidndel's work is for using AX/MX servos with a regular Arduino (not a MEGA; an Uno or similar).

Therefore if you're using an Arduino MEGA, that's probably the reason why it's not working for you.

There is another Arduino board?project that you may want to check out which is Arbotix.

Arbotix is the original library (developed for an Arduino with multiple UARTs) and the work above is derived from Arbotix.

I know Arbotix uses something similar to Arduino mega although I don't think it's an ATMEGA1280.


There is no official support for using Robotis servos with Arduino, and there seem to be significant changes between revisions of the Arduino IDE.

My best recommendation, if you're using an Arduino MEGA, is to also check the Arbotix project.

Regards
Pedro
Hi amartin2

This post http://arduino.cc/forum/index.php/topic,116011.0.html as well as Pablo Gidndel's work is for using AX/MX servos with a regular Arduino (not a MEGA; an Uno or similar).

Therefore if you're using an Arduino MEGA, that's probably the reason why it's not working for you.

There is another Arduino board?project that you may want to check out which is Arbotix.

Arbotix is the original library (developed for an Arduino with multiple UARTs) and the work above is derived from Arbotix.

I know Arbotix uses something similar to Arduino mega although I don't think it's an ATMEGA1280.


There is no official support for using Robotis servos with Arduino, and there seem to be significant changes between revisions of the Arduino IDE.

My best recommendation, if you're using an Arduino MEGA, is to also check the Arbotix project.

Regards
Pedro
PedroR offline
Savvy Roboteer
Savvy Roboteer
Posts: 1199
Joined: Mon Jun 16, 2008 11:07 pm

Help with the Library!

Post by beepboop » Fri Nov 16, 2012 8:09 am

Post by beepboop
Fri Nov 16, 2012 8:09 am

Hi Pedro!

I am working on a project that requires me to control two Dynamixel MX-28T servo motors using a Wii Nunchuck. Thus I got an Arduino Uno and I used a code to read the accelerometer values from the Wii Nunchuck to move a normal PMW servo motor. But in regards to the Dynamixel motors, I'm at a complete loss. I tried to follow the steps that was so well outlined, but I can't find a HardwareSerial.cpp file. I have only a HardwareSerial.h file in my hardware/arduino/core/arduino folder. I am at my wit's end and the internet is just not yielding any information. I'm beginning to wonder if what I'm attempting is even possible. Please answer quickly and thank you for all your help!
Hi Pedro!

I am working on a project that requires me to control two Dynamixel MX-28T servo motors using a Wii Nunchuck. Thus I got an Arduino Uno and I used a code to read the accelerometer values from the Wii Nunchuck to move a normal PMW servo motor. But in regards to the Dynamixel motors, I'm at a complete loss. I tried to follow the steps that was so well outlined, but I can't find a HardwareSerial.cpp file. I have only a HardwareSerial.h file in my hardware/arduino/core/arduino folder. I am at my wit's end and the internet is just not yielding any information. I'm beginning to wonder if what I'm attempting is even possible. Please answer quickly and thank you for all your help!
beepboop offline
Newbie
Newbie
Posts: 1
Joined: Fri Nov 16, 2012 7:59 am

Post by PedroR » Fri Nov 16, 2012 4:12 pm

Post by PedroR
Fri Nov 16, 2012 4:12 pm

Hi beebop

The best source of information for using MX28-T and Arduino is the one posted here http://arduino.cc/forum/index.php/topic,116011.0.html

If you can't find the necessary files, it is possible you may have to downgrade to a previous version of the Arduino IDE.

I'm not sure but I believe the tutorial on the Arduino forum was written for Arduino IDE v1 or v.1.0.1

Regards
Pedro
Hi beebop

The best source of information for using MX28-T and Arduino is the one posted here http://arduino.cc/forum/index.php/topic,116011.0.html

If you can't find the necessary files, it is possible you may have to downgrade to a previous version of the Arduino IDE.

I'm not sure but I believe the tutorial on the Arduino forum was written for Arduino IDE v1 or v.1.0.1

Regards
Pedro
PedroR offline
Savvy Roboteer
Savvy Roboteer
Posts: 1199
Joined: Mon Jun 16, 2008 11:07 pm

Post by Epen99 » Tue Sep 03, 2013 8:25 pm

Post by Epen99
Tue Sep 03, 2013 8:25 pm

f you are using anything other than the Arduino Mega, all serial communications must either be commented out or removed as they interfere, due to there only being one serial port.

livescore goldclub slot slot
f you are using anything other than the Arduino Mega, all serial communications must either be commented out or removed as they interfere, due to there only being one serial port.

livescore goldclub slot slot
Epen99 offline
Newbie
Newbie
Posts: 1
Joined: Tue Sep 03, 2013 8:22 pm


9 postsPage 1 of 1
9 postsPage 1 of 1
cron