ESP8266/IoT B.Tech/Diploma Beginner

How to Control Stepper Motor with DRV8825 Driver & ESP8266

Control NEMA17 Stepper Motor with DRV8825 Driver & ESP8266 WiFi using dir, step pin for speed direction control with AccelStepper Library

  • Suitable forB.Tech/Diploma ESP8266/IoT students
  • Build time1-2 weeks
  • LevelBeginner
  • Available atAjvika Labs, Kakinada

About this project

Overview
In the world of 3D printing and robots, the NEMA17 motor is loved for its small size and big power. To make it work at its best, we need to know how to control it. This piece is about controlling NEMA17 with the DRV8825 driver and ESP8266.
The DRV8825 driver is a handy tool that helps the NEMA17 motor work in different ways. It’s more powerful than the
A4988 driver
and is good for bigger projects. The ESP8266 is a WiFi module that lets you control the motor from far away. Together, they make controlling the NEMA17 motor easy and flexible.
This guide will show you how to connect these parts with the NEMA17 motor. It includes basic info, wiring, and coding. By following this guide, you’ll be ready to use these parts in various projects, like robots, 3D printing, and anything else that needs precise motor control.
Bill of Materials
You need the following components to follow along with this tutorial. You can easily purchase all of these components from Amazon. We’ve also provided the purchase links for your convenience.
S.N.
Components Name
Quantity
Purchase Links

NodeMCU ESP8266 Board

Amazon
AliExpress

DRV8825 Stepper Motor Driver

Amazon
AliExpress

NEMA17 Stepper Motor

Amazon
AliExpress

Capacitor 100uF

Amazon
AliExpress

7805 Voltage Regulator IC

Amazon
AliExpress

12V, 2A Power Supply

Amazon
AliExpress

Connecting Wires

Amazon
AliExpress

Breadboard

Amazon
AliExpress
DRV8825 Stepper Motor Driver Module
The DRV8825 is a complete Microstepping Motor Driver with a built-in translator for easy operation. The breakout board from Texas Instruments features adjustable current limiting, over-current and over-temperature protection, and six different microstep resolutions.
It operates from 8.2 V to 45 V and can deliver up to approximately 1.5 A Current per phase without a heat sink or forced airflow. It is rated for 2.2 A Current per coil with sufficient additional cooling.
Additionally, the DRV8825 is compatible with many popular microcontrollers, such as the Arduino, ESP8266, ESP32, making it easy to integrate into your existing projects. With its robust features and powerful performance, the DRV8825 stepper motor driver is an excellent tool for controlling your NEMA17 or other bipolar stepper motors.
Features
Max. Operating Voltage: 45V
Min. Operating Voltage: 8.2V
Max. Current Per Phase: 2.5A
Microstep resolution: Full step, 1/2 step, 1/4 step, 1/8 step, 1/16 step 1/32 step
Over temperature shutdown circuit
Under-voltage lock out
Over current shutdown
Dimensions: 20.5 x 15.5 mm (0.8″ × 0.6″)
Short-to-ground and shorted-load protection
Low RDS(ON) outputs
DRV8825 Motor Driver Pinout
The DRV8825 driver has total of 16 pins which are as follows:
1. Power Supply Pins:
The pin includes VMOT, GND MOT & GND Logic. The DRV8825 module does not have any logic supply pin as it gets its power from the internal 3V3 voltage regulator. The VMOT supplies power for the motor which may be 8.2V to 45 V.
2. Microstep Selection Pins:
The DRV8825 driver has three-step resolution selector inputs, i.e., M0, M1 & M2. By setting appropriate logic levels to those pins we will set the motors to at least one of the six-step resolutions.
3. Control Input Pins:
STEP & DIR are the 2 control input pins. STEP input controls the micro-steps of the motor. The faster the pulses, the faster the motor will rotate. The DIR input controls the spinning direction of the motor. Pulling it HIGH drives the motor clockwise and pulling it LOW drives the motor anti-clockwise
4. Power States Control Pin:
The DRV8825 has three different inputs for controlling its power states, i.e EN, RST, and SLP. The EN pin is always active low input by default which enables the driver. SLP Pin is active low input. Pulling this pin LOW puts the driver in sleep mode, minimizing the facility consumption. The RST is a lively low input which when pulled LOW, all STEP inputs are ignored. It also resets the driver by setting the internal translator to a motor initial stage.
5. Output Pins:
There are 4 output pins as B2, B1, A2, A1. We can connect any bipolar stepper motor having voltages between 8.2V to 45 V to those pins. Each output pin on the module can deliver up to 2.2A to the motor
6. Fault Detection Pin:
The DRV8825 features a FAULT output that drives LOW whenever the H-bridge FETs are disabled due to over-current protection or thermal shutdown. The Fault pin is shorted to the SLEEP pin & when it is driven LOW, the whole chip is disabled.
Heat Sink Requirement
It is safe to use the DRV8825 Driver without a heat sink if the current rating is up to 1.5A. For achieving more than 1.5A per coil, i.e. 2.2A, a heat sink or other cooling method is required.
Because of the excessive power dissipation of the DRV8825 driver, there is a rise in temperature that can go beyond the capacity of IC, probably damaging it.
Setting Up Current Limit
Before we connect the motor we should adjust the current limiting of the driver so that the current is within the limit of the motor. We can do that by adjusting the reference voltage using the potentiometer on the board and considering this equation below.

Current
Limit
=
VRef

For example, if the Stepper Motor is rated for 350mA, we need to adjust the reference voltage to 0.17V. Take a small screwdriver and adjust the current limit with a potentiometer until you reach the rated current.
NEMA17 Stepper Motor
NEMA 17 is a hybrid stepping motor with a 1.8° step angle (200 steps/revolution). The term “NEMA 17” refers to the National Electrical Manufacturers Association’s specification for stepper motors. Specifically, the ’17’ refers to the faceplate dimensions of the motor, which in this case is approximately 1.7 inches by 1.7 inches. Check out
Stepper Motor Calculator
to calculate various stepper motor parameters.
NEMA 17 stepper motors are widely used in devices like 3D printers, CNC machines, and small robotic applications due to their compact size, good torque, and precise control. Note that to properly control a stepper motor, you’ll usually need a stepper motor driver, which can precisely control the current in the motor windings to move the rotor in precise “steps.”
NEMA 17 stepper motors typically have four wires, each connected to one end of two separate coils inside the motor. These four wires are often color-coded to help identify them. The color coding is not standardized across all manufacturers, but a common scheme is:
Black and Green wires:
often correspond to one coil, which can be referred to as Coil A or Phase 1.
Red and Blue wires:
often correspond to the other coil, which can be referred to as Coil B or Phase 2.
Interfacing NEMA17 Stepper Motor with ESP8266 using DRV8825
To control a NEMA17 stepper motor using the DRV8825 stepper motor driver and the NodeMCU ESP8266 board, the connections are very simple. We can use the D3 and D4 pins on the NodeMCU ESP8266 Board to control the motor direction and stepping. The complete wiring diagram is provided below.
For power, connect the VMOT pin on the DRV8825 driver to a 12V power supply, and the SLP & RES pin to a 5V supply. It’s important to install a 100µF decoupling electrolytic capacitor across the motor power supply pins near the board to stabilize the power supply and reduce noise. Additionally, a 10µF electrolytic capacitor should be installed at the 5V supply pin for further stabilization.
The NEMA17 stepper motor is then connected to the DRV8825 driver using the four available motor pins as shown in circuit above.
Basic Stepper Motor Control Code
Now that you’ve connected the wires to the DRV8825 Stepper Motor driver and adjusted the current limit, it’s time to link the NodeMCU ESP8266 Board to your computer and load some code. The code we’re going to use will control the motor to move in one direction.

Technologies used

ESP32ESP8266ArduinoWiFiBLEStepperSPI

Hardware components

  • ESP32
  • ESP8266
  • Arduino
  • Motor Driver
  • Stepper Motor

Software & tools

  • Arduino IDE

What you get

  • Working project / hardware kit, tested before delivery
  • Complete source code with explanation
  • Project demo and guidance for your viva
  • Project report, PPT and IEEE paper support (on request)
Delivery & Payment
Delivery takes a minimum of two weeks from the date your inquiry is confirmed. Payment is in two parts: • 50% advance to start the project • Remaining 50% before delivery Note: • Documentation and PPT are not included by default • If you need documentation/PPT, it can be arranged for extra time and cost We'll confirm the exact timeline and cost with you after reviewing your requirements.