Motor Shield R3 Power Supply problem

Hello Guys,

I would like to built a fluidic pump using a bipolar stepper motor that will move a syringe back and forth. I am using Arduino Leonardo with a Motor Shield R3.

I have found a sketch that makes what I need and, when the motor is plugged on the USB PC, it works just fine.

But when I connect to an external power supply I connected the Negative cable to Grn and the positive to Vin.), it starts to do things that are not written in the sketch (different parameters, not able to move backwards and so on.

I wish someone could kindly give me some hints about this problem. Since I am new with Arduino, easily it might be some stupid mistake.

I thank you in advance.

Francesco Reddavide

P.S.: I attach the code I am using

#include <Stepper.h>

const int stepsPerRevolution = 200;  // change this to fit the number of steps per revolution
                          // for your motor
char n = 0;
// initialize the stepper library on the motor shield
Stepper myStepper(stepsPerRevolution, 12,13);     

// give the motor control pins names:
const int pwmA = 3;
const int pwmB = 11;
const int brakeA = 9;
const int brakeB = 8;
const int dirA = 12;
const int dirB = 13;

int x = 0;
void setup() {
// set the PWM and brake pins so that the direction pins  // can be used to control the motor:
pinMode(pwmA, OUTPUT);
pinMode(pwmB, OUTPUT);
pinMode(brakeA, OUTPUT);
pinMode(brakeB, OUTPUT);
digitalWrite(pwmA, HIGH);
digitalWrite(pwmB, HIGH);
digitalWrite(brakeA, LOW);
digitalWrite(brakeB, LOW);

// initialize the serial port:
// set the motor speed (for multiple steps only):

void loop(){
  while (n < 10)
  n = n++ ;

Hi, welcome to the forum.

The Motor Shield R3 :

I didn't look at your sketch that well, but I assume it is a power problem. Do you use a seperate power supply for the stepper motors ? Not the 5V of the Arduino I hope. What kind of voltage did you use without the USB power ?

Hello Peter,

first thanks for the answer. :slight_smile:

I read I should use the stepper motor with an external power supply. So I connected the Vin and Grn to a positive and negative cable, respectively. The power supply can be regulated (V and A). I set the power supply to 12V.

Since there were problems, I tested the stepper motor also with the 5V USB (It works fine and I have also used the charger of my phone). Could it be that this created some problems? Why can't I use the 5V if the motor works good?

Thank you again,

The strange thing is that I have changed the motor now, and the second one (Pololu - Stepper Motor: Bipolar, 200 Steps/Rev, 35×28mm, 10V, 0.5 A/Phase) works fine both with the USB 5V power supply and the external power supply. The other one ( only with the USB. -.-'

Hi, if you look at the specs, the one you were having problems with is a 4Vdc unit, the pololu motor is a 10Vdc unit.

Tom....... :slight_smile: