stepper is unstable when starting.

I am trying to run stepper high speed.
but when it starts to run or run in slower speed , it looks oscillating randomly.
and I can really find what it’s problem is.
any help would be really helpful


i am using basic code of accelstepper library. with DRV8825 driver and Sanyo high toque motor.

#include <AccelStepper.h>

#define dMOTOR_PIN1 5
#define dMOTOR_PIN2 6

AccelStepper stepper(1,dMOTOR_PIN1,dMOTOR_PIN2); // step pin = 7 dir pin = 8

void setup()

void loop()

Hi, you need to tell us more about the motor type and what driver board you are using. Only 2 pins used???

it is a bipolar motor(datasheet= )

What driver are you using? What voltage power supply? What mechanical load do you have on the stepper? Does it
work fine at lower speeds?

[edit: Also which exact motor - that datasheet covers a range of motors]

I am using pololu drv8825 with an adjustable power supplier and no any load yet.
it works fine in very lower speed. but if i speed it up a little bit it just stops before it finish the turns that supposed to do.
I linked the video below

Can you tell us which exact motor and what supply voltage you are using. Also tell us the power supply details (link to
info, datasheet, or its max current, something more than "adjustable"....) With the DRV8825 or other chopper drives
you will get better performance for higher supply voltages. I think you also need to set it up for the relevant
motor current. 2A is pushing it for the DRV8825 unless there's good heatsinking, IIRC.