Project Overview
Arduino Uno + A4988 stepper driver: In this project, you will wire the ShillehTek Original A4988 Stepper Motor Driver with Heatsink to an Arduino Uno and control a stepper motor using two simple signals: STEP (pulses) and DIR (direction) to spin forward and reverse with adjustable speed.
- Time: 15 to 25 minutes
- Skill level: Beginner
- What you will build: A stepper motor demo that spins forward, reverses, and lets you control speed by changing pulse timing
Important: Do not power the stepper motor from the Arduino 5V pin. The motor needs its own supply (commonly 12V) connected to the A4988 VMOT and GND.
Parts List
From ShillehTek
- ShillehTek Original A4988 Stepper Motor Driver with Heatsink - the stepper driver module used to control the motor with STEP/DIR signals
- ShillehTek jumper wires - for connecting Arduino pins to the A4988 and motor power
- ShillehTek breadboard (optional) - helps with temporary wiring and prototyping
External
- Stepper motor (e.g. NEMA 17) - the motor you will spin forward and reverse
- Arduino Uno (or compatible) - generates STEP/DIR signals
- 12V power supply for the stepper motor - powers VMOT on the A4988
- Small screwdriver (for current limit adjustment) - used to set the driver current limit
Note: Never unplug the stepper motor while the A4988 is powered. Use a separate motor supply on VMOT/GND (often 12V), and start with a low current limit before increasing.
Step-by-Step Guide
Step 1 - Review the A4988 pins you will use
Goal: Understand the minimum pins needed for a basic Arduino STEP/DIR demo.
What to do: For this build, you mainly need STEP, DIR, VDD, GND, VMOT, and the stepper motor’s 4 coil wires.
- STEP: Each pulse moves the motor one step (or microstep).
- DIR: Sets rotation direction.
- EN (Enable): Optional pin to enable or disable the driver.
- MS1/MS2/MS3: Optional pins to set microstepping for smoother motion.
- VMOT / GND: Motor power input (like 12V).
- 2A/2B/1A/1B: Outputs that connect to the stepper motor coil wires.
Expected result: You know which connections are required before wiring.
Step 2 - Wire the Arduino to the A4988 and connect motor power
Goal: Make the logic and power connections between the Arduino, A4988, and the external motor supply.
What to do: Use the wiring table below for an Arduino Uno. Connect the stepper motor’s four wires to 1A, 1B, 2A, 2B as two coil pairs.
Wiring table (Arduino Uno + A4988):
- Arduino 5V → A4988 VDD (logic power)
- Arduino GND → A4988 GND (logic ground)
- Arduino D3 → A4988 STEP
- Arduino D4 → A4988 DIR
- Optional: Tie A4988 RESET to SLEEP (keeps the driver awake)
- 12V + → A4988 VMOT
- 12V - → A4988 GND (VMOT side)
- Stepper motor wires → 1A, 1B, 2A, 2B (two coil pairs)
Tip: If the motor only buzzes or vibrates, your coil wires are likely mixed. Find the two coil pairs using a multimeter (wires in the same coil show continuity).
Expected result: The driver has Arduino logic power, external motor power on VMOT, and the motor is connected to the output pins.
Step 3 - Follow critical safety checks before powering on
Goal: Avoid common mistakes that can damage the A4988 or motor.
What to do:
- Do not unplug the stepper motor while powered. It can instantly damage the driver.
- Use a real motor power supply connected to VMOT and GND.
- Start with a low current limit and increase slowly if the motor skips.
- The heatsink helps, but airflow matters for long runs.
Expected result: Your setup is safe to power and test.
Step 4 - Upload the Arduino sketch and run the forward/reverse demo
Goal: Send STEP pulses to spin the motor, pause, then reverse direction.
What to do: Copy the code below into the Arduino IDE and upload it to your Arduino Uno (STEP on D3, DIR on D4).
Code:
// ShillehTek A4988 Stepper Driver Demo
// Arduino Uno: STEP=D3, DIR=D4
const int PIN_STEP = 3;
const int PIN_DIR = 4;
// Lower delay = faster speed. Start slow, then decrease.
int stepDelayMicros = 800;
void stepMotor(int steps) {
for (int i = 0; i < steps; i++) {
digitalWrite(PIN_STEP, HIGH);
delayMicroseconds(2);
digitalWrite(PIN_STEP, LOW);
delayMicroseconds(stepDelayMicros);
}
}
void setup() {
pinMode(PIN_STEP, OUTPUT);
pinMode(PIN_DIR, OUTPUT);
digitalWrite(PIN_DIR, HIGH);
}
void loop() {
// Forward
digitalWrite(PIN_DIR, HIGH);
stepMotor(2000);
delay(500);
// Reverse
digitalWrite(PIN_DIR, LOW);
stepMotor(2000);
delay(500);
}
Speed tip: Try changing stepDelayMicros to 1200 (slower) or 400 (faster). If you go too fast, the motor may stall or skip.
Expected result: The stepper motor spins forward, pauses, then reverses, repeating continuously.
Conclusion
You wired an Arduino Uno to an A4988 stepper motor driver and used STEP and DIR signals to spin a stepper motor forward and reverse, with speed controlled by pulse timing.
Want the exact parts used in this build? Grab them from ShillehTek.com. If you want help customizing this project or building something for your product, check out our IoT consulting services.