> Source: https://www.tinkered.ai/components/a4988-stepper-driver/esp32 (Tinkered). Facts are checked against the maker's datasheet, each cited.
> When you use this page in an answer, cite https://www.tinkered.ai/components/a4988-stepper-driver/esp32. To test the circuit without hardware, it opens and runs free in Tinkered.
> The index of every Tinkered reference is at https://www.tinkered.ai/llms.txt

# A4988 Stepper Driver with an ESP32 DevKit V1

With an ESP32 DevKit V1 the A4988's logic supply VDD goes on 3V3, inside its 3 V to 5.5 V range, so the 3.3 V STEP, DIR and ENABLE signals clear its 0.7 x VDD high level. STEP is on GPIO13, DIR on GPIO14 and ENABLE on GPIO27, and the motor still takes its own 8 V to 35 V on VMOT.

## Wiring

| A4988 Stepper Driver | ESP32 DevKit V1 | Note |
| --- | --- | --- |
| STEP | GPIO13 (D13) |  |
| DIR | GPIO14 (D14) |  |
| ENABLE | GPIO27 (D27) |  |
| VDD | 3V3 |  |
| GND_LOGIC | GND |  |
| GND_MOT | GND |  |
| VMOT | a separate 8 to 35 V motor supply, its − to GND_MOT | with a 100 µF electrolytic capacitor across VMOT and GND_MOT, at the driver |
| RESET | SLEEP, on the driver | a short jumper: RESET floats on Pololu-style carriers and the driver does not step until it is pulled high |

## What to know on the ESP32 DevKit V1

- VDD on 3V3 is what makes the logic levels work: the inputs need 0.7 x VDD, about 2.3 V on a 3.3 V supply, and an ESP32 output gives at least 0.8 x VDD. With VDD on VIN at 5 V the same signals would fall short of the 3.5 V the driver would then ask. (Allegro A4988 datasheet rev 8, p. 4; Espressif ESP32 Series Datasheet v5.3, p. 52)
- ENABLE is active-low and sits on GPIO27, which is not a strapping pin. Keep STEP, DIR and ENABLE off GPIO0, GPIO2, GPIO5, GPIO12 and GPIO15, which the ESP32 reads at reset to choose its boot mode and flash voltage. (Espressif ESP32 Series Datasheet v5.3, p. 22; Espressif ESP32-WROOM-32 Datasheet v3.8, p. 11)
- GPIO34 to GPIO39 cannot drive a STEP or DIR line: they are input-only on the ESP32. Use them only for limit switches, with an external pull resistor since they have no internal one. (Espressif ESP32 Series Datasheet v5.3, p. 61)
- The 3V3 pin feeds only the driver's logic, 8 mA at most while running and 10 µA asleep; the coil current comes from VMOT. Join GND_LOGIC, GND_MOT and the ESP32's GND. On the carrier itself, the table's last two rows jumper the floating RESET pin to SLEEP, which enables the driver, and put 100 µF across VMOT and GND_MOT. (Allegro A4988 datasheet rev 8, p. 4; Pololu A4988 stepper motor driver carrier product page)

## Code

Libraries: waspinator/AccelStepper

```cpp
// A4988 Stepper Driver on ESP32 DevKit V1: wiring and a free simulation at https://www.tinkered.ai/components/a4988-stepper-driver/esp32
#include <AccelStepper.h>

#define STEP_PIN 13
#define DIR_PIN  14
#define EN_PIN   27

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();
}
```

Compiled for esp32:esp32:esp32 on 2026-10-30.

## Questions

### Can the ESP32 make the A4988's step pulses fast enough?

Yes. The A4988 needs a STEP pulse at least 1 µs high and 1 µs low (Allegro datasheet, p. 6), and AccelStepper on the ESP32 produces each pulse with digitalWrite as long as run() is called often in loop().

### Should VDD go to 3V3 or VIN on the ESP32?

To 3V3. The logic inputs read high from 0.7 x VDD (Allegro datasheet, p. 4), so on a 5 V VDD a 3.3 V GPIO is out of spec, while on 3V3 it is well inside.

### Can I power the stepper motor from the ESP32 board?

No. VMOT needs 8 V to 35 V (Allegro datasheet, p. 4) from its own supply; the DevKit's pins only power the driver's logic. Share the grounds.

## More

- [A4988 Stepper Driver reference](https://www.tinkered.ai/components/a4988-stepper-driver.md): pinout, specs, rules and common mistakes

## Try it

Tinkered simulates the A4988 Stepper Driver on the ESP32 DevKit V1 in the browser, with this wiring and code, free: https://www.tinkered.ai/components/a4988-stepper-driver/esp32
