Go Down

Topic: Need help for interacting with dynamixel!! (Read 2933 times) previous topic - next topic

Mew3ang

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.

Techylah

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

}

Mew3ang

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..

Mew3ang

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

Techylah

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.


Mew3ang

That means my arduino is connected to the dynamixel?? I tried to put my motor to move but it still can't move:(

Techylah

"That means my arduino is connected to the dynamixel?"

This is important.  You are using two different serial communication channels on the Arduino.

One is the regular serial UART, used to connect to your host computer via USB.  That channel also uses pins 0 and 1, labeled RX, TX
That is initialized at 9600 baud in your setup.  You also select speed 9600 on your PC. Prntln messages in your Arduino code also get sent on this channel and will appear in your console monitor.

You must use a second serial communication channel to control the Dynamixel.  This channel will be using pins 2 & 3 and coded using the SoftwareSerial library and commands.  It must be set to 57600, the default speed of the RX-28.   The protocol is RS485 (not RS232), so this data needs to first go through the 485 driving chip, as indicated on page 13 of the RX-28 (Dynamixel).  Thus it is Arduino pins 2 and 3, not 0 and 1, which get connected to the 485 chip.

Go Up