# Adafruit A4988 Stepper Motor Driver Breakout Board

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/134/139/medium800thumb/adafruit_products_6109-07_1.jpg?1734115587)

Stepper motors are used for CNC machines, 3D printers, and whenever else one needs precise, powerful motion. But to get good behavior from steppers, you need a motor driver chip that can provide high bursts of current. And for smooth motion, the chip should be able to PWM that current for microstepping support. You can DIY with a lot of timers, a microcontroller and an H-Bridge chip -&nbsp;_or_ you could take the easy way out and use an **Adafruit A4988 Stepper Motor Driver Breakout Board** which makes controlling stepper motors easy-breezy.

![](https://cdn-learn.adafruit.com/assets/assets/000/134/136/medium800/adafruit_products_6109-04.jpg?1734115377)

All you need is two output pins, no timers, PWM or real-time microcontroller. Set the DIRection pin high or low to set the spin orientation. Then toggle the STEP pin to take one step or microstep at a time. You can set whether you want to go fast with single-step mode or improve the motion precise with 1/4, 1/8 or 1/16 microstepping per STEP toggle. By default the driver is set to 1/16 microstep mode, you can change it by tying the MS1/MS2/MS3 pins low, either with jumpers or with 3 more output pins. The step/microstep mode can even be adjusted on the fly! LEDs on the DIR and STEP pins let you get visual feedback of your motor signal.

![](https://cdn-learn.adafruit.com/assets/assets/000/134/137/medium800/adafruit_products_6109-02.jpg?1734115427)

The Allegro A4988 is a popular driver chip, with small breakout boards used in many 3D printers. Those breakouts are great for plugging into motherboards, but are a little tough to use for prototyping. Our version comes with terminal blocks for the motor power and stepper wires, plus nicely labeled pins for control and mounting holes.

![](https://cdn-learn.adafruit.com/assets/assets/000/134/138/medium800/adafruit_products_6109-03.jpg?1734115463)

We fabricated the board with 2 oz copper to give it a hand with the 2A-max current that this driver can handle. To use the current limiting capability, twist the onboard potentiometer: when all the way to the right we can get to up to 2A max. Note that the higher currents will heat up both the motor driver and stepper, so you may need to add heatsinking to the chip. We don't include a heatsink but you can get [a tall ~80ºC/W](https://www.adafruit.com/product/1493) or [short ~90ºC/W heatsink](https://www.adafruit.com/product/1515) to attach on top.

**Features:**

- [Allegro A4988](https://www.allegromicro.com/en/products/motor-drivers/brush-dc-motor-drivers/a4988) DMOS microstepping driver with translator and overcurrent protection
- Motor voltage from 8V to 35VDC
- Vdd/Logic voltage from 3V to 5V, use with anything from an Arduino-compatible or ESP32 to Raspberry Pi other Single Board Computer
- Terminal screw block connections for easy VMotor power and 4-wire bipolar stepper motor connection with 26-20AWG slots, 2.54mm / 0.1" spacing
- Control steppers using only two pins: DIRection and STEP
- Defaults to 1/16 microstep mode, change by grounding MS1/MS2/MS3 pins (see [A4988 datasheet](https://www.allegromicro.com/-/media/files/datasheets/a4988-datasheet.pdf) for pin configuration)
- Red and Green LEDs on DIR signal to let you know forward or backward motion
- Yellow LED on STEP to let you know that motor is being driven
- Sleep, Reset and Enable control lines for low power / deactivation
- Potentiometer to set current limiting, up to 2A
- 22uF 50V electrolytic capacitor on motor power
- 2 Oz copper for better current carrying and heatsinking
- Four mounting holes

![](https://cdn-learn.adafruit.com/assets/assets/000/134/140/medium800/adafruit_products_6109-05.jpg?1734115699 Board shown with heatsink, available separately)

Comes as one assembled and tested breakout plus a small strip of header. You'll need to do some light soldering to attach the header onto the breakout PCB. Microcontroller, motors, and power supply not included. You will need some sort of driver board that will toggle the DIR/STEP pins for you.

# Adafruit A4988 Stepper Motor Driver Breakout Board

## Pinouts

![](https://cdn-learn.adafruit.com/assets/assets/000/134/144/medium800/adafruit_products_double.jpg?1734121651)

## Power

- **VDD** - This is the logic voltage input. To power the board, give it the same power as the logic level of your microcontroller - e.g. for a 5V micro like Arduino, use 5V. It can be powered between from 3.3V to 5V.
- **+** - This is the motor voltage input. Supply 8V to 35VDC for your motor.
- **GND** / **-** (terminal block) - common ground for power and logic.

## Current Potentiometer

On the right side of the board is the current potentiometer. This potentiometer limits the current output to the motor. When the potentiometer is all the way to the right, you can get up to 2A max. Note that the higher currents will heat up both the motor driver and stepper, so you may need to add heatsinking to the chip.

## Terminal Block Bipolar Stepper Motor Connections

- **1A** and **1B** - The first set of motor control outputs connected to DMOS bridge 1.
- **2A** and **2B** - The second set of motor control outputs connected to DMOS bridge 2.

## Stepper Control Pins

- **DIR** - This is the direction control pin. You can set this pin high or low to set the spin orientation. Pulling it high turns the motor clockwise. Pulling it low turns it counterclockwise.
- **STEP** - This is the microstep control pin. Toggle this pin to take one step or microstep at a time. By default, the driver is set to 1/16 microstep mode.

## Microstep Selection Pins

There are three pins ( **MS1** , **MS2** and **MS3** ) that can be pulled low to change the default 1/16 microstep mode where all three pins are open/high. The table below shows the pin combinations to change to the different modes. For example, if you wanted to use 1/4 microstep mode, you would tie **MS1** and **MS3** to ground (closed/low) and leave&nbsp; **MS2** as-is (open/high).

![](https://cdn-learn.adafruit.com/assets/assets/000/134/145/medium800/adafruit_products_Screenshot_2024-12-16_080718.png?1734354452)

## A4988 Control Pins

- **RST&nbsp;** - This is the reset pin. Pull this pin low to reset the A4988 to its home state.
- **SLP&nbsp;** - This is the sleep pin. Pull this pin low to put the breakout into a low power sleep mode. Pull the pin high to disable sleep mode.
- **EN&nbsp;** - This is the enable pin. Pull this pin high to disable the output to the motors.

## LEDs

- Green LED - The green LED is tied to the DIR pin. It is lit when the motor is being driven counterclockwise when the DIR pin is low.
- Red LED - The red LED is tied to the DIR pin. It is lit when the motor is being driven clockwise when the DIR pin is high.
- Yellow LED - The yellow LED is tied to the STEP pin. It is lit when the motor driver is being moved.

## ROSC Jumpers

On the back of the board is a set of jumpers that are tied to the **ROSC** pin. This pin sets the off-time for the internal PWM current control that determines the off time and decay mode for the motors (how quickly the A4988 reduces current being driven to the motor).

By default, with the jumpers open, the&nbsp; **ROSC** pin is tied to ground with a 20K resistor, setting the off time to approximately 24.2 μs (resistor value divided by 825). The decay mode is automatic mixed (slow and fast), except when driving the motor in full-step mode. Full-step mode uses slow decay.

If you solder the **upper jumper closed** , the **ROSC** pin is tied to **VDD**. This sets the off time internally to 30 μs. The decay mode is automatic mixed (slow and fast), except when driving the motor in full-step mode. Full-step mode uses slow decay.

If you solder the **lower jumper closed** , the **ROSC** pin is tied to **GND**. This sets the off time internally to 30 μs. The decay mode is automatic mixed (slow and fast) for all step modes.

# Adafruit A4988 Stepper Motor Driver Breakout Board

## CircuitPython and Python

It's easy to use the **A4988 Stepper Motor Driver** with CircuitPython and the [digitalio](https://docs.circuitpython.org/en/latest/shared-bindings/digitalio/index.html) core module. This module allows you to easily write Python code to access input and outputs on GPIO pins.

You can use the example code with any CircuitPython microcontroller board or with a computer that has GPIO and Python [thanks to Adafruit\_Blinka, our CircuitPython-for-Python compatibility library](https://learn.adafruit.com/circuitpython-on-raspberrypi-linux).&nbsp;

Featured
### Mini Stepper Motor - 200 Steps - 20x30mm NEMA-8 Size

[Mini Stepper Motor - 200 Steps - 20x30mm NEMA-8 Size](https://www.adafruit.com/product/4411)
This tiny stepper motor is the same quality and step-size as the big NEMA-17's we stock, but so cute so it will work with compact CNC builds. This 4-wire bipolar stepper has 1.8° per step for smooth motion and a nice holding torque. The motor was specified to have a max current of...

In Stock
[Buy Now](https://www.adafruit.com/product/4411)
[Related Guides to the Product](https://learn.adafruit.com/products/4411/guides)
![video of a mini stepper motor rotating with a piece of green paper on the ](https://cdn-shop.adafruit.com/product-videos/640x480/4411-06.jpg)

Featured
### Adjustable Power Supply with 2.1mm / 5.5mm DC - 3V to 12V at 5A

[Adjustable Power Supply with 2.1mm / 5.5mm DC - 3V to 12V at 5A](https://www.adafruit.com/product/4880)
[Put your Snap! cassette on and sing along to "I got the power!"](https://www.youtube.com/watch?v=j1BNcSBApOU) with this super useful power supply adapter where you can easily change the voltage with a snap of your fingers. On the front is a potentiometer knob and a LED...

In Stock
[Buy Now](https://www.adafruit.com/product/4880)
[Related Guides to the Product](https://learn.adafruit.com/products/4880/guides)
![Hand slowly dialing up voltage on power brick, LED strip gets brighter as it increases](https://cdn-shop.adafruit.com/product-videos/640x480/4880-06.jpg)

## CircuitPython Microcontroller Wiring

Here is how you'll wire the breakout to a Feather RP2040 and stepper motor:

Warning: Check your stepper motor wiring - your motor may have different wire colors or wire order.

- **Stepper motor power supply positive** &nbsp;to **breakout terminal block + (red wire)**
- **Stepper motor power supply negative** to **breakout terminal block - (black wire)**
- **Breakout VDD** to **Feather 3.3V (red wire)**
- **Breakout GND** to **Feather GND (black wire)**
- **Breakout DIR** to **Feather**** &nbsp;pin 5 (blue wire)**
- **Breakout STEP** to **Feather**** &nbsp;pin 6 (orange wire)**
- **Breakout 1A** to **stepper motor coil 1 positive (green wire)**
- **Breakout 1B** to **stepper motor coil 1 negative (yellow wire)**
- **Breakout 2A** to **stepper motor coil 2 positive (red wire)**
- **Breakout 2B** to **stepper motor coil 2 negative (black wire)**

![adafruit_products_feather_bb_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/134/165/medium640/adafruit_products_feather_bb_bb.jpg?1734452650)

## Python Computer Wiring

Since there are _dozens_ of Linux computers/boards you can use, we will show wiring for Raspberry Pi. For other platforms, [please visit the guide for CircuitPython on Linux to see whether your platform is supported](https://learn.adafruit.com/circuitpython-on-raspberrypi-linux).

Here's the Raspberry Pi wired to the breakout and a stepper motor:

Warning: Check your stepper motor wiring - your motor may have different wire colors or wire order.

- **Stepper motor power supply positive** &nbsp;to **breakout terminal block + (red wire)**
- **Stepper motor power supply negative** to **breakout terminal block - (black wire)**
- **Breakout VDD** to **Pi 3.3V (red wire)**
- **Breakout GND** to **Pi GND (black wire)**
- **Breakout DIR** to **Pi GPIO&nbsp;**** 5 (blue wire)**
- **Breakout STEP** to **Pi GPIO&nbsp;6 (orange wire)**
- **Breakout 1A** to **stepper motor coil 1 positive (green wire)**
- **Breakout 1B** to **stepper motor coil 1 negative (yellow wire)**
- **Breakout 2A** to **stepper motor coil 2 positive (red wire)**
- **Breakout 2B** to **stepper motor coil 2 negative (black wire)**

![adafruit_products_pi_bb_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/134/166/medium640/adafruit_products_pi_bb_bb.jpg?1734452761)

## Python Blinka Setup

You'll need to install the **Adafruit\_Blinka** library that provides the CircuitPython support in Python. This may also require enabling I2C on your platform and verifying you are running Python 3. [Since each platform is a little different, and Linux changes often, please visit the CircuitPython on Linux guide to get your computer ready](https://learn.adafruit.com/circuitpython-on-raspberrypi-linux)!

## CircuitPython Usage

To use with CircuitPython, you need to update **code.py** with the example script.

In the example below, click the **Download Project Bundle** button below to download the **code.py** file in a zip file. Extract the contents of the zip file, and copy the **code.py** file to your **CIRCUITPY** drive.

Info: There are no additional libraries needed for this example. It uses core modules that are included when you install CircuitPython on your board.

## Python Usage

Once you have the library `pip3` installed on your computer, copy or download the following example to your computer, and run the following, replacing **code.py** with whatever you named the file:

`python3 code.py`

## Example Code

**If running CircuitPython:** Once everything is saved to the **CIRCUITPY** drive, [connect to the serial console](https://learn.adafruit.com/welcome-to-circuitpython/kattni-connecting-to-the-serial-console) to see the data printed out!

**If running Python:** The console output will appear wherever you are running Python.

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/A4988_Examples/CircuitPython_A4988/code.py

The code starts by setting up the direction and step pins as outputs. In the loop, the direction pin will toggle once every loop to change directions. The step pin toggles in a `for` loop to step the motor. As the code runs, you'll see your attached stepper motor turn clockwise and then reverse and turn counterclockwise.

# Adafruit A4988 Stepper Motor Driver Breakout Board

## Arduino

Using the A4988 breakout with Arduino involves wiring up the breakout with a stepper motor to your Arduino-compatible microcontroller and running the provided example code.

Featured
### Mini Stepper Motor - 200 Steps - 20x30mm NEMA-8 Size

[Mini Stepper Motor - 200 Steps - 20x30mm NEMA-8 Size](https://www.adafruit.com/product/4411)
This tiny stepper motor is the same quality and step-size as the big NEMA-17's we stock, but so cute so it will work with compact CNC builds. This 4-wire bipolar stepper has 1.8° per step for smooth motion and a nice holding torque. The motor was specified to have a max current of...

In Stock
[Buy Now](https://www.adafruit.com/product/4411)
[Related Guides to the Product](https://learn.adafruit.com/products/4411/guides)
![video of a mini stepper motor rotating with a piece of green paper on the ](https://cdn-shop.adafruit.com/product-videos/640x480/4411-06.jpg)

Featured
### Adjustable Power Supply with 2.1mm / 5.5mm DC - 3V to 12V at 5A

[Adjustable Power Supply with 2.1mm / 5.5mm DC - 3V to 12V at 5A](https://www.adafruit.com/product/4880)
[Put your Snap! cassette on and sing along to "I got the power!"](https://www.youtube.com/watch?v=j1BNcSBApOU) with this super useful power supply adapter where you can easily change the voltage with a snap of your fingers. On the front is a potentiometer knob and a LED...

In Stock
[Buy Now](https://www.adafruit.com/product/4880)
[Related Guides to the Product](https://learn.adafruit.com/products/4880/guides)
![Hand slowly dialing up voltage on power brick, LED strip gets brighter as it increases](https://cdn-shop.adafruit.com/product-videos/640x480/4880-06.jpg)

## Wiring

Wire as shown for a **5V** board like an Uno. If you are using a **3V** board, like an Adafruit Feather, wire the board's 3V pin to the breakout VDD.

Here is an Adafruit Metro wired up to the breakout with a stepper motor. You'll need to connect the stepper motor power supply to the DC jack on the Metro.

Warning: Check your stepper motor wiring - your motor may have different wire colors or wire order.

- **Stepper motor power supply** to **Metro DC Jack**
- **Breakout VDD** to **Metro 5V (red wire)**
- **Breakout GND** to **Metro GND (black wire)**
- **Breakout DIR** to **Metro pin 5 (blue wire)**
- **Breakout STEP** to **Metro pin 6 (orange wire)**
- **Breakout terminal block +** to **Metro VIN (red wire)**
- **Breakout 1A** to **stepper motor coil 1 positive (green wire)**
- **Breakout 1B** to **stepper motor coil 1 negative (yellow wire)**
- **Breakout 2A** to **stepper motor coil 2 positive (red wire)**
- **Breakout 2B** to **stepper motor coil 2 negative (black wire)**

![adafruit_products_arduino_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/134/164/medium640/adafruit_products_arduino_bb.jpg?1734445119)

## Example Code
https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/A4988_Examples/Arduino_A4988/Arduino_A4988.ino

Upload the sketch to your board.&nbsp;You'll see your attached stepper motor turn slowly clockwise and then reverse and turn slowly counterclockwise.

# Adafruit A4988 Stepper Motor Driver Breakout Board

## Downloads

## Files

- [A4988 Datasheet](https://cdn-learn.adafruit.com/assets/assets/000/134/141/original/A4988-Datasheet.pdf?1734115782)
- [EagleCAD PCB Files on GitHub](https://github.com/adafruit/Adafruit-A4988-Breakout-PCB)
- [3D models on GitHub](https://github.com/adafruit/Adafruit_CAD_Parts/tree/main/6109%20A4988%20Driver)
- [Fritzing object in the Adafruit Fritzing Library](https://github.com/adafruit/Fritzing-Library/blob/master/parts/Adafruit%20A4988%20Stepper%20Motor%20Driver%20Breakout.fzpz)

## Schematic and Fab Print
![](https://cdn-learn.adafruit.com/assets/assets/000/134/142/medium800/adafruit_products_schem.png?1734116053)

![](https://cdn-learn.adafruit.com/assets/assets/000/134/143/medium800/adafruit_products_fab.png?1734116059 dimensions are in inches)

![](https://cdn-learn.adafruit.com/assets/assets/000/134/502/medium800/adafruit_products_6109_A4988_Driver.jpg?1737052217)


## Primary Products

### Adafruit A4988 Stepper Motor Driver Breakout Board

[Adafruit A4988 Stepper Motor Driver Breakout Board](https://www.adafruit.com/product/6109)
Stepper motors are used for CNC machines, 3D printers, and whenever else one needs precise, powerful motion. But to get good behavior from steppers you need a motor driver chip that can provide high bursts of current, and for smooth motion, be able to PWM that current for microstepping...

In Stock
[Buy Now](https://www.adafruit.com/product/6109)
[Related Guides to the Product](https://learn.adafruit.com/products/6109/guides)

## Guide Products

### Mini Stepper Motor - 200 Steps - 20x30mm NEMA-8 Size

[Mini Stepper Motor - 200 Steps - 20x30mm NEMA-8 Size](https://www.adafruit.com/product/4411)
This tiny stepper motor is the same quality and step-size as the big NEMA-17's we stock, but so cute so it will work with compact CNC builds. This 4-wire bipolar stepper has 1.8° per step for smooth motion and a nice holding torque. The motor was specified to have a max current of...

In Stock
[Buy Now](https://www.adafruit.com/product/4411)
[Related Guides to the Product](https://learn.adafruit.com/products/4411/guides)
### Adjustable Power Supply with 2.1mm / 5.5mm DC - 3V to 12V at 5A

[Adjustable Power Supply with 2.1mm / 5.5mm DC - 3V to 12V at 5A](https://www.adafruit.com/product/4880)
[Put your Snap! cassette on and sing along to "I got the power!"](https://www.youtube.com/watch?v=j1BNcSBApOU) with this super useful power supply adapter where you can easily change the voltage with a snap of your fingers. On the front is a potentiometer knob and a LED...

In Stock
[Buy Now](https://www.adafruit.com/product/4880)
[Related Guides to the Product](https://learn.adafruit.com/products/4880/guides)

## Related Guides

- [Adafruit TMC2209 Stepper Motor Driver Breakout Board](https://learn.adafruit.com/adafruit-tmc2209-stepper-motor-driver-breakout-board.md)
- [LED Sculpture Lamp](https://learn.adafruit.com/led-sculpture-lamp.md)
- [Adafruit LM73100 Ideal Diode Breakout](https://learn.adafruit.com/adafruit-lm73100-ideal-diode-breakout.md)
- [Motorized POV LED Display](https://learn.adafruit.com/motorized-pov-led-display.md)
- [Adafruit STSPIN220 Stepper Motor Driver Breakout Board](https://learn.adafruit.com/adafruit-stspin220-stepper-motor-driver-breakout-board.md)
- [Adafruit I2C to 8 Channel Solenoid Driver](https://learn.adafruit.com/adafruit-i2c-to-8-channel-solenoid-driver.md)
- [Tyrell Desktop Synthesizer](https://learn.adafruit.com/tyrell-desktop-synthesizer.md)
- [USB C Power Delivery Monitor](https://learn.adafruit.com/usb-c-benchtop-power-supply.md)
- [Custom Fonts for CircuitPython Displays](https://learn.adafruit.com/custom-fonts-for-pyportal-circuitpython-display.md)
- [Piper Make With the Raspberry Pi Pico](https://learn.adafruit.com/piper-make-with-the-raspberry-pi-pico.md)
- [The Foul Fowl -- Keystroke Injection Attack Tool with Gemma M0](https://learn.adafruit.com/the-foul-fowl-keyboard-injection-payload-gemma-m0.md)
- [Adafruit CAN Pal](https://learn.adafruit.com/adafruit-can-pal.md)
- [FruitBox Sequencer: Musically Delicious Step Pattern Generator ](https://learn.adafruit.com/circuitpython-fruitbox-sequencer-musically-delicious-step-pattern-generator.md)
- [Adabot Toy Robot Friend](https://learn.adafruit.com/adabot-rp2040.md)
- [Holiday Tree with Feather RP2040 Scorpio](https://learn.adafruit.com/holiday-tree-with-scorpio.md)
