Go Down

Topic: Stepper will only turn forwards (Read 133 times) previous topic - next topic


Feb 18, 2020, 01:38 am Last Edit: Feb 18, 2020, 04:32 pm by Connor775
Hi all,
I'm using an Adafruit motor shield v2 and four double A's to try and get a stepper motor to work. I ran some of the adafruit example code just to get an idea of what could be wrong with it. I'll copy/paste that here. This is what happens when I run the code:

With the double steps, it turns fairly quickly but only in one direction (forward)
With interleave steps, it basically does the same thing as double, but slower and a bit more jittery
with microsteps, it just wiggles back and fourth slightly
with single steps, it basically just vibrates a little and doesn't turn at all.

I really don't know what's going on. I'm almost positive I've got everything wired correctly, and I've tried multiple stepper motors (albeit all of the same model).

Here's the code I'm using:

Code: [Select]

#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!


A schematic (even if hand drawn) would be very useful.
Decent pics too of the current set up.

Could you take a few moments to Learn How To Use The Forum.
It will help you get the best out of the forum in the future.
Other general help and troubleshooting advice can be found here.
It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.


Feb 18, 2020, 04:44 pm Last Edit: Feb 18, 2020, 07:03 pm by ballscrewbob
Threw this together in MS paint(attached). Let me know if there's anything I left out. I'm using an UNO board, by the way. I forgot to mention that in the original post. Stepper is a 17HS4401. I don't have anything wired to the board other than the motor and the power supply. As for pictures, I unfortunately don't have access to the set up right now (I'm out of town) but I'll be back home sometime tomorrow and I can get some then if you still need them.

Thanks for the reply

(mod edit)


Please post a link to the datasheet for your stepper motor. I suspect that the Adafruit shield is a poor choice for driving it.

Stepper Motor Basics
Simple Stepper Code
Two or three hours spent thinking and reading documentation solves most programming problems.

Go Up