This code is quoted from here. May I know how to increase the speed of the NEMA 17 stepper motor further? I tried to increase the step speed to 2000rpm but it does not even work. It only works for less than 300rpm in my case. The max rpm of the Nema 17 should be 5000rpm I googled. I used a 20V power supply lithium ion battery on the L298N motor driver. How do I solve this problem so that the Nema 17 can be faster? I believe the problem its with the code.

Thank you for reading and have a nice day :)

#include <Stepper.h>

const int stepsPerRevolution = 100;  // change this to fit the number of steps per revolution
// for your motor

// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);

void setup() {
  // set the speed at 60 rpm:
  // initialize the serial port:

void loop() {
  // step one revolution  in one direction:
  • I tried to increase the step speed to 2000rpm ... how did you do that?
    – jsotola
    Apr 22, 2022 at 15:08
  • @jsotolamy Stepper.setSpeed(2000) ?
    – felix tan
    Apr 22, 2022 at 15:09
  • 1
    have you tried any of the stepper example code in the Arduino IDE?
    – jsotola
    Apr 22, 2022 at 15:11
  • Yes this is the code?
    – felix tan
    Apr 22, 2022 at 15:18

1 Answer 1


Stepper motors need to be gradually brought up to speed. If you try to go from zero rpm to anything over a few hundred rpm they will often just sit there and hum. Try AccelStepper (https://www.arduino.cc/reference/en/libraries/accelstepper/). This library provides functions to accelerate a stepper and move it to a certain position.

Also, I think you should know that Many stepper motors won't go over around 1000 rpm (this is dependant on your stepper and driver of course). It's also equally important to note that as you increase the speed of a stepper motor its available torque will decrease, so even if you are able to coax 1000+ rpm out of a nema 17 the torque available will be too low to use.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.