Description
A4988 Stepper Motor Driver Module
The A4988 Stepper Motor Driver is a popular and compact module used to control bipolar stepper motors, such as the NEMA 17, with high precision and variable microstepping. It is commonly used in 3D printers, CNC machines, and robotics.
Technical Specifications:
-
Input Voltage (VMOT): 8V to 35V DC
-
Logic Voltage (VDD): 3V–5.5V (usually powered from Arduino 5V)
-
Motor Type: Bipolar Stepper Motors
-
Current per Phase: Up to 2A (with sufficient cooling)
-
Microstepping: Full, 1/2, 1/4, 1/8, 1/16 (selectable via MS1–MS3)
-
Step Interface: STEP and DIR pins
-
Protections: Over-temperature, under-voltage, and short-to-ground
-
Step Frequency: Up to 500 kHz
- Sleep Mode: Available (via SLEEP pin – LOW to enter sleep mode)
Pinouts:
Front View
Back View
Connection with Arduino:
A4988 Pins |
Arduino Pins |
Description |
VDD |
5V |
Logic power input |
GND |
GND |
Logic ground |
VMOT |
External 12V–24V + |
Motor power supply |
GND |
External Power Supply - |
Motor power ground |
STEP |
Pin 3 |
Step signal |
DIR |
Pin 4 |
Direction control |
ENABLE |
Pin 5 (Optional) |
Enable (active LOW) or tie to GND |
MS1, MS2, MS3 |
VCC or GND |
Select microstepping mode |
RESET |
Tie to SLEEP |
Keeps the driver active |
SLEEP |
Tie to RESET |
Keeps the driver awake |
OUT1A/1B, OUT2A/2B |
Stepper Motor |
Stepper Motor Connect the stepper motor coils |
Microstepping Setup
MS1 |
MS2 |
MS3 |
Microstepping |
LOW |
LOW |
LOW |
Full step |
HIGH |
LOW |
LOW |
Half step |
LOW |
HIGH |
LOW |
1/4 step |
HIGH |
HIGH |
LOW |
1/8 step |
HIGH |
HIGH |
HIGH |
1/16 step |
Sample code:
// A4988 connection pins
#define STEP_PIN 3
#define DIR_PIN 4
// Number of steps per revolution (change as needed)
#define STEPS_PER_REV 200 // Typical for NEMA 17 with full steps
void setup() {
pinMode(STEP_PIN, OUTPUT);
pinMode(DIR_PIN, OUTPUT);
}
void loop() {
// Rotate one revolution clockwise
digitalWrite(DIR_PIN, HIGH);
for (int i = 0; i < STEPS_PER_REV; i++) {
digitalWrite(STEP_PIN, HIGH);
delayMicroseconds(1000); // Speed control
digitalWrite(STEP_PIN, LOW);
delayMicroseconds(1000);
}
delay(1000); // Pause between rotations
// Rotate one revolution counter-clockwise
digitalWrite(DIR_PIN, LOW);
for (int i = 0; i < STEPS_PER_REV; i++) {
digitalWrite(STEP_PIN, HIGH);
delayMicroseconds(1000);
digitalWrite(STEP_PIN, LOW);
delayMicroseconds(1000);
}
delay(1000);
}