Dynamixel does not execute uploaded example code with arduino

Use the following template to help create your post:

  1. What model(s) of servo are you using?

Dynamixel XM430-W350-T

  1. Describe your control environment. Include the controller or interface, operating system (and version #) of your computer, and how you are powering your robot.

I am using an Arduino Uno (version 1.8.10) with a Dynamixel Shield to control the dynamixel servo motor on Windows 10. I have both ‘Dynamixel2Arduino’ and ‘DynamixelShield’ libraries installed.

Although I am able to upload the code with no problems, when I switch the UART switch to the dynamixel position and I turn on the shield, the Dynamixel does not execute any of the example codes. I can see that when I turn on the power on the shield, the dynamixel LED blinks once, but then nothing happens.
When I control the dynamixel using U2D2 with Dynamixel Wizard everything works fine, it is just when I try to control it with the arduino.

  1. For programming posts, state any libraries or example code you are using. For software posts, be clear about which version of software! R+ Task 3.0, R+ Task 2.0, and RoboPlus Task (“1.0”) can have very different troubleshooting steps, as just one example.

I tried the ‘current_position_mode.ino’ and ‘led.ino’ example codes from the DynamixelShield library, and none of them worked.

  1. Remember to mark your post Solved when applicable!
1 Like

Hi @francisco.goncalves

  1. Make sure to run example at DynamixelShield library.

  2. The common mistake when to use DYNAMIXEL is to miss the proper setup. Confirm that set ID and Baudrates are properly set.


1 Like

Thank you for your reply! Yes, I already checked the ID and baudrate, but the dynamixel still does not execute the example code you mentioned.

1 Like


Upload your code and screenshot of the DYNAMIXEL Wizard 2.0 control table.

I will check,

1 Like

@Yogurt_Man Thank you! Here is the code and the screenshot:

* Copyright 2016 ROBOTIS CO., LTD.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*     http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* See the License for the specific language governing permissions and
* limitations under the License.

/* NOTE: Please check if your DYNAMIXEL supports Current-based Position Control mode 
* Supported Products : MX-64(2.0), MX-106(2.0), All X series(except XL-320, XL430-W250)

#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    
  #define DEBUG_SERIAL Serial

const uint8_t DXL_ID = 1;
const float DXL_PROTOCOL_VERSION = 2.0;

DynamixelShield dxl;

//This namespace is required to use Control table item names
using namespace ControlTableItem;

void setup() {
  // put your setup code here, to run once:
  // For Uno, Nano, Mini, and Mega, use UART port of DYNAMIXEL Shield to debug.
  // Set Port baudrate to 57600bps. This has to match with DYNAMIXEL baudrate.
  // Set Port Protocol Version. This has to match with DYNAMIXEL protocol version.
  // Get DYNAMIXEL information

  // Turn off torque when configuring items in EEPROM area
  dxl.setOperatingMode(DXL_ID, OP_CURRENT_BASED_POSITION);

void loop() {
  // put your main code here, to run repeatedly:
  // Set Goal Current using RAW value
  dxl.setGoalCurrent(DXL_ID, 200);
  dxl.setGoalPosition(DXL_ID, 350.0, UNIT_DEGREE);

  // Print present current
  DEBUG_SERIAL.print("Present Current(raw) : ");

  // Set Goal Current 3.0% using percentage (-100.0 [%] ~ 100.0[%])
  dxl.setGoalCurrent(DXL_ID, 3.0, UNIT_PERCENT);
  dxl.setGoalPosition(DXL_ID, 0);

  // Print present current in percentage
  DEBUG_SERIAL.print("Present Current(ratio) : ");
  DEBUG_SERIAL.println(dxl.getPresentCurrent(DXL_ID, UNIT_PERCENT));

1 Like

Hi @francisco.goncalves You should change the operating mode to current based positiom mode (Operating Mode(Address 11). But it is strange that you failed to set Operating Mode. Can you try to change the mode at Wizard 2.0 and upload the code?

1 Like

Hi @Yogurt_Man , I tried to do that but it did not fix the problem, do you have any other ideas of what might be the issue?

1 Like

It should be the board problem probably. Is the Arduino board or shield alive?

1 Like

Yes, they are both working, I even replaced the Arduino board, but I have the same issue.

1 Like

What power are you putting in? SMPS or battery?

says if you are dividing a power source ( using external power source), you should get a power cap out but as you had seen the LED on when turning on the board, it might not be an issue. After all is not working, shield might be the problem one unfortunately.

Thank you @Yogurt_Man
Yes, I checked that as well. I might just end up ordering a new shield, because I cannot find what the problem is.

1 Like

Generally speaking, the libraries are installed under a subfolder at home/user/Arduino/libraries/ along your set location at Preference.


Therefore, before ending up orderng new product, check out your Skechbook location at Preference (File > Preferences > Setting > Sketchbook location).

The surely confirm what problem is , delete your current Arduino and dynamixel dependent libraries then reinstall everything at the latest with default setup.
Current versions (as of 20 June)

  • Dynamixel2Aruduino v0.6.0
  • DynamixelShield Library v0.2.6

If it does not work out your issue, probably either your board or interface is defective for some reasons.

Hoping this make it work.

Have you tested the basic scanning example included in the DYNAMIXEL2Arduino Library?

Running this example will quickly show us if the problem might only be a simple misconfiguration, or if there is something else preventing communication with the DYNAMIXEL.

1 Like

Thank you for your suggestion, this is what I got from running that example. So, the Dynamixel was not found.

This does sound like it could be an issue with the Shield.

You mentioned that you were considering ordering a replacement shield as you suspected this one could be dead. I would recommend submitting your unit for RMA Service so that it can be evaluated and repaired or replaced if needed.

1 Like