Herkulex 0101 - Arduino Uno/Leonardo connection problem

Hi, I have been looking around forums and could not find the answer.

I have a Herkulex 0101 servo, detail can be seen here:

Right now, my connection consists of
Computer (windows 10) -> Arduino Uno and Arduino Leonardo (I have both) -> Servo.

However, servo LED blinks red even before I write anything to the Arduino.
I have downloaded two different Herkulex libraries and none of it works.
Arduino software can upload data to Arduino but the servo does not responding.

Herkulex Manager does not detect the servo as well.

Lastly, I read that it may be related to baudrate and/or something called as SoftSerial.
I have mechanical engineer background but very limited knowledge to electronics.

Can anyone help me?

Thank you very much

Do you use the VIN pin? The power supply of the herkulex have to be separated from the Arduino one.
You have to link the GND togheter, but only the GND.

Hi alegiaco.
Yes, we are.
We try to use your idea but it still blink red.
However, we start to notice that the red light does not always blink but it will blink when the code is entered.
So maybe the problem is with the code example.

The library is downloaded from here:

It contains example code (which I changed the value of n to 253)

#include <Herkulex.h>

int n=1; //motor ID - verify your ID !!!

void setup()
{
delay(2000); //a delay to have time for serial monitor opening
Serial.begin(115200); // Open serial communications
Serial.println(“Begin”);
Herkulex.begin(115200,10,11); //open serial with rx=10 and tx=11
Herkulex.reboot(n); //reboot first motor
delay(500);
Herkulex.torqueON(n);
Herkulex.initialize(); //initialize motors
delay(200);
}

void loop(){
Serial.println(“Move Angle: -100 degrees”);
Herkulex.moveOneAngle(n, -100, 1000, LED_BLUE); //move motor with 300 speed
delay(1200);
Serial.print(“Get servo Angle:”);
Serial.println(Herkulex.getAngle(n));
Serial.println(“Move Angle: 100 degrees”);
Herkulex.moveOneAngle(n, 100, 1000, LED_BLUE); //move motor with 300 speed
delay(1200);
Serial.print(“Get servo Angle:”);
Serial.println(Herkulex.getAngle(n));

}

Hi Alegiaco,

We realize that the red led will only blink after this line:
Herkulex.begin(115200,10,11); //open serial with rx=10 and tx=11

Have you tried swapping the wires from the RX/TX on the arduino to the servo?

The servo has two pins labeled “TXD” and “RXD”; TXD should go to the RX pin on the Arduino (pin 10) and RXD should go to the TX pin on the Arduino (pin 11). If you have TXD/RXD connected to TX/RX on the Arduino - that might be your problem.

It’s worth reviewing, anyway.

Also note that at that link you posted, they note that the Uno with the software serial connection doesn't do well at the 115200 baud rate the servo, by default, expects. This is because a software serial connection can't maintain this speed (for a few reasons). Instead, they recommend that you use the lower speed of 57600 baud (you may even need to go lower - the software serial library really is only reliable up to 9600 baud; to go higher you have to be careful with your cabling, lengths, etc).

The Mega (which they also have examples for) can go higher because the pins they are using tie into one of the other three hardware serial ports on the Mega, which can support the higher speed of 115200 baud.

Your problem (I think) will be that in order to switch the baud to the lower rates, you need to have some way of communicating with the servo at its current default baud rate (115200 baud).

So - you will either need a Mega - or you'll have to get creative.

I noted that they don't provide any examples for the Due - likely because the Due is fairly new, plus it doesn't have the popularity of the other boards, and it is a 3.3 volt device (meaning that you may need level shifters to get it to communicate with the servo without damage to the Due). That, and the Due may use different pins - I'm not sure if it has other hardware serial ports or what (if it does - and you can hack the driver for the servo to support the Due, and you can verify whether you need level shifting or not - that might be one way to re-program the baud rate of the servo).

Another way - if you can reliably "code blind" (or do a lot of trial and error testing) - would be to using the Arduino's hardware serial port to communicate and change the servo's baud rate to something lower. You might be able to use LEDs on the other pins for status/debug purposes; or if you have some kind of TTL serial to USB serial device - use a software serial connection @ 9600 baud back to your computer (via USB) to monitor it.

Basically - you would want your sketch to set up the hardware serial port to the 115200 baud rate, then wait for a button to be pressed. When it is pressed, send the commands to the servo to change its baud rate. At each step along the way, blink the LED, or print out (to the software serial port) some kind of status message so you know things were successful. Once you have the Arduino loaded with your sketch, disconnect it from the computer, then hook the hardware serial pins (0 and 1) to the servo, then press the button and monitor the status. If/when you get the "all clear" - then reflash the Arduino with the test code you have, but set the baud to the lower rate (whatever it is), and try the example.

Change the first part of the code from:

#include <Herkulex.h>

int n=1; //motor ID - verify your ID !!!!

void setup()  
{
  delay(2000);  //a delay to have time for serial monitor opening
  Serial.begin(115200);    // Open serial communications
  Serial.println("Begin");
  Herkulex.begin(115200,10,11); //open serial with rx=10 and tx=11 
  Herkulex.reboot(n); //reboot first motor
  delay(500); 
  Herkulex.torqueON(n);
  Herkulex.initialize(); //initialize motors
  delay(200);  
}

to:

#include <Herkulex.h>

int n=1; //motor ID - verify your ID !!!!

void setup()  
{
  delay(2000);  //a delay to have time for serial monitor opening
  Serial.begin(115200);    // Open serial communications
  Serial.println("Begin");
  Herkulex.begin(115200,10,11); //open serial with rx=10 and tx=11 
  Herkulex.reboot(n); //reboot first motor
  delay(500); 
  Herkulex.initialize(); //initialize motors
  delay(200);  
  Herkulex.torqueON(n);
}

but i don’t think this is the matter. Using the 57600 baud is very good suggestion. The examples with the UNO use the 57600 speed, not the 115200.

Hi,

I have written a library that is capable of setting up, and driving the HerkuleX DR-0101 and DR-0201. You can find it here: HerkuleXLib v1.0 – Le blog de Benoit Puel

I hope it could help. For instance, the input parameters are given in standard units (degrees, milliseconds) to avoid user to make conversions.

Please fill free to make feedbacks about the library.

Hi,
Did you get your problem solved?
I encounter the same prob. Could you please share if you found the solution, please?
Thanks!