PDA

View Full Version : Arduino Mega 2560 and AX12A servos



DVS
07-08-2013, 02:49 PM
Hi everyone,
I am new to the whole world of robotics and have decided I would like to build a quadruped robot.
The parts I have chosen are the Arduino Mega 2560 R3 and dynamixel AX12A servos. Various other sensors will be incorporated later.
The problem I seem to be having at the moment is that I am not able to write angles to my servo. When I call .attached() I get a true.
At the moment I have the arduino board powered through usb and the servo is powered with a 11.1V external power source with its ground connected to the arduinos with a connection between pins 23 (digital pin 10) and the info line of the servos


This is the code I have been trying to run

#include <Servo.h>

Servo myservo;


void setup()
{
Serial.begin(9600);
myservo.attach(23);
// delay(500);
myservo.write(45);
// delay(1000);
Serial.println(myservo.read());
}


void loop()
{
}

As far as I understand the servo library allows direct angle writing like this to servos using TTL half duplex com protocol.

Perhaps it is in how I am supplying power to the servo but I dont see why It would be a problem doing it this way.
Thanks alot

TXBDan
07-08-2013, 03:12 PM
The Arduino Servo library is for hobby type servos that are controlled by PWM so that won't work for the AX12s.

The Dynamixels run off of a serial bus. You need a Dynamixel specific library like the arbotix bioloid library (Arduino) or the Robotis Dynamixel SDK (C/C++).

I have some info on driving the servos here: http://www.projectsofdan.com/?p=45

jwatte
07-08-2013, 04:12 PM
I responded in your other thread. Please don't double-post!

DVS
07-08-2013, 04:26 PM
Thanks for the replys guys.
I would like to make use of the arbotix library provided, so do I just wire the TX1 and Rx1 pins on my Arduino Mega2560 and connect that up to the data line of the ax12a and then im good to go? Or will I not be able to use this library due to the TX1 and RX1 of the Arbotix being faster than that of the Arduino Mega2560?
Thanks alot