Stepper Motor Speed Problems

Hello, I am working on a code using stepper motors. I am using the stepper motor shown here:

I am using an L298N driver shown here

I have implemented a wiring schematic similar to what is shown in the link below. I have attached a power supple capable of 12v at 5amp.

And I am using the following code:

Adafruit Arduino - Lesson 16. Stepper
#include <Stepper.h>
int in1Pin = 12;
int in2Pin = 11;
int in3Pin = 10;
int in4Pin = 9;
Stepper motor(200, in1Pin, in2Pin, in3Pin, in4Pin);  

void setup()
  pinMode(in1Pin, OUTPUT);
  pinMode(in2Pin, OUTPUT);
  pinMode(in3Pin, OUTPUT);
  pinMode(in4Pin, OUTPUT);
  // this line is for Leonardo's, it delays the serial interface
  // until the terminal window is opened
  while (!Serial);
void loop()
  if (Serial.available())
    int steps = Serial.parseInt();
	Serial.print(steps); Serial.println(" completed!");

Everything works as expected except when I increase the speed beyond 150rpms. As soon as this happens the motor seems to jitter noisily and move very slowly. I am not sure why this is the case. 150 works fine, anything >150 does not seem to work as expected.

I have the same stepper motors but I am using the Pololu A4988 stepper drivers.

The 12v quoted in the specs is the voltage needed to put 0.33A through the coils (ohms law). However as the motors run faster the inductance means that the full current doesn't actually flow in the coils.

The answer - assuming you have a suitable driver board - is to power the motors at a much higher voltage. The A4988 boards can work with 30v (afair) and they have a small potentiometer on them that you use to limit the maximum current (in this case 0.33A).

Unfortunately if you use high voltages with the L298 board you will probably (almost certainly) damage the motor with excess current and overheating. The L298 is really meant for driving regular DC motors.


I believe this comes up quite often. And the answer is always the same: Use a chopping mictrostepping controller with as high supply voltage as possible.
Part of the problem is, i think, oversimplification of stepper motors in tutorials and marketing.

Thanks for the help!

why/how will the L298 over amp the motor?

Although the L298 has common GND outputs from each bridge which give the possibility to use current sensing resistors it has no built in circuitry to handle this. It must be done by external circuitry.

Are you starting at the top speed? You probably need to accelerate from a slower start speed. See this on the
ArduinoInfo.Info WIKI HERE:

The AccelStepper Library is HERE:

An example is at the end of THIS Page.

why/how will the L298 over amp the motor?

It's when you use a high voltage with the L298 that you will overload the motor. As @nilton61 says the L298 has no internal system to limit the maximum current - and (IMHO) it would be far too much trouble to add current sensing and current limiting circuits to it.

In relation to what @terryking228 said I had assumed you are trying the motors without them connected to any load. In my experience they work fine with up to 24v without needing to be accelerated. Of course if you have a load on them that would be a different matter.