Stepper won't even move. Had it working before but now it won't move or make a sound, also tried with another stepper motor of the exact same model and a different driver. I am wondering if it is my arduino but that still works with other
motors.
// Include the AccelStepper Library
#include <AccelStepper.h>
// Define pin connections
const int dirPin = 2;
const int stepPin = 3;
// Define motor interface type
#define motorInterfaceType 1
// Creates an instance
AccelStepper myStepper(motorInterfaceType, stepPin, dirPin);
void setup() {
// set the maximum speed, acceleration factor,
// initial speed and the target position
myStepper.setMaxSpeed(800);
myStepper.setAcceleration(400);
myStepper.setSpeed(200);
myStepper.moveTo(4000);
Serial.begin(9600); // Initialize Serial communication
}
void loop() {
// Change direction once the motor reaches target position
if (myStepper.distanceToGo() == 0)
myStepper.moveTo(myStepper.currentPosition() + 4000);
// Move the motor one step
myStepper.run();
}
PMX1740-J10 stepper, A4988 driver, 9V battery, Arduino Uno, 47microfarad capacitror.
9v battery doesn’t have enough current.
Breadboard is not rated for motor currents. Get a real power supply and better wiring.
it does work, I had it working fine previously.
Yeah, for about a minute until the 9v battery went flat.

check driver wiring. at least right side is shifted down
Yeah I just saw that as well, I moved it up correctly. Still nothing happens.
show
Measure the battery voltage. Betcha its 8v or less ...
here how you should adjust current
I already walked through this tutorial to limit the current.
How To Correctly Set The Motor Current Limit On An A4988 Stepper Motor Driver
Fresh battery, measuring 9.58v.
KISS
keep it simple
const int dirPin = 2;
const int stepPin = 3;
void setup() {
pinMode(stepPin, OUTPUT);
analogWrite(stepPin, 128);
}
void loop() {
}
You want go that far with this battery. Minimum voltage gor A4988 is 8V, and look at the datasheet of your motor, what is the peak current?
did you determine coils before connecting?
What is motor stall current? 9v battery can't really supply that current for more than an instant.
Put a real power supply on it.
How many seconds does that last?