Accelerating Stepper Motor

I need to accelerate a stepper motor really fast using 1/16 stepping and A4988 driver.

I tried to use accellibrary although it cannot go about 4000 steps per second.

I also used this code:

const int ledPin = 13;
long interval = 250;
long interval2 = 40;
long previousMillis = 0;
long askel = 1;

void setup(){
pinMode (ledPin, OUTPUT);
}

void loop(){
  
  unsigned long currentMillis = millis();
  
  digitalWrite(ledPin, HIGH);
  delayMicroseconds(interval);
  digitalWrite(ledPin, LOW);
  delayMicroseconds(interval);

if(currentMillis - previousMillis > interval2) {
  previousMillis = currentMillis;
if (interval > 1) {  
  interval = interval - askel;
}
}

}

Which is for Stepper Motor ( Stepper high speed testing (UPDATE! Arduino sketch in description) - YouTube) I do not need to get the stepper motor to run that fast but about 1000-1500RPM would be sufficient.

My main question is what do I have to adjust in this code to get that RPM. I also do not need any torque from the stepper, mainly speed is important.

Any help would be appreciated, Thanks

I need to accelerate a stepper motor really fast using 1/16 stepping

Half-stepping, quarter-stepping, etc. are for more precise positioning. 1/16th stepping is for very accurate positioning. Very accurate positioning is not compatible with 1000 RPM (or more).

Why do you think you need both?

I was mainly using it for noise reduction as it seems to reduce the noise of the stepper motor a lot

It is not very difficult to create your own acceleration code. This link (Reply #7) may give you some ideas.

...R

PaulS:
Half-stepping, quarter-stepping, etc. are for more precise positioning. 1/16th stepping is for very accurate positioning. Very accurate positioning is not compatible with 1000 RPM (or more).

Why do you think you need both?

Actually, micro-stepping is used primary to provide smoother motion, and mostly to reduce mid-band resonance, which can cause lost steps and even stalling. And at higher speeds, many modern drives reverse to full steps at higher RPM, for improved torque. Micro-stepping does little to improve resolution or precision, while it DOES reduce torque.
Regards,
Ray L.,

brightstar12:
I need to accelerate a stepper motor really fast using 1/16 stepping and A4988 driver.
snip
I do not need to get the stepper motor to run that fast but about 1000-1500RPM would be sufficient.

At 1500rpm with a 200step motor, that would be 300ksteps/min, 5000steps/sec
Trying to use 1/16 stepping means a drive frequency of 80kHz !

The code you posted generates a maximum of ~ 78kHz on an Arduino Pro Mini.

I'd suggest you simply switch to 1/8 stepping.

Yours,
TonyWilk

Thanks everyone for all the suggestions and the help, I will look into this and reduce the micro stepping