Skip to content

Configuring HerkuleX Servos Without the HerkuleX Manager

November 30, 2012
success: servo with LED lit green

I recently picked up a few more HerkuleX robot servos from Road Narrows.  I love these servos; they have a great form factor, plenty of power for the price, and all the features you’d expect in a modern smart servo, and then some.  Moreover, they have a detailed, clearly written manual written in good English (also available in Korean and Japanese if you prefer).

The only thing they don’t have, is servo manager software that runs on something other than Windows.  I’m a Mac guy, and don’t feel inclined to find a Windows machine at the office or buy a copy of Windows myself just to configure a few servos.  But with communications API so clearly documented, who needs manager software anyway?  So, tonight I configured four servos using nothing but the manual, terminal software, and a little utility I banged out to calculate the checksums (only because I’m too lazy to calculate them every time myself).  Here’s how I did it.

I connected the first servo up to my Mac via a USB-to-serial converter, as described here before.  A new HerkuleX DRS-0101 out of the box has an ID of 0xFD, and speaks at 115200 baud.  My goal was to change the ID of my servos to 1 through 4, and set them all to 57600 baud, which is the fastest my Arduino software serial ports can go reliably.  I then fired up Terminus, my terminal software — but any terminal software that lets you send and receive hexadecimal (i.e. binary data) will do.

I always like to begin by sending the global STAT command; if your communications are working, then any servo on the bus will send back a reply with its ID.  So I did that here, sending

FF FF 07 FE 07 FE 00

and getting back:

FF FF 09 FD 47 B2 4C 00 00

The fourth byte here is the servo ID, 0xFD, just as expected.  Now let’s change that ID to something else.  Any persistent change to the servo configuration means writing to the nonvolatile EEP registers, listed in the table that starts on page 26 of the manual.  Servo ID is register 7, a single byte at register 6.  You write to these things using the EEP_WRITE command (page 43), which takes three bytes: register address, data length, and data.  So, if we want to change the ID to 1, the three data bytes are 0x06, 0x01, 0x01.

Crank out the checksum and assemble the packet (as described on p. 18-20), and you get this full packet string:

FF FF 0A FD 01 F0 0E 06 01 01

Now, EEP changes don’t take effect until the servo is rebooted, and it appears from my experiments that you can only change one EEP register at a time.  On my first one, I rebooted the servo just by cycling the power.  A kinder, gentler method is a soft reboot, by sending it the REBOOT command.

By this point, I’m sure you see the idea — it’s just a matter of looking up the correct command, formatting the packet, and sending it on.  So I’ll spare you the gory details, and just present the final recipe for configuring a servo to 57600 baud, with an ID of 1, 2, 3, or 4:

1. Connect to fresh servo at 115200 baud.
2. Send STAT, make sure you get back the expected report:

Send:    FF FF 07 FE 07 FE 00
Receive:   FF FF 09 FD 47 B2 4C 00 00

3. Send the command to change servo 0xFD to 57600 baud:

Send:  FF FF 0A FD 01 D0 2E 04 01 22

4. Send a REBOOT command to 0xFD:

Send: FF FF 07 FD 09 F2 0C

5. Close the serial port; reopen at 57600 baud.
6. Send STAT, get back expected report (proving the speed change worked):

Send:  FF FF 07 FE 07 FE 00
Receive: FF FF 09 FD 47 B2 4C 00 00

7. Send the command to change servo ID from 0xFD to one of the following…

ID=1: FF FF 0A FD 01 F0 0E 06 01 01
ID=2: FF FF 0A FD 01 F2 0C 06 01 02
ID=3: FF FF 0A FD 01 F2 0C 06 01 03
ID=4: FF FF 0A FD 01 F4 0A 06 01 04

8. Send a REBOOT command to 0xFD:

Send: FF FF 07 FD 09 F2 0C

9. Send STAT one more time:

Send: FF FF 07 FE 07 FE 00
Receive: FF FF 09 04 47 4A B4 00 00 (or similar)

On step 9, the data you get back should have the new servo ID in the fourth byte.  If that matches what you intended, you’re all set!  If not, go back and see whether you have a typo somewhere, or missed a speed change in your terminal software.  This procedure worked for me every time, so it ought to work for you too.

Note that if you do try to talk to your servo at the wrong speed, it will probably go into an error state, with a blinking red LED.  Rebooting the servo will clear the error state.  You can accomplish that by setting your terminal software to the right speed and sending a REBOOT command (step 4 or 8 above), or you can just cycle the power to the servo.

OK, sure, if you have Windows already, then it’s probably easier to just download the free Herkulex Manager software, and use that to configure your servos.  But I find it reassuring that it’s not really necessary.

Once I had my four servos set up with unique IDs, and speaking at a speed the Arduino can handle, I did actually hook them up in a neat chain and start making them go.  But this blog post is long enough already — check back later for the exciting conclusion!

Advertisements

From → Tips

5 Comments
  1. Lukas permalink

    Hi Joe, im trying to communicate with HerkuleX Servo DRS-0201. I’m using Windows 7, I’ve got USB to DB9 Pin cable and made my own PCB Board (http://www.picbasic.co.uk/forum/attachment.php?attachmentid=6059&d=1318746587). On the link where shows microcontroller i am connecting my servo(Rx->Tx and vice versa) I’m using COMTool software to send STAT command to get back from servo what its ID is, but im not getting anything back on receive line. Can you tell me what i might be doing wrong or how i can fix my problem?

  2. Hmm, hard to say. Some things that come to mind to check: is your servo powered up (LED flashed white when you connected it)? Are your TTL levels at 5V rather than 3.3V? Have you double-checked your connections (I know I’ve screwed them up on occasion)? Are you using the same baud rate on both ends (I believe the Herkulex servos default to 115200 baud)?

    If all that seems right, I might try cutting out the custom PCB board, just to see if that’s the trouble. There are a lot of low-cost, compact USB-to-5V-serial adapters available off the shelf. If you have an Arduino or other microcontroller, you might also try verifying your communications by sending the bytes to that, and verifying that you’re reading them correctly.

    Also, since you’re on Windows, you could try the official Herkulex Manager software from Dongbu. That ought to work with your hardware setup (they provide their own USB-serial adapter, but any one should do I think). If it works with that, then it must be a problem in COMTool’s configuration. If not, then something’s wrong with the hardware — either the USB-serial conversion, or the servo itself (though that seems unlikely).

    Hope this helps… keep us posted on how it goes!

    • Cameron Pinnock permalink

      I have a mac and have thing set up on the terminal to communicate with the servo. Connected the LED blinked white. I’m using an Arduino MEGA, how do I implement that code in the terminal. I really want to get this servo rotating.

Trackbacks & Pingbacks

  1. Herkulex servos move in unison « Bot Scene
  2. Herkulex Table Rover | Bot Scene

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: