spe_SPEEDYSTEPPER17-304_201214_1.pdf (203.0 KB)
I have wired my stepper motor to my Arduino Mega. Making sure the coils are in the correct place. The stepper sort of moves but outputs almost no torque.
A4988 Pinout:
- VMOT → Motor Power Supply (8V to 35V)
- GND → Ground (Power Supply and Microcontroller)
- VDD → Logic Voltage (3.3V or 5V from Microcontroller)
- STEP → Step signal from Microcontroller
- DIR → Direction signal from Microcontroller
- 1A, 1B, 2A, 2B → Stepper Motor Windings
- ENABLE (EN) → Optional, connect to GND to enable driver
Stepper Motor Wiring:
Refer to the wiring diagram in the datasheet. The motor has 4 wires:
- Red → Coil A+
- Yellow → Coil A-
- Blue → Coil B+
- Orange → Coil B-
Connect the motor wires:
- 1A → Red (A+)
- 1B → Yellow (A-)
- 2A → Blue (B+)
- 2B → Orange (B-)
Connect power:
- VMOT → 12V to 24V (external supply)
- GND → Ground of the supply
Microcontroller to A4988:
- VDD → 5V from Arduino
- GND → Ground of Arduino
- STEP → Any digital pin (e.g., D2)
- DIR → Any digital pin (e.g., D3)
- EN → GND (always enabled or use a control pin if needed)
I have done everything here and the stepper jitters sometimes, other times it moves, but like I said it has no torque and doesn't seem to be keeping up with the steps. I'm totally stumped on this.
This is the code I was using:
#define STEP_PIN 3 // Connect A4988 STEP pin to Arduino D3
#define DIR_PIN 4 // Connect A4988 DIR pin to Arduino D4
#define EN_PIN 8 // Connect A4988 ENABLE pin to Arduino D8 (optional)
const int stepsPerRevolution = 200; // 200 steps per revolution for 1.8° stepper motor
const int microstepping = 1; // Adjust this if you're using microstepping (1, 2, 4, 8, 16)
void setup() {
pinMode(STEP_PIN, OUTPUT);
pinMode(DIR_PIN, OUTPUT);
pinMode(EN_PIN, OUTPUT);
digitalWrite(EN_PIN, LOW); // Enable the motor driver (LOW to enable, HIGH to disable)
digitalWrite(DIR_PIN, HIGH); // Set initial direction
Serial.begin(9600);
Serial.println("A4988 stepper motor ready...");
}
void loop() {
Serial.println("Moving clockwise...");
rotateMotor(stepsPerRevolution * microstepping); // Move 1 full revolution clockwise
delay(1000);
Serial.println("Moving counterclockwise...");
digitalWrite(DIR_PIN, LOW); // Change direction
rotateMotor(stepsPerRevolution * microstepping); // Move 1 full revolution counterclockwise
delay(1000);
}
// Function to pulse STEP pin to rotate motor
void rotateMotor(int steps) {
for (int i = 0; i < steps; i++) {
digitalWrite(STEP_PIN, HIGH);
delayMicroseconds(800); // Adjust delay for speed control
digitalWrite(STEP_PIN, LOW);
delayMicroseconds(800);
}
}




