Stepper Motor - Slight pause at low speeds

Hi guys,

Wrote this very basic code to get a stepper motor turning at the desired speed. However it will take approx 10 steps and then take half a sec pause. and then another 10 steps then pause etc.

I’ve tried with higher speeds and it seems to smooth out and not have any pauses. But i need it to be consistently moving at slow speeds. Half a second pause is not good for what I’m doing with it.

any idea as to why this is happening and how can I stop it??

#include <AccelStepper.h>

AccelStepper stepper(1, 13, 12); (dir, Step)

void setup()
{  
  
   stepper.setMaxSpeed(4.97);
   stepper.setSpeed(4.97);	
  
   
}

void loop()
{  
   stepper.runSpeed();
   
}

Hi, How are you powering the stepper and how are you powering the Arduino? What model Arduino are you using?

Thanks.. Tom.. :)

The code that you posted will not compile.

AccelStepper stepper(1, 13, 12); (dir, Step)

Needs // before the (dir, step). The syntax for the constructor, in this case, is (driver, stepPin, dirPin).

I fixed the above problem and connected an Uno to a DRV8825 driver and stepper powered by an external 12V supply. I see no pause. So the code is not the problem, I think.

#include 

AccelStepper stepper(1, 13, 12); //(step, dir)

void setup()
{    
  stepper.setMaxSpeed(4.97);
  stepper.setSpeed(4.97);
}

void loop()
{
  stepper.runSpeed();
}

Its currently powered by a 12v dc car battery. The stepper driver is the a4988 (or something like that. Dont have it handy to check atm).

So you think its more the power supply thats the issue?

Im powering the driver board and arduino from the battery directly and connecting ground between driver and arduino.

I have tried this on a pc power supply which i use for my test bench psu and i get the same result.

Will recheck the power supply when i get a chance and see if that solves anything.

You need to post a link to the datasheet for the stepper motor.

Have you correctly set the current limit for the A4988? Perhaps it is being overloaded and is cutting out to protect itself? Anything beyond 1.2 to 1.4 amps would probably overload the A4988 unless it has a heat sink and cooling fan.

...R

Hi, If you are using a car battery, have you got a fuse in the positive lead to protect your circuit?

Tom.. :)

I have set the current at about 380ma for the stepper. It's a nema17 12v 0.4a 1.8 degree stepper. (I don't currently have a fuse in the circuit :P

I know if I pick the speed up on the stepper it becomes buttery smooth in the steps. cannot feel any pause or stutters. So still a bit stumped as to why this would be happening. I do have a second driver board I might try and connect and see if I still get the problem.