← All parts
A4988 Stepper Motor Driver
Allegro MicroSystems
The A4988 is a microstepping bipolar stepper motor driver carrier. STEP/DIR pins advance the motor; MS1-MS3 select full to 1/16 microstepping; a trim pot sets the coil current limit. Widely used on 3D printers and CNC.
In stock
Specifications
0No specs listed.
Pinout
16| Pin | Name | Functions | Notes |
|---|---|---|---|
| 1 | ENABLE | GPIO | Active-low driver enable |
| 2 | MS1 | GPIO | Microstep select 1 |
| 3 | MS2 | GPIO | Microstep select 2 |
| 4 | MS3 | GPIO | Microstep select 3 |
| 5 | RESET | GPIO | Active-low reset (tie to SLEEP if unused) |
| 6 | SLEEP | GPIO | Active-low sleep |
| 7 | STEP | GPIO | One pulse = one (micro)step |
| 8 | DIR | GPIO | Rotation direction |
| 9 | VMOT | POWER | Motor supply 8-35V (add 100uF cap) |
| 10 | GND | GND | Motor ground |
| 11 | 2B | — | Coil 2 output B |
| 12 | 2A | — | Coil 2 output A |
| 13 | 1A | — | Coil 1 output A |
| 14 | 1B | — | Coil 1 output B |
| 15 | VDD | POWER | Logic supply 3-5.5V |
| 16 | GND | GND | Logic ground |
Interactive pinout
Highlight:
BOARD
Click a pin to copy its name · tap a tag above to spotlight a bus.
Starter code
Community starter examples — minimal, unofficial, and provided to get you wiring fast. Verify against the manufacturer datasheet before relying on them.
Arduino (C++)
Arduino library: AccelStepper
arduino
// A4988 stepper driver — community starter example
#include <AccelStepper.h>
#if defined(ESP32)
#define STEP_PIN 4
#define DIR_PIN 5
#else
#define STEP_PIN 3
#define DIR_PIN 4
#endif
// DRIVER mode = external STEP + DIR driver
AccelStepper stepper(AccelStepper::DRIVER, STEP_PIN, DIR_PIN);
void setup() {
stepper.setMaxSpeed(1000);
stepper.setAcceleration(500);
stepper.moveTo(200); // 200 full steps = 1 revolution
}
void loop() {
if (stepper.distanceToGo() == 0) stepper.moveTo(-stepper.currentPosition());
stepper.run();
}MicroPython
python
# A4988 stepper driver (ESP32) — community starter example
# manual STEP/DIR pulsing (no external lib needed)
from machine import Pin
import time
step = Pin(4, Pin.OUT) # STEP=GPIO4
dir_ = Pin(5, Pin.OUT) # DIR=GPIO5
dir_.value(1)
for _ in range(200): # 200 full steps = 1 rev
step.value(1); time.sleep_us(800)
step.value(0); time.sleep_us(800)Wiring
| Pin | Arduino Uno R3 | ESP32 DevKitC (WROOM-32) | Notes |
|---|---|---|---|
| VDD | +5V | 3V3 | Logic supply 3-5.5 V |
| GND (logic) | GND | GND | |
| STEP | D3 | GPIO4 | |
| DIR | D4 | GPIO5 | |
| ENABLE | - | - | Tie LOW to enable, or drive from a GPIO |
| VMOT/GND | - | - | Motor supply 8-35 V + 100 uF cap; 1A/1B/2A/2B go to the coils |
Typical uses
- Driving bipolar steppers (3D printers, CNC, robots)
- Microstepping motion control