BasicMicroUK - Forums

Roboclaw enters runaway state after ~5 minutes of operation
Page 1 of 1

Author:  brendanarnold [ Sat Apr 19, 2014 4:17 pm ]
Post subject:  Roboclaw enters runaway state after ~5 minutes of operation

I am using a Roboclaw v3 firmware version v3.0.3 - It is either 15A or 30A.

I am controlling using Advanced Serial Packet mode using an Arduino Mega.

I am building an animatronic for a theme park - shipping is very soon however and the animatronic keeps entering a run away state. It runs as expected for a few minutes then suddenly the motor speed runs up to full and we have to yank the plug.

I have reduced it to a basic routine that switches back and forth every couple of seconds as follows - this too fails after five or so minutes...

We have tested the encoder and it appears ok on the oscilloscope - is there any other possibilities?


// Pins for Roboclaw
#define ROBOCLAW_A_PIN 52
#define ROBOCLAW_B_PIN 46

//Roboclaw Address
// Roboclaw timeout for comms in microseconds
//Velocity PID coefficients - Do not change!
#define ROBOCLAW_P 1.0
#define ROBOCLAW_I 0.5
#define ROBOCLAW_D 0.25
#define ROBOCLAW_QPPS 44000

boolean dirn = false;

boolean atTarget() {
    uint8_t depth1, depth2;
    roboclaw.ReadBuffers(ROBOCLAW_ADDRESS, depth1, depth2);
    return depth2 == 128;

setSpeedDistance(float spd, float dist) {
    roboclaw.SpeedDistanceM2(ROBOCLAW_ADDRESS, spd * M5_STEPS_PER_REV, dist * M5_STEPS_PER_REV, 1);

void setup() {
  //Set PID Coefficients


void loop() {

 if (atTarget(motor)) {
    dirn = !dirn;
    if (dirn) {
      setSpeedDistance(motor, 1.0, 1.0);
    } else {
      setSpeedDistance(motor, -1.0, 1.0);


Author:  brendanarnold [ Sat Apr 19, 2014 6:22 pm ]
Post subject:  Re: Roboclaw enters runaway state after ~5 minutes of operat

I have also noticed that it tends to trigger when switching on nearby equipment or opening the Serial diagnostics terminal which makes me think it is a noise thing.

I have put 10k pullup resistors on the Rx and Tx lines but no change.

I have also tried running powered from the Arduino board rather from the B.E.C but that didn't work either.

The cables betwen the Arduino and the Roboclaw are not shielded or twisted pairs but they are only ~10cm long ...

Author:  Acidtech [ Thu Apr 24, 2014 5:11 pm ]
Post subject:  Re: Roboclaw enters runaway state after ~5 minutes of operat

I would recommend sending it in to be updated to 4+ firmware. That may fix whatever is happening but it would also add firmware update support to the board so we could try different things if the problem still happens after the update.

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group