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
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).
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?
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.