Pages: [1] 2   Go Down
Author Topic: Need help for interacting with dynamixel!!  (Read 2629 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: April 27, 2012, 04:14:12 am by AWOL » Logged

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 21
Posts: 3113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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???
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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


Code:
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!
« Last Edit: April 27, 2012, 03:20:46 am by AWOL » Logged

SF Bay Area
Offline Offline
Edison Member
*
Karma: 11
Posts: 1244
Arduino Ninja
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Unique RGB LED Modules and Arduino shields: http://www.macetech.com/store

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 21
Posts: 3113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Full Member
***
Karma: 0
Posts: 162
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
http://savageelectronics.blogspot.com/2011/08/actualizacion-biblioteca-dynamixel.html

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

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 21
Posts: 3113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can you create a diagram to show your wiring?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.


* IMG_1050.JPG (1766.42 KB, 2592x1936 - viewed 94 times.)
Logged

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 21
Posts: 3113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Full Member
***
Karma: 0
Posts: 162
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
« Last Edit: May 01, 2012, 03:54:06 pm by Techylah » Logged

Pages: [1] 2   Go Up
Jump to: