Troubleshooting Motor Shield and Stepper Test

I have been using an Arduino Uno and a Adafruit Motorshield V2.3 to control a 4 wire (bipolar) NEMA 17 12V stepper. Currently using an external AC to DC 12V power source. I am running the "Stepper Test" example file from the Adafruit Motor Shield V2 library. The file will successfully verify and upload, but the stepper motor does not turn. I am getting frustrated as I know what I am trying should be very simple.

I have included a picture of the MotorShield setup as well as the Nema 17 stepper motor.

Thanks for any advice,

BigBurd

/*
This is a test sketch for the Adafruit assembled Motor Shield for Arduino v2
It won't work with v1.x motor shields! Only for the v2's with built in PWM
control

For use with the Adafruit Motor Shield v2
----> Adafruit Motor/Stepper/Servo Shield for Arduino v2 Kit [v2.3] : ID 1438 : $19.95 : Adafruit Industries, Unique & fun DIY electronics and kits
*/

#include <Wire.h>
#include <Adafruit_MotorShield.h>

// Create the motor shield object with the default I2C address
Adafruit_MotorShield AFMS = Adafruit_MotorShield();
// Or, create it with a different I2C address (say for stacking)
// Adafruit_MotorShield AFMS = Adafruit_MotorShield(0x61);

// Connect a stepper motor with 200 steps per revolution (1.8 degree)
// to motor port #2 (M3 and M4)
Adafruit_StepperMotor *myMotor = AFMS.getStepper(200, 2);

void setup() {
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println("Stepper test!");

AFMS.begin(); // create with the default frequency 1.6KHz
//AFMS.begin(1000); // OR with a different frequency, say 1KHz

myMotor->setSpeed(10); // 10 rpm
}

void loop() {
Serial.println("Single coil steps");
myMotor->step(100, FORWARD, SINGLE);
myMotor->step(100, BACKWARD, SINGLE);

Serial.println("Double coil steps");
myMotor->step(100, FORWARD, DOUBLE);
myMotor->step(100, BACKWARD, DOUBLE);

Serial.println("Interleave coil steps");
myMotor->step(100, FORWARD, INTERLEAVE);
myMotor->step(100, BACKWARD, INTERLEAVE);

Serial.println("Microstep steps");
myMotor->step(50, FORWARD, MICROSTEP);
myMotor->step(50, BACKWARD, MICROSTEP);
}

Thank you so much for your help!

Pic1.jpg

Pic2.jpg

Well, there's your problem. Your motor is upside down!

The NEMA 17 specification defines mounting hole locations. Why ANYONE considers that of interest to us is a mystery.

The voltage of your power supply is, likewise, far less important than the current it can supply.

If the motor doesn't move at all, and is not at least held stationary, then the wiring to the motor shield is wrong.

That motor shield is not the proper one to use with a stepper motors. Dedicated stepper drivers are far better choices, as they allow you to control the maximum current that the motor can pull, ensuring proper holding, and startup, torque, without excess heat.

These links may be of interest

Stepper Motor Basics
Simple Stepper Code

also look up the AccelStepper library

...R

Thank you both for your responses! You gave some awesome info. We got the stepper to turn!

We had to solder the V2 Motor Shield to the Arduino Uno. I guess our issue was poor communication between the shield and the board.