Go Down

Topic: Adafruit motor shield - intermittent power to motors (Read 1 time) previous topic - next topic


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.
Code: [Select]

#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

void stopMotors()
  running = 0;

void startMotors()
  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?
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]


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?

Go Up