Legacy Forum: Preserving Nearly 20 Years of Community History - A Time Capsule of Discussions, Memories, and Shared Experiences.

another noob arduino/dynamixel question

Bioloid robot kit from Korean company Robotis; CM5 controller block, AX12 servos..
5 postsPage 1 of 1
5 postsPage 1 of 1

another noob arduino/dynamixel question

Post by Al_f » Tue Nov 24, 2009 3:40 pm

Post by Al_f
Tue Nov 24, 2009 3:40 pm

hi all,
I built an arduino based robot that communicated via an xbee radio to matlab on my pc, the servos were simple pwm based ones.

Recently i decided to go for the dynamixel servos (rx-64) for the strength, compliance and feedback. This is where my problems began! I've asked this question on the arduino forum but i think not many of them use these servos.

So the rx-64 uses RS485 for comms, fine, I bought a couple of Max485's and tested the packet creation with an Arduino- Arduino network, the messages come through fine.

Power up the servo and run the simplest program- turning the LED on and off...nothing.

The program seems super simple and as far as I can tell I have sone what the manual said, i'm now stuck! I have looked at the other posts on the forum, but nothing has helped.

Could anyone point me in the right direction, baud I'm using is 57600 on arduino and rx-64 (i believe it is default speed)

Here's the led test code. Any assitance would be massively appreciated.

Code: Select all
//___________________________________________________________
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// Arduino to dynamixel via rs485
//___________________________________________________________
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

// Define/preallocate parameters
int i = 0;
byte startAddress;
byte servoID = 0xFE; // 0xFE is broadcast to all servos
byte ledOn = 0x01;
byte ledOff = 0x00;

//___________________________________________________________
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// Run setup Function
void setup() {
Serial.begin(57600);
}

//___________________________________________________________
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// Run main Function
void loop() {
//Transmission section

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

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

//___________________________________________________________________
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//Function Definitions
//___________________________________________________________________
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


void activateServos (byte servoID, byte newValue){
  unsigned int checksum_ACK;
  byte notchecksum;
  //startAddress = 0X18;     // Enabling torque for first time
  startAddress = 0X19;     // Turning on led
   
  checksum_ACK =  servoID + 0x03 + 0x03 + startAddress + newValue;
  notchecksum = ~checksum_ACK;
 
  digitalWrite(2,HIGH);     // Notify max485 transciever to accept tx
  delay(5);                 // Allow this to take effect
 
  Serial.print(0xFF,BYTE);  // 1.These 2 bytes are 'start message'
  Serial.print(0xFF,BYTE);  // 2.These 2 bytes are 'start message'
  Serial.print(servoID,BYTE);  // 3.ID is target servo or 0xfe which is broadcast mode
  Serial.print(0x03,BYTE);  // 4.Length of string
  Serial.print(0x03,BYTE);  // 5.Ping read write or syncwrite 0x01,2,3,83
  Serial.print(startAddress,BYTE);  // 6.Start address for data to be written
  Serial.print(newValue,BYTE);  //  7.Turning on signal
  Serial.print(notchecksum,BYTE); //8. the notchecksum

 
  delay(200); // allow last byte to go through
  digitalWrite(2,LOW);  // Notify max485 transciever to recieve
}
hi all,
I built an arduino based robot that communicated via an xbee radio to matlab on my pc, the servos were simple pwm based ones.

Recently i decided to go for the dynamixel servos (rx-64) for the strength, compliance and feedback. This is where my problems began! I've asked this question on the arduino forum but i think not many of them use these servos.

So the rx-64 uses RS485 for comms, fine, I bought a couple of Max485's and tested the packet creation with an Arduino- Arduino network, the messages come through fine.

Power up the servo and run the simplest program- turning the LED on and off...nothing.

The program seems super simple and as far as I can tell I have sone what the manual said, i'm now stuck! I have looked at the other posts on the forum, but nothing has helped.

Could anyone point me in the right direction, baud I'm using is 57600 on arduino and rx-64 (i believe it is default speed)

Here's the led test code. Any assitance would be massively appreciated.

Code: Select all
//___________________________________________________________
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// Arduino to dynamixel via rs485
//___________________________________________________________
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

// Define/preallocate parameters
int i = 0;
byte startAddress;
byte servoID = 0xFE; // 0xFE is broadcast to all servos
byte ledOn = 0x01;
byte ledOff = 0x00;

//___________________________________________________________
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// Run setup Function
void setup() {
Serial.begin(57600);
}

//___________________________________________________________
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// Run main Function
void loop() {
//Transmission section

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

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

//___________________________________________________________________
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//Function Definitions
//___________________________________________________________________
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


void activateServos (byte servoID, byte newValue){
  unsigned int checksum_ACK;
  byte notchecksum;
  //startAddress = 0X18;     // Enabling torque for first time
  startAddress = 0X19;     // Turning on led
   
  checksum_ACK =  servoID + 0x03 + 0x03 + startAddress + newValue;
  notchecksum = ~checksum_ACK;
 
  digitalWrite(2,HIGH);     // Notify max485 transciever to accept tx
  delay(5);                 // Allow this to take effect
 
  Serial.print(0xFF,BYTE);  // 1.These 2 bytes are 'start message'
  Serial.print(0xFF,BYTE);  // 2.These 2 bytes are 'start message'
  Serial.print(servoID,BYTE);  // 3.ID is target servo or 0xfe which is broadcast mode
  Serial.print(0x03,BYTE);  // 4.Length of string
  Serial.print(0x03,BYTE);  // 5.Ping read write or syncwrite 0x01,2,3,83
  Serial.print(startAddress,BYTE);  // 6.Start address for data to be written
  Serial.print(newValue,BYTE);  //  7.Turning on signal
  Serial.print(notchecksum,BYTE); //8. the notchecksum

 
  delay(200); // allow last byte to go through
  digitalWrite(2,LOW);  // Notify max485 transciever to recieve
}
Al_f
Newbie
Newbie
Posts: 3
Joined: Tue Nov 24, 2009 2:38 pm

Post by i-Bot » Tue Nov 24, 2009 5:38 pm

Post by i-Bot
Tue Nov 24, 2009 5:38 pm

I think the length should be 4 not 3. It should be the number of parameters + 2, memory address counts as one parameter.
I think the length should be 4 not 3. It should be the number of parameters + 2, memory address counts as one parameter.
i-Bot
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1142
Joined: Wed May 17, 2006 1:00 am

Post by Al_f » Tue Nov 24, 2009 5:46 pm

Post by Al_f
Tue Nov 24, 2009 5:46 pm

I've got it working now :D :D :D :D :D :D thanks to someone that spotted that I had the length as 0x03 not 0x04 as it should have been, also didn't reset the pin to low. That code will now work if you make those changes.
I've got it working now :D :D :D :D :D :D thanks to someone that spotted that I had the length as 0x03 not 0x04 as it should have been, also didn't reset the pin to low. That code will now work if you make those changes.
Al_f
Newbie
Newbie
Posts: 3
Joined: Tue Nov 24, 2009 2:38 pm

Post by Al_f » Tue Nov 24, 2009 8:24 pm

Post by Al_f
Tue Nov 24, 2009 8:24 pm

thanks i-bot, you noticed it as I was writing the follow-up post. Funnily enough I originally had it as 4 but convinced myself it should be 3 at 2 in the morning when actually i had the + and - signal wires the wrong way round! Working when tired is not a great idea!

Wireless matlab to compliant actuator with a backup controller on the remote microprocessor board suddenly is a possibility.
thanks i-bot, you noticed it as I was writing the follow-up post. Funnily enough I originally had it as 4 but convinced myself it should be 3 at 2 in the morning when actually i had the + and - signal wires the wrong way round! Working when tired is not a great idea!

Wireless matlab to compliant actuator with a backup controller on the remote microprocessor board suddenly is a possibility.
Al_f
Newbie
Newbie
Posts: 3
Joined: Tue Nov 24, 2009 2:38 pm

Re: another noob arduino/dynamixel question

Post by Vittorio » Wed Jan 15, 2014 4:00 pm

Post by Vittorio
Wed Jan 15, 2014 4:00 pm

Hi
i also tried this code but using an MX64 with ttl connection
i just changed the address to broadcast 0xfe
since i was not reading but only sending commands i just used the pin tx(1) of the arduino connecting it to the pin data (3) of the motor.
the red led blinks when i connect the motor but i don't get any response to the commands i send.

may it require a different data format?


i have found this manual,
http://support.robotis.com/en/product/d ... /mx-64.htm

but strangely i have not been able from it to understand how a complete command is formatted, do you have any hint? or a simple example to understand if my code is wrong or my motor is broken?

thanks in advance for any hint
Hi
i also tried this code but using an MX64 with ttl connection
i just changed the address to broadcast 0xfe
since i was not reading but only sending commands i just used the pin tx(1) of the arduino connecting it to the pin data (3) of the motor.
the red led blinks when i connect the motor but i don't get any response to the commands i send.

may it require a different data format?


i have found this manual,
http://support.robotis.com/en/product/d ... /mx-64.htm

but strangely i have not been able from it to understand how a complete command is formatted, do you have any hint? or a simple example to understand if my code is wrong or my motor is broken?

thanks in advance for any hint
Vittorio
Newbie
Newbie
Posts: 1
Joined: Wed Jan 15, 2014 3:32 pm


5 postsPage 1 of 1
5 postsPage 1 of 1