Stepper motor will not rotate, 12 hours of troubleshooting later and desperate

Hi. So as the title reads my stepper motor will not move and I feel I've tried and read everything an am beyond stumped.

So the basics are that I'm trying to make a small stepper motor move backwards and forwards a quarter turn 3 times. I'm running it off of an Arduino Nano and using a breadboard to make the connections to a motor driver (ULN2003AN) and small stepper motor (28BYJ-48).

The schematic I used for wiring is as follows:

The datasheet for the driver is here:

And the datasheet for the motor is here:

Now I had been originally following directions from this lovely person over at makerguides as I was trying to make this work with the exact same components (albeit a nano instead of an uno):

However my motor will. not. move.

I started this with the intention of having it triggered off of a button and was using this code for it


const int stepsPerRevolution = 2038;  // change this to fit the number of steps per revolution
// for your motor
// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);

// constants won't change. They're used here to set pin numbers:
const int buttonPin = 2;  // the number of the pushbutton pin
const int ledPin = 13;    // the number of the LED pin

// variables will change:
int buttonState = 0;  // variable for reading the pushbutton status

void setup() {
  // set the speed at 60 rpm:
  myStepper.setSpeed(5);
  // initialize the serial port:
  Serial.begin(9600);

  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT);
}

void loop() {
// read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);

  // check if the pushbutton is pressed. If it is, the buttonState is HIGH:
  if (buttonState == HIGH) {
   digitalWrite(ledPin, HIGH);
   // step one revolution  in one direction:
  Serial.println("clockwise");
  myStepper.step(500);
  delay(750);
  // step one revolution in the other direction:
  Serial.println("counterclockwise");
  myStepper.step(500);
  delay(750);
  // step one revolution  in one direction:
  Serial.println("clockwise");
  myStepper.step(500);
  delay(750);
  // step one revolution in the other direction:
  Serial.println("counterclockwise");
  myStepper.step(500);
  delay(750);
  // step one revolution  in one direction:
  Serial.println("clockwise");
  myStepper.step(500);
  delay(750);
  // step one revolution in the other direction:
  Serial.println("counterclockwise");
  myStepper.step(500);
  delay(750);
  }
   else {
    // turn LED off:
    digitalWrite(ledPin, LOW);
  }
}

The button itself functions and when I connect the motor directly to pins 7-11 (as the molex also includes power with the four phases) I can feel it vibrate when it should be moving and pause when it should delay. I know its underpowered and generally a bad idea to run it off the board itself but I was trying to eliminate issues. What that seems to tell me is the code is in fact trying to move the motor.

Moving on I connected it to the motor driver and powered that with an AC-DC power supply. The output is 5V-2.1A. I have metered everything to confirm I am getting 5V in and seem to be getting a fluctuation between 2.5-5V on each phase. All 4 LED lights are illuminated but don't seem to change. The motor itself simply gets hot.

I have tried swapping both the motor for another one thats exactly the same and the motor driver for a different but same model and no dice. I went back to basics and connected the motor directly to the board and uploaded a basic stepper code and got the motor to move back and forth.


/*
 Stepper Motor Control - one revolution

 This program drives a unipolar or bipolar stepper motor.
 The motor is attached to digital pins 8 - 11 of the Arduino.

 The motor should revolve one revolution in one direction, then
 one revolution in the other direction.


 Created 11 Mar. 2007
 Modified 30 Nov. 2009
 by Tom Igoe

 */

#include <Stepper.h>

const int stepsPerRevolution = 200;  // change this to fit the number of steps per revolution
// for your motor

// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);

void setup() {
  // set the speed at 60 rpm:
  myStepper.setSpeed(60);
  // initialize the serial port:
  Serial.begin(9600);
}

void loop() {
  // step one revolution  in one direction:
  Serial.println("clockwise");
  myStepper.step(stepsPerRevolution);
  delay(500);

  // step one revolution in the other direction:
  Serial.println("counterclockwise");
  myStepper.step(-stepsPerRevolution);
  delay(500);
}

I also found this thread and thought it would solve all of my problems but after trying all of the code listed and linked to throughout I still have had no luck. LED lights are still constant on and motor just slowly gets hot.

I am not the smartest human and am relatively new to this but I do feel this should be insanely simple and for whatever reason it is not. Please, someone significantly smarter than me help me because I feel like my brain is now soup.

-B

Try
Stepper myStepper(stepsPerRevolution, 8, 10, 9, 11);

this seems to be the exact same needs as in your other post

don't duplicate please...


seems you should use 200 and not 2038 for stepsPerRevolution and the second order in this code

  Serial.println("clockwise");
  myStepper.step(500);
  delay(750);
  // step one revolution in the other direction:
  Serial.println("counterclockwise");
  myStepper.step(500);
  delay(750);

should be negative (-500) if you want to move in the other direction...

Did you try the other micro controller?

Please post some clear photos showing your wiring.

Did you try the suggestion of @MicroBahner in post #2. The

Stepper myStepper(stepsPerRevolution, 8, 10, 9, 11);

Made my motor work when I first started working with it.

1 Like

Topic closed as a duplicate.