Adafruit motor shield - intermittent power to motors

Hi All,

I'm having some issues with my motor shield and constant power to my motors.

I'm using a sainsmart 4WD arduino chassis with 4 x 4.5v motors
I have the motors wired to M1 - M4 of the adafruit motor shield with the power jumper removed and a 1800mAH 9.6v battery pack wired in.

When I run the motors using the code below they only seem to run for 4-5 seconds at most before stopping for a second and restarting. Can anyone suggest a cause or a method for troubleshooting? I'm pretty new to all of this.

#include <AFMotor.h>

int running=0;

NewPing sonar(trigPin, echoPin, MAX_DISTANCE);

AF_DCMotor motor1(1);
AF_DCMotor motor2(2);
AF_DCMotor motor3(3);
AF_DCMotor motor4(4);

void setup()                    // run once, when the sketch starts
{
  Serial3.begin(115200);      
  motor1.setSpeed(100);
  motor2.setSpeed(100);
  motor3.setSpeed(100);
  //motor4.setSpeed(100);
  startMotors();
  
}

void stopMotors()
{
  motor1.run(RELEASE);
  motor2.run(RELEASE);
  motor3.run(RELEASE);
  motor4.run(RELEASE);
  running = 0; 
}

void startMotors()
{
  motor1.run(FORWARD);
  motor2.run(FORWARD);
  motor3.run(BACKWARD);
  //motor4.run(BACKWARD);
   
  running = 1;
}

void loop() {               
  
}

Incidentally, today I noticed one of the power pins had broken on the front left motor so I had to use a soldering iron to melt the plastic and get at the contact again (nasty job). I believe the issue existed before I noticed this and the motor still isn't working. Related?

Ignore the newping btw, I had some ultrasonic distance sensing controlling the motors but took out the code for testing.

Also I have disabled motor4 since it needs to be repaired again

Perhaps noise from the motor wiring is reseting the Arduino - you have a separate supply from the sound of it,
perhaps the motor wiring runs too close to the Arduino?

You could add a delay of a couple of seconds at the start of setup (), then if it is a reset problem it will pause
much longer before restarting, whereas if its some other issue the behaviour shouldn't change after the first
power-up. Can you watch the LED on pin13 too?

Sorry for the delay, led 13 doesn't seem to fluctuate and I haven't noticed any increase in the delay.

I did find this in the motorshield FAQ and I have a sainsmart 4WD chassis so I'm going to try soldering on these caps.

"I have good solid power supplies, but the DC motors seem to 'cut out' or 'skip'"

Any other suggestions?