Skip to main content
A4988 Stepper Motor driver, for use with wokwi-stepper-motor.

Pins

ENABLE
input
default:"Low (0)"
Enable pin, active low (pulled down)
MS1
input
default:"Low (0)"
Microstep select pin 1
MS2
input
default:"Low (0)"
Microstep select pin 2
MS3
input
default:"Low (0)"
Microstep select pin 3
RESET
input
Reset pin, active low (floating)
SLEEP
input
default:"High (1)"
Sleep pin, active low (pulled up)
STEP
input
Step input, connect to microcontroller
DIR
input
Direction input: 0=counterclockwise, 1=clockwise
GND
ground
Ground
VDD
power
Logic power supply
1B
output
Connect to motor’s B-
1A
output
Connect to motor’s B+
2A
output
Connect to motor’s A+
2B
output
Connect to motor’s A-
VMOT
power
Motor power supply, not used in the simulation
Digital pins with a default value of Low (0) are pulled-down, and pins with a default value of High (1) are pulled up. Pins without a default value are floating.

Microstepping configuration

Standard stepper motors have 200 steps per revolution (the steps are spaces 1.8 degrees apart). The stepper driver supports microstepping: turning the motor less than one step for every pulse. Microstepping allows finer control of the motor movement. Use the MS1/MS2/MS3 pins to select the microstepping configuration for the stepper driver:
MS1MS2MS3Operation modeDegreesMicrosteps/revolution
000Full step (default)1.8200
100Half step0.9400
0101/4 step*0.45800
1101/8 step*0.2251600
1111/16 step*0.11253200
* These mode are not fully supported by wokwi-stepper-motor. When using these modes, the number of steps per revolution will still be correct, but the motor angle will only update every half step. For instance, if you use 1/8 step mode, the motor will move half a step (0.9 degrees) every four STEP pin pulses.

Using the A4988 Stepper Driver

Connect the stepper motor pins to the 1B/1A/2A/2B pins of the driver. The RESET pin has to be HIGH, so you can connect it to the adjacent SLEEP pin (which is pulled HIGH by default). Alternatively, you can enable/disable the stepper motor driver from your code by connecting the RESET/SLEEP pins to your microcontroller. Use the STEP pin to move the stepper motor. Every HIGH pulse on this pin will move the motor one step (or microstep, depending on the MS1/MS2/MS3 pins). When the DIR pin is HIGH, the stepper motor will move clockwise. When the DIR pin is LOW, the motor will move counterclockwise. For example, if DIR, MS1 and MS3 are LOW, and MS2 is HIGH (1/4 step mode), then pulsing the STEP pin will move the motor 1/4 step (0.45 degrees) counterclockwise.

Simulator Examples

Build docs developers (and LLMs) love