Stepper motor does not rotate continuously and how to increase speed

Firstly my gratitude for any help offered.

My hardware is basic uno + adafruit motorshield V2+ Stepper motor (ZJchao 57oz-in 1Nm Nema 17 Stepper Motor 1.3A 40mm for CNC Router or Mill). The motor is supplied 12V

My issue is that

  1. the stepper motor moves in a jerky manner. When I run the code below shouldnt the stepper motor run through the 1000 steps in a continuous fashion before stopping. Instead it runs about 90 degrees continuously, stops then runs again. How do I make the motor operate more smoothly until it runs through the entire 1000 steps?

myMotor->step(1000, FORWARD, DOUBLE);
myMotor->release();
while(true)
{}

  1. How can I increase the speed of the stepper motor? I understand the limitation is from the motor and voltage applied but even though I set the speed at 5000 rpm, the motor speed is definitely much lower and I kind of feel the motor limitation cannot be that low.
    myMotor->setSpeed(5000);

I am new to arduino so I apologize if some of this is basic.

Thanks

That motor takes 200 steps per revolution.
If you want 5000 RPM, then you want 83.3 rotations per second.
83.3 times 200 steps is 16666.7 steps per second.
To me that sounds very unrealistic, somehow i don't think your motor can keep up with that.
I don't know if setSpeed sets a RPM or a number of steps.
Check the comments of the library you are using.

It could be possible that your motor isn't started and run at the same speed, but that it is ramped up.
If so you should be able to hear this ramping up (usually you can hear each step), you'll hear a sound that gets an increasing pitch.
I wouldn't be surprised if you would get at a certain speed that is over the capabilities of the motor.
That could stop the motor.
When you get closer to the desired number of steps, the library would likely ramp down the speed.
This could explain what you are experiencing.

You can test this.
Set setSpeed much lower, like 2000.
Then test again.
If you have the same or similar behaviour, this is not the problem.
If the behaviour is different, you can go on and test to find the optimum speed for your motor.

Set speed is definitely in rpm, but what is confusing is that when I ask the motor to step forward 1000 steps
1)shouldnt the motor make 5 revolutions in a continuous fashion since it is a 200steps/revolution motor??

2)instead what happens is the motor stops momentarily 8 to 9 times before finishing the 1000 steps.

3)I want to have a smooth rolling action to push out a drawer so these momentary stops are not useful.

[Adafruit_MotorShield AFMS = Adafruit_MotorShield();
Adafruit_StepperMotor *myMotor = AFMS.getStepper(200, 2);

void setup() {
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println(“Stepper test!”);

AFMS.begin(); // create with the default frequency 1.6KHz

myMotor->setSpeed(1000); // 10 rpm
}

void loop() {

Serial.println(“Double coil steps”);
myMotor->step(1000, FORWARD, DOUBLE);

myMotor->release();
while(true)
{}
]

A motor shield is a very poor choice for controlling a stepper motor. You should use a specialized stepper driver. For your 1.3A motor you could use a Pololu DRV8825. That will also allow you to drive the motor with a much higher voltage for better performance.

Have a look at stepper motor basics and this simple stepper code

...R

Aim at 200rpm max for that set up and you'll probably find it will step reliably, but the torque/speed
curve at constant voltage drive is inherently poor.

Low impedance motor with constant current drive is how to get performace, and 3000rpm is achievable,
but I'd aim for more like 1500rpm really as you need some torque left over. Go to higher voltage
stepper drivers though (80V+) and you can get faster. The point is the voltage doesn't go across the
winding resistance, its mainly opposing the back-EMF due to the rotation speed and commutation.

Consider a standard DC motor at 6000rpm - its having 100 complete current-reversals a second
in its windings, ie 100Hz. A 200 step stepper motor at 180rpm is running at 150Hz (600 steps/s),
which means the winding inductance is more important to the stepper at 180rpm than the DC at 6000rpm.

This is why steppers don't go as fast with naive constant-voltage drive - the inductance just causes
the current to drop off rapidly at much more modest speeds.