> Source: https://www.tinkered.ai/components/a4988-stepper-driver/raspberry-pi-pico (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/raspberry-pi-pico. 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 a Raspberry Pi Pico

The Pico drives the A4988 from three GPIOs: STEP on GP0, DIR on GP1 and the active-low ENABLE on GP2, with the driver's logic powered from the Pico's 3V3 pin. That 3.3 V logic supply is the point of this pairing: the A4988's inputs read high from 0.7 x VDD, so a 5 V VDD would ask for more than a Pico pin can give.

## Wiring

| A4988 Stepper Driver | Raspberry Pi Pico | Note |
| --- | --- | --- |
| STEP | GP0 |  |
| DIR | GP1 |  |
| ENABLE | GP2 |  |
| 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 Raspberry Pi Pico

- Keep VDD on 3V3. The A4988 accepts 3 V to 5.5 V there, and with VDD at 3.3 V its 0.7 x VDD input threshold is about 2.3 V, which the Pico's 3.3 V outputs clear; on VBUS it would be 3.5 V. (Allegro A4988 datasheet rev 8, p. 4)
- The motor never runs from the Pico: VMOT takes 8 V to 35 V from its own supply, and only the grounds are joined. The Pico's VBUS and VSYS cannot reach that range. (Allegro A4988 datasheet rev 8, p. 4; Raspberry Pi Pico datasheet, release 21, p. 8)
- STEP pulses need only 1 µs high and 1 µs low, far shorter than AccelStepper's timing on the RP2040, so any GPIO works; the RP2040's PIO blocks can generate step trains in hardware if a project outgrows run(). (Allegro A4988 datasheet rev 8, p. 6; Raspberry Pi Pico datasheet, release 21, p. 4)

## Code

Libraries: waspinator/AccelStepper

```cpp
// A4988 Stepper Driver on Raspberry Pi Pico: wiring and a free simulation at https://www.tinkered.ai/components/a4988-stepper-driver/raspberry-pi-pico
#include <AccelStepper.h>

#define STEP_PIN 0
#define DIR_PIN  1
#define EN_PIN   2

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 rp2040:rp2040:rpipico on 2026-10-30.

## Questions

### Can the Pico power the A4988's logic from 3V3?

Yes. VDD accepts 3 V to 5.5 V (Allegro datasheet rev 8, p. 4), and the logic side draws little, well within the 300 mA Raspberry Pi recommends for the 3V3 pin (Pico datasheet, p. 8). The motor current comes from VMOT, never from the Pico.

### Why does my stepper not move with the Pico?

Check that ENABLE (GP2) is driven low: the sketch inverts it with setPinsInverted(false, false, true) and calls enableOutputs(). Then check VMOT is powered, RESET is jumpered to SLEEP on the carrier (it floats otherwise, Pololu A4988 page), the grounds are joined and the current limit is set.

### Do I need a level shifter between the Pico and the A4988?

No, as long as VDD is on 3V3. Inputs read high from 0.7 x VDD (Allegro datasheet rev 8, p. 4), about 2.3 V there.

## 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 Raspberry Pi Pico in the browser, with this wiring and code, free: https://www.tinkered.ai/components/a4988-stepper-driver/raspberry-pi-pico
