charlierolando / write-to-xl320-with-a-different-serial-port

Using Dynamixel XL-320 with a different serial port on OpenCM 9.04 or OpenCR 1.0

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

write-to-xl320-with-a-different-serial-port

Using Dynamixel XL-320 with a different serial port on OpenCM 9.04 or OpenCR 1.0

This tools can be used for other boards, but can be used more than 1mbps baudrates on OpenCR 1.0 or up to 1mbps baudrates on OpenCM 9.04

Result

klik this when the image doesn't appear

• See xl320.ino

• Change Serial Port:

#define Serial_Port Serial1

to

#define Serial_Port *Serial_Port

• Change Baudrate configuration:

#define Serial_Baudrate 1000000

to

#define Serial_Baudrate *Baudrate

• Change ID configuration:

const int xl320_id[3] = {0, 1, 2};

to

const int xl320_id[*number_of_servos] = {*ID_1, *ID_2};

• Servo Handle:

  // Talking to Serial_Port using Baudrate Serial_Baudrate, so connect servo data line to TX Serial port
  Serial_Port.begin(*Serial_Baudrate);

  xl320.begin(*Serial_Port); // Hand in the serial object you're using

• Set servo speed:

  // Set the joint speed (0 - 1023)
  xl320.setJointSpeed(*servo_ID, *value);

• Set servo LED color:

  char rgb[] = "rgbypcwo";
  // Set LED color (0-7)
  xl320.LED(*servo_ID, &rgb[*value]);

• Set servo pos:

  // Write pos to servo (0 - 1023)
  xl320.moveJoint(*servo_ID, *pos_value);

• Wiring diagram

Looking from above, with the servo head at the top, wire the left plug of the servo to:

  • PIN1: GND
  • PIN2: 6 ~ 8.4 Volts (Recommended : 7.4 Volts)
  • PIN3: Serial TX

Dynamixel XL-320 wiring diagram

• Other

Setting the servo serial baud rate & servoID

We've included some example sketches to help test and setup your servos. Out of the box they're set to communicate via serial at 1Mbps, so you might want to set them down to something more managable by Arduino at 115200.

Follow the instructions in the sketch XL320_servo_set_baud_rate_or_id.ino and don't forget to power cycle the servos in between setting anything.

Note: when setting the ServoID, the servos default down to 9600 baud, so after you set the servoID you'll need to set the baud rate back up to 115200.

hackerspace-adelaide/XL320

About

Using Dynamixel XL-320 with a different serial port on OpenCM 9.04 or OpenCR 1.0

License:GNU General Public License v2.0


Languages

Language:C++ 93.3%Language:C 6.7%