This is one of my first Arduino projects and I am hitting a snag. I am trying to run a NEMA 14 stepper motor with an A4988 driver. I cant figure out why it isn't working. (No movement or buzzing or anything!). Should the digital output for the stepping (Pin 2 in code) be reading 5V? When measuring I am only getting 0.01.
NEMA 14 Specs: 2 phase, 5.4V, Phase- 0.8A
Wired exactly how Pololu shows. except I am using a 5V external power supply:
Code (from forum User Robin2):
// testing a stepper motor with a Pololu A4988 driver board or equivalent
// on an Uno the onboard led will flash with each step
// as posted on Arduino Forum at http://forum.arduino.cc/index.php?topic=208905.0
byte directionPin = 6;
byte stepPin = 2;
int numberOfSteps = 1000;
byte ledPin = 13;
int pulseWidthMicros = 20; // microseconds
int millisbetweenSteps = 25; // milliseconds
void setup()
{
Serial.begin(9600);
Serial.println("Starting StepperTest");
digitalWrite(ledPin, LOW);
delay(2000);
pinMode(directionPin, OUTPUT);
pinMode(stepPin, OUTPUT);
pinMode(ledPin, OUTPUT);
digitalWrite(directionPin, HIGH);
for(int n = 0; n < numberOfSteps; n++) {
digitalWrite(stepPin, HIGH);
delayMicroseconds(pulseWidthMicros);
digitalWrite(stepPin, LOW);
delay(millisbetweenSteps);
digitalWrite(ledPin, !digitalRead(ledPin));
}
delay(3000);
digitalWrite(directionPin, LOW);
for(int n = 0; n < numberOfSteps; n++) {
digitalWrite(stepPin, HIGH);
delayMicroseconds(pulseWidthMicros);
digitalWrite(stepPin, LOW);
delay(millisbetweenSteps);
digitalWrite(ledPin, !digitalRead(ledPin));
}
}
void loop()
{
}
An A4988 won't work with a 5v motor power supply. Try 12v. Stepper motors work better with higher voltages. Just be sure to set the current limit to protect your motor.
Thanks. I threw a 9V on it and it worked! I was following some other guides I found online and people were getting it to work with 5V powered via the Arduino on a 12V Nema 17.
I will probably swap out the A2988 with a different driver.
HypnoticLasagna:
Id prefer to only have 1 power supply. USB is easiest for me and the application.
USB power is not a practical option for a stepper motor. On the one hand you will probably draw too much current from the USB connection and may damage it. On the other hand the stepper motor will perform very poorly with a 5v power supply. I reckon 12v is the minimum and 24v would be better.