Stepper motor vibrates above 30rpm

Im trying to control a stepper motor using an L298N Dual H-Bridge Motor Driver. I had previously been using an a4988 controller but wanted to upgrade so I had better control of the speed and acceleration. The a4988 has 2 pin control, one pin controls the direction and the other steps the motor when it switches from LOW to HIGH. The L298N uses the arduino's stepper motor class with 4 wires (IN1 - IN4). The motor works fine with the A4988 above 30 rpm. It works at a low rpm with the L298N but starts to vibrate above 30. At 60 it no longer completes a full rotation before switching and at 80 it no longer rotates and simply vibrates.

I've been following this tutorial: Using L298N Stepper Motor Driver To control 4 wires stepper motor - YouTube , but I removed the 12V jumper and supplied 5V from the arduino. I also have 2 jumpers to supply 5V to EN1 and EN2. As for code I have been using the build in stepper motor 1 rotation example.

Attempted solutions:

  • I've switched back to the a4988 to check the motor for damage, e.g. missing steps or inconstant speed, but found that it was all working as intended.
  • Tried manually setting both EN pins to 5V
  • Tried reducing my motor voltage to 12V and using the relay to power the board

You _down_graded from an A4988 to an L298N.

The A4988 is a current controlling microstepping driver for modern steppers.

The L298N is a voltage controlling DC motor driver, utterly unsuitable for modern low-impedance current-driven stepper motors. You are probably overloading it and cooking the motor windings trying to use it.

What was the problem with the A4988? Current control will give way better performance (ie not burning out the motor).

Mostly because I wanted to have better control of the speed. With the A board I have a 1micro second delay between pulses but I need it to run faster.

No, the A4988 board imposes no constraints on step timing.

Perhaps you mean the Arduino library you are using doesn't have enough speed resolution?

Perhaps if you describe what you are needing, it will be easy to see what you actually need. An L298N is
definitely not what you need.

What library would you recommend for speeding up the motor?
I was just manually switching between high and low on the step pin with a micro second delay inbetween.

What processor? One microsecond with 16 MHz Arduino is hard to achieve without writing your own code. That's 500,000Hz frequency (1/.000002), will the motor even spin that fast?

Rippingmyhairout:
What library would you recommend for speeding up the motor?

Tell us how many steps per second you require.

Post the A4988 code that was not satisfactory.

...R
Stepper Motor Basics
Simple Stepper Code

CrossRoads:
What processor? One microsecond with 16 MHz Arduino is hard to achieve without writing your own code. That's 500,000Hz frequency (1/.000002), will the motor even spin that fast?

I assumed the granularity of step rate was the issue. 1µs granularity at 4000 steps/s gives a 0.4% granularity in speed accuracy if DDA techniques aren't applied.