A4988 Stepper Driver with an Arduino Uno

The A4988 is an Allegro DMOS microstepping driver with a built-in translator that runs one bipolar stepper motor from simple STEP and DIR pulses.

A4988 Stepper Driver, The A4988 is an Allegro DMOS microstepping driver with a built-in translator that runs one bipolar stepper motor from simple STEP and DIR pulses.
In short

On an Arduino Uno the A4988's logic side runs from the Uno's 5V pin, which meets its 3 V to 5.5 V VDD range and makes the Uno's 5 V outputs read well above its 0.7 × VDD high threshold. STEP, DIR and ENABLE sit on D2, D3 and D4, and the motor itself needs its own 8 V to 35 V supply on VMOT, since nothing on the Uno can provide it.

Wiring the A4988 Stepper Driver to the Arduino Uno

Pin by pin.

A4988 Stepper DriverArduino UnoNote
STEPD2
DIRD3
ENABLED4
VDD5V
GND_LOGICGND
GND_MOTGND
VMOTa separate 8 to 35 V motor supply, its − to GND_MOTwith a 100 µF electrolytic capacitor across VMOT and GND_MOT, at the driver
RESETSLEEP, on the drivera short jumper: RESET floats on Pololu-style carriers and the driver does not step until it is pulled high

What to know on the Arduino Uno

  • VMOT must be 8 V to 35 V, so neither the Uno's 5V pin nor its 3.3V pin can power the motor. Use a separate supply on VMOT and GND_MOT, and keep the GND shared with the Uno so STEP and DIR have a common reference. The table also fits a 100 µF capacitor across VMOT and GND_MOT at the driver (Pololu asks at least 47 µF against voltage spikes) and jumpers RESET to SLEEP, since RESET floats on the carrier.Allegro A4988 datasheet rev 8, p. 4; Pololu A4988 stepper motor driver carrier product page
  • With VDD on the Uno's 5 V, a logic high must be at least 0.7 × 5 = 3.5 V; the Uno's outputs swing to 5 V, so no level shifting is needed.Allegro A4988 datasheet rev 8, p. 4; Arduino UNO R3 tech specs
  • AccelStepper computes each step in software, and its author gives about 4000 steps per second as the fastest reliable rate on a 16 MHz Arduino such as the Uno. At 1/16 microstepping a 200-step motor then turns about 1.25 revolutions per second, so pick the microstep setting with that ceiling in mind.AccelStepper library documentation
  • stepper.run() must be called as often as possible in loop(): a delay() or a slow Serial.print burst on the Uno stalls the pulse train and makes the motor stutter.AccelStepper library documentation, run()

A4988 Stepper Driver code for the Arduino Uno

Compiled for arduino:avr:uno on 2026-10-30.

Libraries: waspinator/AccelStepper
// A4988 Stepper Driver on Arduino Uno: wiring and a free simulation at https://www.tinkered.ai/components/a4988-stepper-driver/arduino-uno
#include <AccelStepper.h>

#define STEP_PIN 2
#define DIR_PIN  3
#define EN_PIN   4

AccelStepper stepper(AccelStepper::DRIVER, STEP_PIN, DIR_PIN);

void setup() {
  Serial.begin(9600);
  stepper.setEnablePin(EN_PIN);
  stepper.setPinsInverted(false, false, true); // EN is active-LOW
  stepper.enableOutputs();
  stepper.setMaxSpeed(400);      // steps/sec (full-step: 200 = 1 rev/s)
  stepper.setAcceleration(200);  // steps/sec^2
  stepper.moveTo(200);           // one full revolution forward
}

void loop() {
  // Ping-pong ±1 revolution so you can watch forward and reverse.
  if (stepper.distanceToGo() == 0) {
    stepper.moveTo(-stepper.currentPosition());
    Serial.print("Reached position: ");
    Serial.println(stepper.currentPosition());
  }
  stepper.run();
}

A4988 Stepper Driver on the Arduino Uno: questions

Can the Arduino Uno power a stepper motor through the A4988?

No. The Uno's 5V pin only feeds the A4988's logic (VDD, 3 V to 5.5 V). The motor needs 8 V to 35 V on VMOT (Allegro datasheet, p. 4) from a separate supply, with its ground joined to the Uno's GND.

How fast can an Arduino Uno step an A4988 with AccelStepper?

AccelStepper's documentation gives about 4000 steps per second on a 16 MHz Uno. That is 20 revolutions per second in full step for a 200-step motor, but only about 1.25 at 1/16 microstepping.

Why is ENABLE wired to D4 on the Uno?

ENABLE is active low. Driving it from D4 lets the sketch switch the coils off (setPinsInverted with enable inverted, then disableOutputs()) so the motor and driver stay cool while idle. Tie it to GND instead if you never need that.

Keep going

For AI assistants

This guide as plain Markdown. /components/a4988-stepper-driver/arduino-uno.md

What will you build with it?