Stepper motor Vibrates instead of turning [Finally found an issue!]

I’ll try to keep this as simple as possible,

I have a 12v DC 28BYJ-48 stepper motor with a uln2003 driver, and I’m trying to make it rotate. The problem is that instead of rotating, it vibrates. I’ve measured the coils with a multimeter to double check wiring to the uln2003 (Picture of wiring attached). I’ve also tried switching out both the motor, and the uln2003 to no avail.

Thanks in advance for any help! :slight_smile:

Here’s my code:

#include "AccelStepper.h"
#define HALFSTEP 8

// Motor pin definitions
#define motorPin1  8     // IN1 on the ULN2003 driver 1
#define motorPin2  9     // IN2 on the ULN2003 driver 1
#define motorPin3  10    // IN3 on the ULN2003 driver 1
#define motorPin4  11    // IN4 on the ULN2003 driver 1

// Initialize with pin sequence IN1-IN3-IN2-IN4 for using the AccelStepper with 28BYJ-48
AccelStepper stepper1(HALFSTEP, motorPin1, motorPin3, motorPin2, motorPin4);

void setup() {
  stepper1.setMaxSpeed(1000.0);
  stepper1.setAcceleration(100.0);
  stepper1.setSpeed(10);
  stepper1.moveTo(20000);
}

void loop() {

  //Change direction when the stepper reaches the target position
  if (stepper1.distanceToGo() == 0) {
    stepper1.moveTo(-stepper1.currentPosition());
  }
  stepper1.run();
}

Hi NM456, welcome.

The 2nd picture you’ve uploaded, is the same as the 1st one.
fa43b27fec0443ac5c25b5e7aefb9ff58d020100.jpg

![|500x375](http://forum.arduino.cc/index.php?action=dlattach;topic=488127.0;attach=218121[i/mg]

<img src=)

// Motor pin definitions
#define motorPin1  8     // IN1 on the ULN2003 driver 1
#define motorPin2  9     // IN2 on the ULN2003 driver 1
#define motorPin3  10    // IN3 on the ULN2003 driver 1
#define motorPin4  11    // IN4 on the ULN2003 driver 1

Did you swap red and blue there ?

I did, thanks for pointing that out! Sadly it still doesn't work with them swapped.

You need to pull up a datasheet for your motor and figure out the half step parameter. There are several variations out there and the libs don't always match up.

Yep. And to begin with.... do testing at lowest possible speed. Go simple to start with.

Hi,
That symptom (Vibrates but doesn't run) is almost always wrong connections to the motor.

See THIS PAGE for Info

Note that connecting 1-2-3-4 is usually wrong sequence. If you connect 1-2-3-4 you can use example code on that page to set correct winding sequence in software.

Let us know...

8 of the 24 possible sequences will work, 4 of those go one way and 4 go the other.

With a bipolar motor its easy as you can identify the windings with a multimeter, but
not possible to do this with 5 wire motors.

So I've pulled up the specs from the manufacturer, I don't see the "half step", but there is a "step angle" which is 5.625 x 1/64. Is there a way to determine the half step from that? I'm not fully sure what the 1/64 means.

Thanks for the help!

@MarkT, I’ve made a list of all the possible combos here:

1: 8 9 10 11
2: 8 9 11 10
3: 8 10 9 11
4: 8 11 9 10
5: 8 10 11 9
6: 8 11 10 9
7: 9 8 10 11
8: 9 8 11 10
9: 10 8 9 11
10: 11 8 9 10
11: 10 8 11 9
12: 11 8 10 9
13: 9 10 8 11
14: 9 11 8 10
15: 10 9 8 11
16: 11 9 8 10
17: 10 11 8 9
18: 11 10 8 9
19: 9 10 11 8
20: 9 11 10 8
21: 10 9 11 8
22: 11 9 10 8
23: 10 11 9 8
24: 11 10 9 8

I’ve tried every combination (even though 8 should work), and none of them moved the motor ):

Could the power supply be an issue? It's 12V DC 1.5A, and I'm powering the ULN2003 through the VIN pin. I would think that would be enough (though i'm unable to find how much current this motor actually draws :confused: )

NM456:
Could the power supply be an issue? It’s 12V DC 1.5A, and I’m powering the ULN2003 through the VIN pin. I would think that would be enough (though i’m unable to find how much current this motor actually draws :confused: )

Try a 12 V DC, 10 Amp supply instead maybe.

I'm guessing that was sarcastic. So you don't think it would be an issue?

NM456:
It’s 12V DC 1.5A, and I’m powering the ULN2003 through the VIN pin.

Southpark:
Try a 12 V DC, 10 Amp supply instead maybe.

There is a reverse protection diode between DC socket and V-in, with an absolute max rating of 1Amp.
The motor only draws <50mA/phase.
Leo…

Any other ideas on what could be the issue?

So it doesn't turn at all? Just vibrates between the same positions? Use some tape on the shaft to easily see what it's doing.

Try manually giving it a turn while the prog is running, either direction, see if you get it going with help.

You can look up sketches to run the stepper without any library or driver board by hooking the wires of the stepper straight to the Arduino. Good for diagnostics if you want to see if you have a working stepper.

Wawa:
There is a reverse protection diode between DC socket and V-in, with an absolute max rating of 1Amp.
The motor only draws <50mA/phase.
Leo…

Ok…thanks Leo.

NM456:
Any other ideas on what could be the issue?

Hard to say at the moment. One suggestion could be to just focus on the driver. Disconnect motors etc.

And then put some suitable resistive load across the driver's terminals.

And then use the arduino to apply a set of control voltages to the driver..... and then measure the voltage across the loads.... or the current through the loads.... to make sure everything is behaving properly.

If the driver is outputting the correct voltages for your control inputs, then that is a great start.

And, if you have a spare stepper motor.... then try the spare one to see what happens.

I did the tape thing, it doesn't visibly turn at all, no. I tried to manually turn it, and i'm not able to turn it while the motor is on ( though I don't have much leverage with the small shaft ). I'll try the sketches without the driver board in a bit. Thanks for the help (:

That symptom (Vibrates but doesn't run) is almost always wrong connections to the motor.

terryking228:
That symptom (Vibrates but doesn't run) is almost always wrong connections to the motor.

Except for all of those times when it's because of wrong parameters for step size.
Frankly I'm more inclined to believe people fail with code more than they fail with matching wire colors/input pin labels.