The A4988 stepper motor driver on a breakout board is a compact, complete microstepping motor driver with a built-in translator for easy operation. It is designed to operate bipolar stepper motors in full-, half-, quarter-, eighth-, and sixteenth-step modes, with an output drive capacity of up to 35 V and ±2 A. The A4988 is commonly used in 3D printers, CNC machines, and other applications where precise control of a stepper motor is required.
Pin Number | Name | Description |
---|---|---|
1 | VMOT | Motor supply voltage (8 - 35 V) |
2 | GND | Ground (0 V) |
3 | 2B | Motor connection B |
4 | 2A | Motor connection A |
5 | 1A | Motor connection A |
6 | 1B | Motor connection B |
7 | VDD | Logic supply voltage (3.3 - 5.5 V) |
8 | GND | Ground (0 V) |
9 | STEP | Step input (pulses) |
10 | DIR | Direction input |
11 | MS1 | Microstep selection 1 |
12 | MS2 | Microstep selection 2 |
13 | MS3 | Microstep selection 3 |
14 | RESET | Resets the driver when pulled low |
15 | SLEEP | Puts the driver in sleep mode when pulled low |
16 | EN | Enables the driver when pulled low |
// Define step and direction pins
#define DIR_PIN 2
#define STEP_PIN 3
void setup() {
// Set the motor control pins as outputs
pinMode(DIR_PIN, OUTPUT);
pinMode(STEP_PIN, OUTPUT);
}
void loop() {
// Set the direction
digitalWrite(DIR_PIN, HIGH); // Set to LOW to change direction
// Move the motor with a simple stepping pattern
for (int i = 0; i < 200; i++) {
// Pulse the STEP pin to move the motor
digitalWrite(STEP_PIN, HIGH);
delayMicroseconds(800); // Adjust the speed
digitalWrite(STEP_PIN, LOW);
delayMicroseconds(800); // Adjust the speed
}
// Pause before changing direction
delay(1000);
}
Q: Can I drive a motor that requires more than 2 A with the A4988? A: No, the A4988 is limited to 2 A per phase with proper cooling. For higher currents, consider using a driver capable of handling the required current.
Q: How do I set the current limit on the A4988? A: Turn the potentiometer while measuring the voltage on the REF pin or the VREF voltage at the potentiometer. Use the formula provided in the datasheet to calculate the appropriate VREF for your motor's current limit.
Q: What is the purpose of the microstep pins (MS1, MS2, MS3)? A: These pins allow you to select the microstepping resolution. By setting these pins HIGH or LOW, you can choose between full-step, half-step, quarter-step, eighth-step, and sixteenth-step modes.
Q: Why does my motor make a whining noise? A: This can be due to high current settings or rapid stepping. Try adjusting the current limit or step rate. Additionally, microstepping can reduce noise and provide smoother motion.