Problem detecting AX-12A(Out of box Config) using Dynamixel Shield with Arduino Uno

Dynamixel-AX-12A connected to Dynamixel Shield on Arduino Uno.
AX-12A is standard out of the box, no changes made to any parameter.
Official Library Installed.
12V 5A Power Supply.

Arduino is unable to find the AX-12A. I suspect the baud rate of AX-12A is too high for Arduino.
But i do not have a U2D2 to change parameters and check.

Any suggestions?

1 Like

How are you attempting to find the AX12s? Are you utilizing one of ROBOTIS’ example programs, or something you wrote yourself?

I would believe that you should be able to talk to the AX12 servos using the Dynamixel Shield and Arduino Uno, but I personally have not tried this.

That is because in the past I have used a few other AVR boards to talk to these servos. This includes the Arbotix board that was produced and used by Trossen Robotics on their robots.

I have also rigged up Arduino Mega boards for this as well.

And I have USB adapters such as the UsbToAX that was made by Xevel Labs.

All of these used 8 bit AVR based boards like the Uno.

So as suggested it might help to know what software you are using and maybe a picture of your setup.

1 Like

Hi @ishgupta

  1. Below is my custom baudrate scanning and change code for DYNAMIXEL AX and MX series. What only to do, is to define BAUDRATE in the line. --e.g, #define BAUDRATE 9600

    • Note: When I had tested this code today, I’ve found that the AX series with DYNAMIXEL Shield library has some comm issue on Some Baudrate (57600bps). The applicapable Baudrate in use of DynamixelShield library(v0.2.6) with DYNAMIXEL AX series is 9600, 115,200 and 1000000. If you are not using one of them, make sure to change it to one of the list.
  2. DYNAMIXEL Shield has a UART Switch, which determines Upload Mode and DYNAMIXEL control mode. To do DYNAMIXEL, be sure to swtich it to Upload Mode. (The reason is to avoid TX/RX packet collision with hardware serial pins)

code

#include <DynamixelShield.h>

#if defined(ARDUINO_AVR_UNO) || defined(ARDUINO_AVR_MEGA2560)
  #include <SoftwareSerial.h>
  SoftwareSerial soft_serial(7, 8); // DYNAMIXELShield UART RX/TX
  #define DEBUG_SERIAL soft_serial
#elif defined(ARDUINO_SAM_DUE) || defined(ARDUINO_SAM_ZERO)
  #define DEBUG_SERIAL SerialUSB    
#else
  #define DEBUG_SERIAL Serial
#endif

//Please see eManual Control Table section of your DYNAMIXEL.
//This example is written for DYNAMIXEL AX & MX series with Protocol 1.0.
//For MX 2.0 with Protocol 2.0, refer to write_x.ino example.
#define CW_ANGLE_LIMIT_ADDR         6
#define CCW_ANGLE_LIMIT_ADDR        8
#define ANGLE_LIMIT_ADDR_LEN        2
#define OPERATING_MODE_ADDR_LEN     2
#define TORQUE_ENABLE_ADDR          24
#define TORQUE_ENABLE_ADDR_LEN      1
#define LED_ADDR                    25
#define LED_ADDR_LEN                1
#define GOAL_POSITION_ADDR          30
#define GOAL_POSITION_ADDR_LEN      2
#define PRESENT_POSITION_ADDR       36
#define PRESENT_POSITION_ADDR_LEN   2
#define TIMEOUT 10    //default communication timeout 10ms

#define BAUDRATE 1000000 // Any Supported Protocol 

DynamixelShield dxl;

const uint8_t DXL_ID = 1;
const float DXL_PROTOCOL_VERSION = 1.0;
uint8_t turn_on = 1;
uint8_t turn_off = 0;

const int32_t baud[10] = {2000000, 1000000, 500000, 400000, 250000, 200000, 115200, 57600, 19200, 9600};
const int8_t baud_len = 10;
int8_t index = 0;
uint8_t read_baudrate = 0;

void setup() {
  // put your setup code here, to run once:
  // For Uno, Nano, Mini, and Mega, use UART port of DYNAMIXEL Shield to debug.
  DEBUG_SERIAL.begin(115200);   //Set debugging port baudrate to 115200bps
  while(!DEBUG_SERIAL);         //Wait until the serial port for terminal is opened
  
  // Set Port Protocol Version. This has to match with DYNAMIXEL protocol version.
  dxl.setPortProtocolVersion(DXL_PROTOCOL_VERSION);

  for(index = 0; index < baud_len; index++){
    // Set Port baudrate.
    DEBUG_SERIAL.print("SCAN BAUDRATE ");
    DEBUG_SERIAL.println(baud[index]);    
    dxl.begin(baud[index]);
    delay(100);
    if(dxl.ping(DXL_ID)) {
        
        DEBUG_SERIAL.print("ID : ");
        DEBUG_SERIAL.print(DXL_ID);
        DEBUG_SERIAL.println(", Ping Succeed");
        DEBUG_SERIAL.print("Set New Baudrate:"); DEBUG_SERIAL.println(BAUDRATE);
        dxl.setBaud(DXL_ID, BAUDRATE);
        dxl.begin(BAUDRATE);
        // dxl.setPortProtocolVersion(DXL_PROTOCOL_VERSION);
        break;
    }   
  }

}

void loop() {
  // put your main code here, to run repeatedly:

  // LED On
  DEBUG_SERIAL.println("LED ON");
  dxl.write(DXL_ID, LED_ADDR, (uint8_t*)&turn_on, LED_ADDR_LEN, TIMEOUT);
  delay(500);
  
  // LED Off
  DEBUG_SERIAL.println("LED OFF");
  dxl.write(DXL_ID, LED_ADDR, (uint8_t*)&turn_off, LED_ADDR_LEN, TIMEOUT);
  delay(500);

}

This code only perfectly works with DYNAMIXEL Protocol 1.0 models such as AX-xx or MX-xx Series (Aside from MX-XX (2.0))

Thanks for your reply @Yogurt_Man.
I’ll check and get back with the result.

ROBOTIS’ example programs from their Arduino library.