Increase Steppe motor speed

Armindo:

  1. But I cant get enough speed.

The code you have posted should be giving you about 1000 steps per second. With a 200 step motor that should be 5 revolutions per second.

What is the max number of steps per second you are actually getting without missing any steps?

How many steps per second do you want to achieve?

If you want the same number of revs per second with microstepping you will need a higher step rate. You could try changing millisBetweenSteps to microsBetweenSteps and a value of 1000 would be the equivalent of 1 millisec. Then use delayMicroseconds(microsBetweenSteps). That would allow you to have sub-millisecond intervals - but don't make the interval too short.

However, for high speeds you usually need to start the motor slowly and accelerate to the required speed and my simple code was not written for that. It is only intended to illustrate simple control principles. It would not be difficult to modify the coe to reduce the interval over, say, 50 steps from a slow rate the the desired maximum rate. And you also need to decelerate the motor to a stop.

Stepper motors often work better under load as the load can damp out resonances.

If my simple code (or a variation of it) is suitable for your needs then I suggest you use the second example as it does not use delay() which blocks the Arduino from doing other things. Simple Stepper Code

I am assuming that you have correctly adjusted the stepper driver to provide the current required by the motor.

...R
Stepper Motor Basics