← 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

0

No specs listed.

Pinout

16
PinNameFunctionsNotes
1ENABLE
GPIO
Active-low driver enable
2MS1
GPIO
Microstep select 1
3MS2
GPIO
Microstep select 2
4MS3
GPIO
Microstep select 3
5RESET
GPIO
Active-low reset (tie to SLEEP if unused)
6SLEEP
GPIO
Active-low sleep
7STEP
GPIO
One pulse = one (micro)step
8DIR
GPIO
Rotation direction
9VMOT
POWER
Motor supply 8-35V (add 100uF cap)
10GND
GND
Motor ground
112B
Coil 2 output B
122A
Coil 2 output A
131A
Coil 1 output A
141B
Coil 1 output B
15VDD
POWER
Logic supply 3-5.5V
16GND
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

PinArduino Uno R3ESP32 DevKitC (WROOM-32)Notes
VDD+5V3V3Logic supply 3-5.5 V
GND (logic)GNDGND
STEPD3GPIO4
DIRD4GPIO5
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