Stepper Motor Turning Inconsistently


I’m completely new to this and could use some help. I need a stepper motor for a time-lapse slider I’m building.

I’m using:

Stepper Motor: Unipolar/Bipolar, 200 Steps/Rev, 57×76mm, 8.6V, 1 A/Phase

DRV8825 Stepper Motor Driver Carrier, High Current

A-Star 32U4 Prime SV

12v DC Adapter

I basically just followed directions online and looked at picture to set it up… I did set the current limit to 500mv. When I try to program the motor using Arduino software it turns inconsistently and in different directions. Take a look at the picture. Is this even set up properly.

Here is the code


  • MotorKnob
  • A stepper motor follows the turns of a potentiometer
  • (or other sensor) on analog input 0.
  • Stepper - Arduino Reference
  • This example code is in the public domain.

#include <Stepper.h>

// change this to the number of steps on your motor
#define STEPS 100

// create an instance of the stepper class, specifying
// the number of steps of the motor and the pins it’s
// attached to
Stepper stepper(STEPS, 8, 9);

// the previous reading from the analog input
int previous = 0;

void setup()
// set the speed of the motor to 30 RPMs

void loop()
// get the sensor value
int val = analogRead(0);

// move a number of steps equal to the change in the
// sensor reading
stepper.step(val - previous);

// remember the previous value of the sensor
previous = val;

Thanks for any tips!


I am sorry you are getting that kind of behavior with your system. I suspect that this could be a power issue - how much current can your 12V supply provide? Also, can you try running the stepper motor script we posted in this blog post? Using that script will remove the analog control from the system so we can focus on the behavior of the stepper motor and its response to step commands. (As it says in the code comments, you will have to switch your STEP and DIR pins to pins 2 and 3, respectively, to use that code.)