Stepper Motor with A4988 Driver


The A4988 is a micro stepping driver for controlling bipolar stepper motors which has built-in translator for easy operation. This means that we can control the stepper motor with just 2 pins from our controller, or one for controlling the rotation direction and the other for controlling the steps.

The Driver provides five different step resolutions: full-step, haft-step, quarter-step, eight-step and sixteenth-step. Also, it has a potentiometer for adjusting the current output, over-temperature thermal shutdown and crossover-current protection.

Its logic voltage is from 3 to 5.5 V and the maximum current per phase is 2A if good addition cooling is provided or 1A continuous current per phase without heat sink or cooling

A4988 Stepper Driver Pinout

Now let’s close look at the pinout of the driver and hook it up with the stepper motor and the controller. So we will start with the 2 pins on the button right side for powering the driver, the VDD and Ground pins that we need to connect them to a power supply of 3 to 5.5 V and in our case that will be our controller, the Arduino Board which will provide 5 V.  The following 4 pins are for connecting the motor. The 1A and 1B pins will be connected to one coil of the motor and the 2A and 2B pins to the other coil of the motor. For powering the motor we use the next 2 pins, Ground and VMOT that we need to connect them to Power Supply from 8 to 35 V and also we need to use decoupling capacitor with at least 47 µF for protecting the driver board from voltage spikes.

The next two 2 pins, Step and Direction are the pins that we actually use for controlling the motor movements. The Direction pin controls the rotation direction of the motor and we need to connect it to one of the digital pins on our microcontroller, or in our case I will connect it to the pin number 4 of my Arduino Board.

With the Step pin we control the microsites of the motor and with each pulse sent to this pin the motor moves one step. So that means that we don’t need any complex programming, phase sequence tables, frequency control lines and so on, because the built-in translator of the A4988 Driver takes care of everything. Here we also need to mention that these 2 pins are not pulled to any voltage internally, so we should not leave them floating in our program.

Next is the SLEEP Pin and a logic low puts the board in sleep mode for minimizing power consumption when the motor is not in use.

Next, the RESET pin sets the translator to a predefined Home state. This Home state or Home Micro step Position can be seen from these Figures from the A4988 Datasheet. So these are the initial positions from where the motor starts and they are different depending on the micro step resolution. If the input state to this pin is a logic low all the STEP inputs will be ignored. The Reset pin is a floating pin so if we don’t have intention of controlling it with in our program we need to connect it to the SLEEP pin in order to bring it high and enable the board.

The next 3 pins (MS1, MS2 and MS3) are for selecting one of the five step resolutions according to the above truth table. These pins have internal pull-down resistors so if we leave them disconnected, the board will operate in full step mode.

The last one, the ENABLE pin is used for turning on or off the FET outputs. So a logic high will keep the outputs disabled.




Interfacing with Arduino:



/* Simple Stepper Motor Control Exaple Code


* by Dejan Nedelkovski,




// defines pins numbers

const int stepPin = 3;

const int dirPin = 4;


void setup() {

// Sets the two pins as Outputs




void loop() {

digitalWrite(dirPin,HIGH); // Enables the motor to move in a particular direction

// Makes 200 pulses for making one full cycle rotation

for(int x = 0; x < 200; x++) {






delay(1000); // One second delay


digitalWrite(dirPin,LOW); //Changes the rotations direction

// Makes 400 pulses for making two full cycle rotation

for(int x = 0; x < 400; x++) {









  • As the stepper motor are digitally controlled using an input pulse, they are suitable for use with computer controlled systems.
  • They are used in numeric control of machine tools.
  • Used in tape drives, floppy disc drives, printers and electric watches.
  • The stepper motor also use in X-Y plotter and robotics.
  • It has wide application in textile industries and integrated circuit fabrications.