Hi, I'm currently completing my first arduino project which involves using stepper motors with an L298 motor driver and an arduino uno board.
I'm using the example arduino code for the stepper motors but, for some reason my motor only rotates about 20° using the default code. If I change the rpm or steps per revolution it doesn't move at all and only vibrates.
Diagram of wiring is attached and code can be found below, any suggestions would be greatly appreciated!
Watch it here:
Code
#include <Stepper.h>
const int stepsPerRevolution = 200; // 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:
myStepper.setSpeed(60);
// initialize the serial port:
Serial.begin(9600);
}
void loop() {
// step one revolution in one direction:
Serial.println("clockwise");
myStepper.step(1000);
delay(500);
// step one revolution in the other direction:
Serial.println("counterclockwise");
myStepper.step(-1000);
delay(500);
}
Hello, do yourself a favour and please read How to get the best out of this forum and modify your post accordingly (including code tags and necessary documentation for your ask).
we would need to know what are the electrical requirements of your motor and how you power the system and what YOUR setup looks like exactly.
Using an L298 ought to produce lots of heat and possibly ruining the L298.
Use a driver having current limiting. That motors spec say 1.6 Amp. 12 volt supply ought to give almost 8 Amps, if the power supply hangs on. I think the current limiting in the power supply kicks in.
Be careful, you are feeding the arduino with +5V through the USB, but you are also feeding the arduino with +5V coming from the L298 module because the J5 jumper is connected.
The L298 incompatible with this kind of stepper motor. You need a current controlling stepper driver such as DRV8825.
You may damage the driver or your stepper with this combination.
Thanks for the help, I'm actually just copying a past project using the exact same tools so unless the driver has been damaged by the previous owners I'm fairly sure they're compatible.
How can that be compatible, if the motor specs says 2.7V and you operate it with 12V through a simple H-bridge which will give (nearly) the whole voltage to the coil without limiting the current?
Sorry I'm a arduino noob. So, should I try and limit the power supply voltage to 2.7V? The stepper motor and motor driver must work together (my particular setup may need some adjustment) as I have seen the past project utilise them together.
This is not an arduino problem. It is simply electrical basics. This motor is designed to operate with a current limiting driver. The L298 cannot do that.
The L298 has a fairly high voltage drop, that must be taken into account.
And the rated current of 1.68A is per coil. So the complete current flow will be twice as much ( when operating with 2.7V at the coils ).
You should switch to a suitable driver or use a stepper with a higher rated voltage.
Its a 1.6 ohm (ie low impedance) stepper, so requires current drive, not voltage drive. You need something like a DRV8825 module to drive this motor, an L298 is completely unsuitable.
Nope, sqrt(2) times as much as coils are driven in quadrature and the nominal current is for one coil full on and the other off. Anyway this isn't really relevant as stepper driver chips do all the work and act as buck converters anyway so the current from the supply is different again... At power up stepper drivers send 71% of nominal current to each winding, corresponding to 45 electrical degrees of quadrature - at least many of the chip's I've used do this (consult datasheet for DRV8825 etc).
Where do you see that in the datasheet of the stepper? It only states 1.68A per phase and both coils engaged in full step. There is nothing with one coil full on and the other off. ( I know the microstep table of the DRV8825, but that's something different. You can see related values of the motor only in the datasheet of the motor ).