Interfacing DRV8825 Stepper Motor Driver Module with Arduino

DRV8825 Stepper Motor Driver Features

The DRV8825 module is used to drive a bipolar stepper motor. Only by two pins, you can control the rotation direction and rotation steps of the motor. By each signal sent by the spin step pin, the motor shifts one step. The key features are:

  • This driver has 200 steps per revolution in full step (1.8 degrees per step).
  • Allowable continuous current per phase without cooling: 1.5A
  • Maximum current per 24V for each phase: 2.5A
  • Motor voltage: 8.2 to 45V
  • The minimum allowed pulse width on the STEP pin is 1.9us
  • DRV8825 Protection:
           – Overcurrent protection
           – Temperature protection
           – Low-Voltage protection
           – Error indicator pin

The number of steps that this stepper motor has in a full step is 32 steps.


  • Security cameras
  • Printers
  • Scanners
  • Toy cars
  • Factory automation system
  • robotic
  • Office automation

You can download the datasheet of this module here.

DRV8825 Stepper Motor Driver Pinout

This Module has the following pins:

Power Supply Pins:

  • GND-MOT: Ground Motor power supply
  • VMOT: Motor power supply – 8-35 V
  • GND-LOGIC: Ground Driver power supply

You can use a capacitor to protect the driver from VMOT voltage sparks.

Motor Coil Pins:

  • A1: Pin 1 for motor coil 1
  • A2: Pin 2 for motor coil 1
  • B1: Pin 1 for motor coil 2
  • B2: Pin 2 for motor coil 2

Pins for controlling power states:

  • DIR: Digital signal to control the direction of motor movement
  • STEP: Digital signal to control rotation steps
  • SLP: This signal is used when the motors are not in use – Active-Low
  • RSTReset signal – Active-Low
  • EN: When this signal is activated, the driver outputs are disabled.

Fault detection pin:

  • FAULT: This pin becomes LOW when an error (high current, high temperature) is detected.

This pin is also connected to SLEEP pin. That is, the module is deactivated when detecting an error. You can also restart it by using the RESET pin or reconnecting the motor power supply.

Step resolution Selection Pins:

  • M0: Step resolution pin 1
  • M1: Step resolution pin 2
  • M2: Step resolution pin 3

By changing these 3 pins, you can change the step from full step to step 1/32. The table below shows these changes:

You can see the pinout of this module in the image below.

Required Materials

Hardware Components

Arduino UNO R3 × 1
DRV8825 Stepper Motor Driver × 1
NEMA 17HS1910 1.7A Stepper Motor × 1
Male to Female jumper wire × 1

Software Apps

Arduino IDE

Be careful to interface this motor by DRV8825 driver, you need a power supply (adapter, battery, etc.) higher than 8V. The power supply is not listed above. Prepare one yourself.

Interfacing DRV8825 Stepper Motor Driver with Arduino

Step 1: Circuit

The following circuit show how you should connect Arduino to DRV8825 module. Connect wires accordingly.


The SLP and RST pins are connected.

Step 2: Current Limit

Follow the simple steps here to calculate the current limit:

  1. Refer to the step motor datasheet and see the allowable current of each phase.
  2. Set the driver in full step mode. (3 Step resolution pins should be without connection)
  3. Connect STEP and DIR to the micro VCC.
  4. Calculate the Vref according to the picture using a potentiometer.
  5. calculate the current limit according to the following formula.
        Current Limit = Vref * 2

Step 3: Code

Upload the following code to your Arduino.

  DRV8825-Stepper-Motor-Driver Module
  modified on 1 Dec 2020
  by Amir Mohammad Shojaee @ Electropeak
based on */ const int dirPin = 2; const int stepPin = 3; const int stepsPerRevolution = 200; void setup() { // Declare pins as Outputs pinMode(stepPin, OUTPUT); pinMode(dirPin, OUTPUT); } void loop() { // Set motor direction clockwise digitalWrite(dirPin, HIGH); // Spin motor slowly for(int x = 0; x < stepsPerRevolution; x++) { digitalWrite(stepPin, HIGH); delayMicroseconds(2000); digitalWrite(stepPin, LOW); delayMicroseconds(2000); } delay(1000); // Wait a second // Set motor direction counterclockwise digitalWrite(dirPin, LOW); // Spin motor quickly for(int x = 0; x < stepsPerRevolution; x++) { digitalWrite(stepPin, HIGH); delayMicroseconds(1000); digitalWrite(stepPin, LOW); delayMicroseconds(1000); } delay(1000); // Wait a second }

First, we define pins 2 and 3 as STEP and DIR pins. Then, with a simple code using “for” loop, motor rotates clockwise and counter-clockwise one round. But the motor rotates fast for one round and slowly for the next round. You can adjust the rotation speed by the delay command.

Liked What You See?​
Get Updates And Learn From The Best​

Leave a Reply

Your email address will not be published. Required fields are marked *