background image

RoboClaw Series 

Brushed DC Motor Controllers

RoboClaw Series User Manual

97

BASICMICRO

50 - Drive M1 / M2 With Signed Speed And Individual Acceleration

Drive M1 and M2 in the same command using one value for acceleration and two signed speed 

values for each motor. The sign indicates which direction the motor will run. The acceleration 

value is not signed. The motors are sync during acceleration. This command is used to drive 

the motor by quad pulses per second and using an acceleration value for ramping. Different 

quadrature encoders will have different rates at which they generate the incoming pulses. The 

values used will differ from one encoder to another. Once a value is sent the motor will begin to 

accelerate incrementally until the rate defined is reached.

Send: [Address, 50, AccelM1(4 Bytes), SpeedM1(4 Bytes), AccelM2(4 Bytes),   

 

 

 

SpeedM2(4 Bytes), CRC(2 bytes)]

Receive: [0xFF]

The acceleration is measured in speed increase per second. An acceleration value of  12,000 

QPPS with a speed of 12,000 QPPS would accelerate a motor from 0 to 12,000 QPPS in 1 second. 

Another example would be an acceleration value of 24,000 QPPS and a speed value of 12,000 

QPPS would accelerate the motor to 12,000 QPPS in 0.5 seconds.

51 - Buffered Drive M1 / M2 With Signed Speed, Individual Accel And Distance

Drive M1 and M2 with a speed, acceleration and distance value. The sign indicates which 

direction the motor will run. The acceleration and distance values are not signed. This command 

is used to control both motors top speed, total distanced traveled and at what incremental 

acceleration value to use until the top speed is reached. Each motor channel M1 and M2 have 

separate buffers. This command will execute immediately if no other command for that channel 

is executing, otherwise the command will be buffered in the order it was sent.  Any buffered 

or executing command can be stopped when a new command is issued by setting the Buffer 

argument. All values used are in quad pulses per second.

Send: [Address, 51, AccelM1(4 Bytes), SpeedM1(4 Bytes), DistanceM1(4 Bytes),    

 

AccelM2(4 Bytes), SpeedM2(4 bytes), DistanceM2(4 Bytes), Buffer, CRC(2 bytes)]

Receive: [0xFF]

The Buffer argument can be set to a 1 or 0. If a value of 0 is used the command will be buffered 

and executed in the order sent.  If a value of 1 is used the current running command is stopped, 

any other commands in the buffer are deleted and the new command is executed.

52 - Drive M1 With Signed Duty And Acceleration

Drive M1 with a signed duty and acceleration value. The sign indicates which direction the motor 

will run. The acceleration values are not signed. This command is used to drive the motor by 

PWM and using an acceleration value for ramping. Accel is the rate per second at which the duty 

changes from the current duty to the specified duty.

Send: [Address, 52, Duty(2 bytes), Accel(2 Bytes), CRC(2 bytes)]

Receive: [0xFF]

The duty value is signed and the range is -32768 to +32767(eg. +-100% duty). The accel value 

range is 0 to 655359(eg maximum acceleration rate is -100% to 100% in 100ms).

Summary of Contents for Roboclaw 2x120A

Page 1: ...Claw 2x15A RoboClaw 2x30A RoboClaw 2x45A RoboClaw 2x45A ST RoboClaw 2x60A Roboclaw 2x60HV Roboclaw 2x120A Roboclaw 2x160A Roboclaw 2x200A User Manual Firmware 4 1 34 and Newer Hardware V3 V4 V5 V6 and...

Page 2: ...and to the Basicmicro s knowledge there is no basis for any present or future action against the company giving rise to any liability arising out of any injury to individuals or property as a result...

Page 3: ...Inputs 13 Encoder Inputs 13 Logic Battery LB IN 13 BEC Source LB MB 13 Encoder Power 14 Main Battery Screw Terminals 14 Main Battery Disconnect 14 Motor Screw Terminals 14 Easy to use Libraries 14 Mot...

Page 4: ...Automatic Battery Detection on Startup 39 Manual Voltage Settings 39 Wiring 40 Basic Wiring 40 Safety Wiring 41 Encoder Wiring 41 Logic Battery Wiring 42 Logic Battery Jumper 42 Status LEDs 43 Status...

Page 5: ...Serial Mode 58 Address 58 Packet Modes 58 Packet Serial Baud Rate 58 Serial Mode Options 58 Packet Timeout 59 Packet Acknowledgement 59 CRC16 Checksum Calculation 59 CRC16 Checksum Calculation for Re...

Page 6: ...and for RC Analog controls 71 77 Read DeadBand for RC Analog controls 72 80 Restore Defaults 72 81 Read Default Duty Acceleration Settings 72 82 Read Temperature 72 83 Read Temperature 2 72 90 Read St...

Page 7: ...peeds Counters 88 108 Read Motor Average Speeds 89 111 Read Speed Errors 89 114 Read Position Errors 89 Advanced Motor Control 90 Advanced Motor Control Commands 90 28 Set Velocity PID Constants M1 91...

Page 8: ...et Motor 2 Position PID Constants 99 63 Read Motor 1 Position PID Constants 99 64 Read Motor 2 Position PID Constants 99 65 Buffered Drive M1 with signed Speed Accel Deccel and Position 99 66 Buffered...

Page 9: ...oper way to shut down a motor controller Any connected I O to RoboClaw will create a ground loop and cause damage to RoboClaw and attached devices Always disconnect the positive power lead first Brush...

Page 10: ...taken to avoid run away conditions The wheels of a robot should not be in contact with any surface until all development is complete If the motor is embedded ensure you have a safe and easy method to...

Page 11: ...unpredictable behavior Encoders RoboClaw features dual channel quadrature absolute decoding When wiring encoders make sure the direction of spin is correct to the motor direction Incorrect encoder con...

Page 12: ...n Studio is the preferred method of configuration with additional options not available using the on board buttons However these additional options are not critical to RoboClaw s basic operation This...

Page 13: ...ave their own supply and will conflict with the RoboClaw s 5v logic supply It may be necessary to remove the 5V pin from the RC receivers cable in those cases Encoder Inputs EN1 and EN2 are the inputs...

Page 14: ...the battery This will vary depending on the type of motors and or power source you are using A typically solution would be an inexpensive contactor which can be sourced from sites like Ebay A power d...

Page 15: ...nning Motion Studio From this screen you can select a detected RoboClaw and connect 1 More than one RoboClaw can be connected at a time Box 1 is where the desired RoboClaw is selected After the RoboCl...

Page 16: ...heck box to activate the Stop All function by using the space bar on the keyboard This is a safety feature and is the quickest method to stop all motor movements when using Motion Studio Device Status...

Page 17: ...HI Main battery over voltage MBLO Main battery under voltage LBHI Logic battery over voltage LBLO Logic battery under voltage TMP1 Temperature 1 TMP2 Optional temperature 2 on some RoboClaw models M1D...

Page 18: ...r the selected mode Settings are only stored in RAM until the user writes the settings to the RoboClaw s non volatile memory Select Write Settings under Device in the menu bar Label Function Descripti...

Page 19: ...Sliders are provided to control each motor channel This screen can also be used to determine the QPPS of attached encoders 1 Graph Function Description Grid Displays channel data with 100mS update rat...

Page 20: ...Description Scale Sets vertical scale to fit the range of the specified Channel Channels Select data to display on the channel The channel is graphed in the color shown Channel options M1 or M2 Setpoi...

Page 21: ...ph Function Description Grid Displays channel data with 100mS update rate and one second horizontal divisions 2 Velocity Settings Function Description Velocity P Proportional setting for PID Velocity...

Page 22: ...2 Start motor 2 velocity auto tune Level Adjust auto tune 2 values agressiveness Sllide left for softer control 4 Graph Channels Function Description Scale Sets vertical scale to fit the range of the...

Page 23: ...O Position Settings The Position settings screen is used to set the encoder and PID settings for position control The screen is also used for testing and plotting 1 Graph Function Description Grid Dis...

Page 24: ...Main Battery Voltage Logic Battery Voltage Clear Clears channels graphed line 3 Position Settings Function Description Velocity P Proportional setting for velocity PID Velocity I Integral setting for...

Page 25: ...el Acceleration rate used when moving the sliders Deccel Decceleration rate used when moving the sliders Speed Speed to use with slide move Position Numeric value of slider motor position Autotune Met...

Page 26: ...o application 2 Apply a reliable power source such as a fully charge battery to power the motor controller 3 Connect the powered motor controller to a USB port on your computer with Motion Studio alre...

Page 27: ...e update button 3 to start the process 2 Motion Studio will begin to update the firmware While the firmware update is in progress the onboard LEDs will begin to flash The onboard flash memory will fir...

Page 28: ...d Very similar to how a regular servo is controlled RC mode can use encoders if properly setup See Encoder section Analog Analog mode uses an analog signal from 0V to 2V to control the speed and direc...

Page 29: ...ify installation If the USB driver is not found Ion Studio will install it 1 Open the Motion Studio application 2 Apply a reliable power source such as a fully charged battery to power up RoboClaw 3 C...

Page 30: ...r Controllers RoboClaw Series User Manual 30 BASICMICRO Control Mode Setup Select the Control Mode drop down 1 There are 4 main modes See the Control Modes section of this manual for a detailed explan...

Page 31: ...l settings screen is used to configure RoboClaw Each control mode will have several configuration options Grayed out options are not available for the selected mode Once all settings are configured th...

Page 32: ...nit Sets S2 pin to open drain Allows multiple Roboclaws to be controlled from a single serial port USB TTL Relay Enables RoboClaw to pass data from USB through S1 RX and S2 TX Allows several RoboClaws...

Page 33: ...s Range is 1V 4 RC Analog Options Configure RC and Ananlog control options Set control type in RC and Analog modes Function Description Mixing Mixes S1 and S2 inputs for control of a differentially st...

Page 34: ...amp rate of acceleration for motor channel 1 A value of 1 to 655 360 can be used Value of 0 sets the internal default for Accel and Deccel Value of 655 360 equals 100mS full forward to reverse ramping...

Page 35: ...ault function for S5 S4 S5 Duty Sets the auto homing duty percentage When velocity or postion control is configured duty sets the speed percentage S4 S5 Timeout Sets the auto homing timeout in seconds...

Page 36: ...Controls a robot like a tank S1 controls motor 1 forward or reverse and S2 controls motor 2 forward or reverse 2 R C mode with mixing Same as Mode 1 with mixing enabled Channels are mixed for differe...

Page 37: ...peed 3 TTL Flip and MCU Enabled Disables auto calibrate Allows slow MCU to send R C pulses at lower than normal R C rates 4 TTL Flip and Exp and MCU Enabled Option 2 and 3 combined 5 RC Flip Switch R...

Page 38: ...ase the LIPO button The STAT2 LED will begin to blink out the current setting 2 Press SET to increment to the next setting Press MODE to decrement to the previous setting 3 Once the desired setting is...

Page 39: ...ted should be confirmed on power up Undercharged or overcharged batteries can cause an incorrect auto detection voltage Manual Voltage Settings The minimum and maximum voltage can be set using the Mot...

Page 40: ...safety concerns are minimal Never underestimate a motorized system in an uncontrolled condition In addition RoboClaw is a regenerative motor controller If the motors are moved when the system is off i...

Page 41: ...r a 60VDC motor controller which will give a pre charge time of about 15 seconds A lower resistances can be used with lower voltages to decrease the pre charge time Encoder Wiring A wide range of sens...

Page 42: ...is supplied by the secondary logic battery if supplied The mAh of the logic battery should be determined based on the load of attached devices powered by the regulated 5V user output Logic Battery Jum...

Page 43: ...The status 2 LED will light when either drive stage is active Message Types There are 3 types of messages RoboClaw can indicate The first type is a fault When a fault occurs both motor channel outputs...

Page 44: ...limited Error LED blinking twice STAT1 or STAT2 indicates channel Driver Fault Fault Motors freewheel Damage detected Error LED blinking three times Logic Battery High Fault Motors freewheel until re...

Page 45: ...controls direction of motor to reach switch Limit Forward Motor moves forward rotation until switch tripped Limit Reverse Motor moves in reverse rotation until switch tripped RS 485 Direction Output S...

Page 46: ...o 5VDC or 3 3VDC should be used if wire lengths exceed 6 150mm The circuit below shows a NO normally open style switch Connect the NO to S4 or S5 and the COM end to a power ground shared with RoboClaw...

Page 47: ...for larger motors 50 watts will likely cover most situation smaller wattage resistor may work Voltage Clamp Circuit Wire the circuit as shown below Q1 should be a 3V logic level MOSFET An example wou...

Page 48: ...ltages Testing should consist of a running the motor up to 25 of its speed and then quickly slowing down without braking or e stop while checking the voltage spike Repeat by increasing the speed and p...

Page 49: ...perating in bridged channel mode the total peak current output is combined from both channels The peak current run time is dependant on heat build up Adequate cooling must be maintained Bridged Channe...

Page 50: ...ing commands to the RoboClaw both those commands and USB packet serial commands will execute USB Power The USB RoboClaw is self powered This means it receives no power from the USB cable The USB RoboC...

Page 51: ...ch Flip switch triggered by low signal 2 TTL Flip and Exponential Enabled Softens the center control position This mode is ideal with tank style robots Making it easier to control from an RC radio Fli...

Page 52: ...the receiver then RoboClaw It will take RoboClaw about 1 second to calibrate the neutral positions of the RC controller After RC pulses start to be received and calibration is complete the Stat1 LED...

Page 53: ...per operation Once calibrated values have been set and saved into Roboclaws eeprom encoder support using velocity or position PID control can be enabled Use Ion Studio control software or PacketSerial...

Page 54: ...hematic The POT acts as one half of the resistor divider If using a 5k potentiometer R1 R2 7 5k If using a 10k potentiometer R1 R2 15k and if using a 20k potentiometer R1 R2 30k Set mode 3 with option...

Page 55: ...rrection It is recommended to use Packet Serial mode instead for more reliable communications Serial Mode Baud Rates Option Description 1 2400 2 9600 3 19200 4 38400 5 57600 6 115200 7 230400 8 460800...

Page 56: ...m below shows the main battery as the only power source Make sure the LB jumper is set correctly The 5VDC shown connected is only required if your MCU needs a power source This is the BEC feature of R...

Page 57: ...e connected to the same MCU transmit pin Each RoboClaw S2 pin should be connected to a unique I O pin on the MCU S2 is used as the control pin to activate the attached RoboClaw To enable a RoboClaw ho...

Page 58: ...s selected by setting the desired packet mode using the MODE button NOTE When using packet serial commands via the USB connection the address byte can be any value from 0x80 to 0x87 since each USB con...

Page 59: ...complex than a simple checksum but prevents errors that could otherwise cause unexpected actions to execute on the Roboclaw The CRC can be calculated using the following code example in C Calculates C...

Page 60: ...t values numbers with decimal places are used in Packet Serial commands To convert a 32bit value into 4 bytes you just need to shift the bits around unsigned char byte3 MyLongValue 24 High byte unsign...

Page 61: ...the baud rate is set at or below 38400 This will allow slower processors and processors without UARTs to communicate with RoboClaw The diagram below shows the main battery as the only power source Th...

Page 62: ...e enabled and have a unique packet serial address set This can be configured using Motion Studio Wire the S1 and S2 pins directly to the MCU TX and RX pins Install a pull up resistor R1 on the MCU RX...

Page 63: ...ve Forward M1 Drive motor 1 forward Valid data range is 0 127 A value of 127 full speed forward 64 about half speed forward and 0 full stop Send Address 0 Value CRC 2 bytes Receive 0xFF 1 Drive Backwa...

Page 64: ...V 62 16V 82 and 24V 123 Send Address 3 Value CRC 2 bytes Receive 0xFF 4 Drive Forward M2 Drive motor 2 forward Valid data range is 0 127 A value of 127 full speed forward 64 about half speed forward a...

Page 65: ...ix mode Valid data range is 0 127 A value of 0 full stop and 127 full reverse Send Address 9 Value CRC 2 bytes Receive 0xFF 10 Turn right Turn right in mix mode Valid data range is 0 127 A value of 0...

Page 66: ...rmware Version 24 Read Main Battery Voltage 25 Read Logic Battery Voltage 26 Set Minimum Logic Voltage Level 27 Set Maximum Logic Voltage Level 48 Read Motor PWMs 49 Read Motor Currents 57 Set Main Ba...

Page 67: ...6 Read Battery Voltage Offsets 117 Set Current Blanking Percentages 118 Read Current Blanking Percentages 133 Set M1 Maximum Current 134 Set M2 Maximum Current 135 Read M1 Maximum Current 136 Read M2...

Page 68: ...d Address 25 Receive Value Byte1 Value Byte0 CRC 2 bytes 26 Set Minimum Logic Voltage Level Note This command is included for backwards compatibility We recommend you use command 58 instead Sets logic...

Page 69: ...0 Send Address 57 Min 2 bytes Max 2bytes CRC 2 bytes Receive 0xFF 58 Set Logic Battery Voltages Set the Logic Battery Voltages cutoffs Min and Max Min and Max voltages are in 10th of a volt increments...

Page 70: ...n position control is enabled This sets the percentage of the maximum speed set by QPSS as the default speed The range is 0 to 32767 Send Address 70 Value 2 bytes CRC 2 bytes Receive 0xFF 71 Set Motor...

Page 71: ...h Mode Description Disabled pin is inactive Default Flip switch if in RC Analog mode or E Stop latching in Serial modes E Stop Latching causes the Roboclaw to shutdown until the unit is power cycled E...

Page 72: ...s 80 Receive 0xFF 81 Read Default Duty Acceleration Settings Read M1 and M2 Duty Cycle Acceleration Settings Send Address 81 Receive M1Accel 4 bytes M2Accel 4 bytes CRC 2 bytes 82 Read Temperature Rea...

Page 73: ...x000400 M2 Position Error 0x000800 M1 Current Error 0x001000 M2 Current Error 0x002000 M1 Over Current Warning 0x010000 M2 Over Current Warning 0x020000 Main Voltage High Warning 0x040000 Main Voltage...

Page 74: ...eive 0xFF 93 Set Motor 2 Encoder Mode Set the Encoder Mode for motor 2 See command 91 Send Address 93 Mode CRC 2 bytes Receive 0xFF 94 Write Settings to EEPROM Writes all settings to non volatile memo...

Page 75: ...l 0x0010 Battery Mode 5 Cell 0x0014 Battery Mode 6 Cell 0x0018 Battery Mode 7 Cell 0x001C Mixing 0x0020 Exponential 0x0040 MCU 0x0080 BaudRate 2400 0x0000 BaudRate 9600 0x0020 BaudRate 19200 0x0040 Ba...

Page 76: ...ased when the overvoltage disipates Adding an external load dump resistor from the CTRL pin to B will allow the Roboclaw to disipate over voltage energy automatically up to the 3amp limit of the CTRL...

Page 77: ...d is set in increments of 1 300 of a second As an example a timeout value of 10 seconds would be set as 3000 Send Address 105 Percentage 2 bytes Timeout 4 bytes CRC 2 bytes Receive 0xFF 106 Set Auto H...

Page 78: ...correct for differences in voltage readings Range of values is 1V in 1V increments with a range of 10 to 10 Send Address 115 MainBatteryOffset LogicBatteryOffset CRC 2 bytes Receive 0xFF 116 Read Bat...

Page 79: ...lue is in 10ma units To calculate divide value by 100 MinCurrent is always 0 Send Address 135 Receive MaxCurrent 4 bytes MinCurrent 4 bytes CRC 2 bytes 136 Read M2 Max Current Limit Read Motor 2 Maxim...

Page 80: ...M Memory Location Read a 16 bit value from user EEPROM address Memory address range is 0 to 255 Read a 16 bit value from user EEPROM address Memory address range is 0 to 255 Send Address 253 Memory Ad...

Page 81: ...wo quadrature encoders one for each motor channel The main header provides two 5VDC connections with dual A and B input signals for each encoder Quadrature encoders are directional In a simple two mot...

Page 82: ...Claw to the potentiometer For a 5k pot R1 R2 7 5k for a 10k pot R1 R2 15k and for a 20k pot R1 R2 30k The diagram below shows the main battery as the only power source Make sure the LB jumper is insta...

Page 83: ...s may be required for optimum performance Auto Tuning Motion Studio provides the option to auto tune velocity and position control To use the auto tune option make sure the encoder and motor are runni...

Page 84: ...continue oscillating back and forth form too fast to too slow causing a vibration in the motor 5 Once P and I are set reasonably well usually you will leave D 0 D is only required if you are unable to...

Page 85: ...ified position This is called hunting The I setting causes this when there is any slop in the motor encoder gear train You can compensate some for this by adding deadzone Deadzone is the area around t...

Page 86: ...30 Read Current M1 Raw Speed 31 Read Current M2 Raw Speed 78 Read Encoders Counts 79 Read Raw Motor Speeds 108 Read Motor Average Speeds 111 Read Speed Errors 114 Read Position Errors 16 Read Encoder...

Page 87: ...d After Reading Bit3 Reserved Bit4 Reserved Bit5 Reserved Bit6 Reserved Bit7 Reserved 18 Read Encoder Speed M1 Read M1 counter speed Returned value is in pulses per second RoboClaw keeps track of how...

Page 88: ...ve Speed 4 bytes Status CRC 2 bytes The Status byte is direction 0 forward 1 backward 31 Read Raw Speed M2 Read the pulses counted in that last 300th of a second This is an unfiltered version of comma...

Page 89: ...second for both encoder channels Send Address 108 Receive Speed1 4 bytes Speed2 4 bytes CRC 2 bytes 111 Read Speed Errors Read current calculated speed error in encoder counts per second Send Address...

Page 90: ...With Signed Speed And Distance Buffered 44 Drive M1 With Signed Speed Acceleration and Distance Buffered 45 Drive M2 With Signed Speed Acceleration and Distance Buffered 46 Drive M1 M2 With Signed Sp...

Page 91: ...xFF 29 Set Velocity PID Constants M2 Several motor and quadrature combinations can be used with RoboClaw In some cases the default PID values will need to be tuned for the systems being driven This gi...

Page 92: ...ntax Send Address 33 Duty 2 Bytes CRC 2 bytes Receive 0xFF The duty value is signed and the range is 32768 to 32767 eg 100 duty 34 Drive M1 M2 With Signed Duty Cycle Drive both M1 and M2 using a duty...

Page 93: ...ich direction the motor will turn This command is used to drive both motors by quad pulses per second Different quadrature encoders will have different rates at which they generate the incoming pulses...

Page 94: ...ature encoders will have different rates at which they generate the incoming pulses The values used will differ from one encoder to another Once a value is sent the motor will begin to accelerate incr...

Page 95: ...ed or executing command can be stopped when a new command is issued by setting the Buffer argument All values used are in quad pulses per second Send Address 43 SpeedM1 4 Bytes DistanceM1 4 Bytes Spee...

Page 96: ...hich direction the motor will run The acceleration and distance values are not signed This command is used to control both motors top speed total distanced traveled and at what incremental acceleratio...

Page 97: ...acceleration and distance values are not signed This command is used to control both motors top speed total distanced traveled and at what incremental acceleration value to use until the top speed is...

Page 98: ...leration value for ramping The command syntax Send Address CMD DutyM1 2 bytes AccelM1 4 Bytes DutyM2 2 bytes AccelM1 4 bytes CRC 2 bytes Receive 0xFF The duty value is signed and the range is 32768 to...

Page 99: ...stants Read the Position PID Settings Send Address 64 Receive P 4 bytes I 4 bytes D 4 bytes MaxI 4 byte Deadzone 4 byte MinPos 4 byte MaxPos 4 byte CRC 2 bytes 65 Buffered Drive M1 with signed Speed A...

Page 100: ...sition Default accel decel and speeds are used Send Address 120 Position 4 bytes Buffer CRC 2 bytes Receive 0xFF 121 Buffered Drive M1 M2 with Position Move M1 and M2 from the current position to the...

Page 101: ...tive holders Disclaimer Basicmicro cannot be held responsible for any incidental or consequential damages resulting from use of products manufactured or sold by Basicmicro or its distributors No produ...

Reviews: