Need help for interacting with dynamixel!!

Hi,
I am connecting arduino UNO board to rs485 to control my dynapixel rx28. I tried to program the led on and off from the motor but it seem like it can't work. Any kind soul please help me. Thanks in advance.

Moderator edit: Thread title fixed.

What is a dynapixel rx28? I'm not sure what 'program the led on and off from the motor' means. Is there a switch on the motor that you are trying to read?

I am sorry the motor is dynamixel. The motor itself have a led which is program through arduino UNO board via rs458 ic chip. But I have difficulties lighting up the led and moving the motor. Could u help me???

These are the codes which i used to program the arduino board.

int ledPin = 13;
int i = 0;
byte startAddress;
byte servoID = 0x01;
byte ledOn = 0x01;
byte ledOff = 0x00;

void setup() {
Serial.begin(9600);
//int DEPin=2;//The pin to be used for enable/disable signal
//digitalWrite(DEPin, HIGH); // tell max485 to transmit
pinMode(ledPin,OUTPUT);
}

void loop() {
delay(1);

if (i%2==0){
activateServos(servoID,ledOn);
delay(200);
}else{
activateServos(servoID,ledOff);
delay(200);
}

i++;
if (i>1000){
 i=1;
}
}

void activateServos (byte servoID, byte newValue){
  int checksum_ACK;
  byte notchecksum;
  startAddress = 0x19;
  
  checksum_ACK = servoID + 0x03 +0x03 +startAddress +newValue;
  notchecksum = ~checksum_ACK;
  
  digitalWrite(2,HIGH);
  delay(5);
  
  Serial.print(0xFF,BYTE);
  Serial.print(0xFF,BYTE);
  Serial.print(servoID,BYTE);
  Serial.print(0x03,BYTE);
  Serial.print(0x03,BYTE);
  Serial.print(startAddress,BYTE);
  Serial.print(newValue,BYTE);
  Serial.print(notchecksum,BYTE);
  
  delay(3);
}

Moderator edit: Code tags added.

Could any kind soul help us see what is the problem?? Thanks!

Please pretend for a moment that you're talking to people who have no idea what a "dynamixel rx28" is or what it's supposed to do. Also pretend they have no idea what you've already tried, what you want it to do, and what it's actually doing.

Please pardon me as this is my first time asking questions in forum. This is rx-28 motor which i am having difficulties to program it to have the LED blink and operate to move the gear.http://crustcrawler.com/motors/RX28/index.php?prod=66 I tried to make the motor LED to light up using the code above with arduino UNO through RS485 type signal but with no avail. Can someone help me check if there is any problem with the codes to make the moto LED blink. Thanks and sorry in advance.

How are you connecting up to the RS485 port on the rx28?

http://crustcrawler.com/motors/RX28/docs/RX28_Manual.pdf Page 13. I followed the diagram given on the data sheet. For the RX and TX and Direction pin i connect it to the arduino board. For D+ and D- i connect it to the motor.

Whoa! Way cool device. It does a lot. You need a polished library to help.
Check out this article.
http://robottini.altervista.org/dynamixel-ax-12a-and-arduino-how-to-use-the-serial-port

also this is the "awesome library" link:

Google Arduino Dynamixel and get the best library you can.
Make sure you use their serial trick because you need 2 serial communication channels, one to the user and one to the
[daisy chain of] dynamixel(s).

This looks like one of the most fun and capable devices I've ever seen.
Wish I had the time and resources to play.

You mean I can control the led and moto speed etc using the polish library? Is there any sample Codes for refrences?

I have confirm that my arduino can connect with RS458 IC chip as there is signal coming out from pin 6,7.. But i still cant connect with the Rx-28 motor. The below are the code that i used to program.

void setup () {

pinMode(13,OUTPUT);
}

void loop ()
{
Serial.begin(9600);

Serial.print(0xFF,BYTE);
Serial.print(0xFF,BYTE);
Serial.print(0x01,BYTE);
Serial.print(0x19,BYTE);
Serial.print(0x03,BYTE);
Serial.print(0x18,BYTE);
Serial.print(0x01,BYTE);
Serial.print(0x01,BYTE);
Serial.print(0xDD,BYTE);
}

Could any pros out there help me to see what is wrong? Thanks in advance.

Can you create a diagram to show your wiring?

This is the diagram of how i connect the arduino uno to the rx-28 motor.. I used a led to test if there is any output at pin 7 and the led lighted up.

I guess no-one else has one of these things. I don't, so can only really offer general advice.

Here's the main problem. I just zoomed in on your connection to the RS485.
You are connecting the USB serial lines to the RS485.
These are two different serial communication channnels that need to be in place.

Fo another thing, your baud rates are mismatched.
You set the Arduino to 9600 baud. This is for the console app on your PC and communication to it.
You want and need a higher speed to communicate with the dynamixels. It should use two other pins.
Those two digital pins are the ones you should level shift as per page 13.
According to page 22 of the RX28 manual, it defaults to 57,600 baud.
Set the arduino rate of the other serial comm to that.
Lookup SerialLibrary in the Reference section.
Leave serial.print() for your console.

Also, for a first sketch just write a loop doing a Ping command, page 35, and waiting for a response.
It's an easier command, 6 bytes to send, 6 bytes to receive.
Echo both the sent and received messages to the console and loop.

This should get you started.
First make sure you can communicate with the Ping command and get a proper response as echoed on the PC console.
That should ensure you are using the alternate SerialLibrary, setting it to the proper pin and baud rate, and that your level shifters are wired correctly.

Once that's working, you can either remove the echo to the console or increase the console baud rate since, at 9600 it is 6 times slower than the dynamixel communication. It will slow everything way down if you continue to log all dynamixel commands to the console.

Then you can gradually build up a sketch that waits for simple keystrokes or user commands from the console and then sends a set of commands to the dynamixel(s).
Then the fun really starts. What a fine device!

Hey Techylah, Thanks for the response.
I am not sure of the codes to ping the serial comminication and my motor... I have tried using the savage library but the arudino serial monitor have weird codes which keeping coming out.

I'm not sure you're communicating with it yet.
Code should look something like this. See SoftwareSerial ( http://arduino.cc/en/Reference/SoftwareSerial )
Your RS485 should go to pins 2 i& 3

#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); // RX, TX

void setup()
{
Serial.begin(9600);
mySerial.begin(57600); // set the data rate for the SoftwareSerial port
}

void loop() // run over and over
{
int numBytesAvail;

mySerial.print(0xff, BYTE); // PING command
mySerial.print(0xff, BYTE);
mySerial.print(0x01, BYTE);
mySerial.print(0x02, BYTE);
mySerial.print(0x01, BYTE);
mySerial.print(0xfb, BYTE);

delay(100);
numBytesAvail = mySerial.available(); // get number of bytes in response message
for (i=0; i<numBytesAvail; i++)
Serial.print(mySerial.read(), HEX); // print each one as hex number on console

}

I am sorry Techylah, when i try to put in the codes you type and from the arduino website, i have this error which says 'class SoftwareSerial' has no member named 'available'.. I have tried to reinstall my arduino 2.3 but the problem still persist..

Okay i have tried to make a ping but it shows nothing on the serial communication.. =( =(

Your screen shot shows you are looking on COM4 for serial communication. (that is set to 57,600 baud).
The messages you should be watching are on the regular COM line, the one set to 9600 and on which all ARduino example
println messages appear.
You can not directly see Arduino communication to and from the dynamixel on any screen.
That is why the program reads back each char of the dynamixel response and sends it to the user console.