If your project needs precise positioning, stepper motors are often the first practical choice. Typical NEMA 17 and NEMA 23 motors can deliver reliable repeatability, but they need controlled phase current that an Arduino pin cannot provide directly.
DRV8825 is a compact and affordable driver that handles current regulation and microstepping internally. This guide focuses on practical bring-up: safe wiring, current-limit setup, and working code patterns for one and two motors.
[PHOTO PLACEHOLDER: DRV8825 module top view with trimmer and pin labels]
DRV8825 Overview
The DRV8825 from Texas Instruments is a bipolar stepper driver with an internal translator. In practice, motion control can be reduced to two control lines:
- STEP: pulse input for each step or microstep
- DIR: direction select
This architecture removes the need to generate full coil commutation in firmware and helps keep timing stable.
Typical Electrical Specs
| Parameter | Typical Range / Value |
|---|---|
| Motor supply (VMOT) | 8.2V to 45V |
| Logic levels | 3.3V/5V compatible control inputs |
| Continuous current (practical) | about 1.2A to 1.5A per phase with typical cooling |
| Peak current (chip-level, thermal dependent) | up to 2.5A per phase |
| Microstepping modes | full, 1/2, 1/4, 1/8, 1/16, 1/32 |
Protections include undervoltage lockout, overcurrent protection, thermal shutdown, and short-circuit handling.
Datasheet: Texas Instruments DRV8825 Datasheet
Pin Groups and Behavior
[SKETCH PLACEHOLDER: DRV8825 pinout with VMOT, GND, STEP, DIR, M0-M2, EN, RST, SLP, FAULT, A1/A2/B1/B2]
Power Pins
- VMOT / GND: motor supply and power ground
Many modules use low-ESR ceramics, so place an electrolytic capacitor of at least 47uF directly near VMOT/GND. This reduces destructive LC spikes on supply wiring.
Control Pins
- STEP: step pulse input
- DIR: direction input
STEP and DIR should always be driven to defined levels. Avoid floating control inputs.
Microstep Pins (M0, M1, M2)
Internal pull-down resistors default these pins to LOW, so disconnected pins use full-step mode.
| M0 | M1 | M2 | Resolution |
|---|---|---|---|
| LOW | LOW | LOW | Full step |
| HIGH | LOW | LOW | Half step |
| LOW | HIGH | LOW | Quarter step |
| HIGH | HIGH | LOW | Eighth step |
| LOW | LOW | HIGH | Sixteenth step |
| HIGH | LOW/HIGH | HIGH | Thirty-second step |
Power-State and Fault Pins
- EN: active-low enable, typically LOW by default on many boards
- SLP: active-low sleep; must be HIGH for normal operation
- RST: active-low reset; keep HIGH during normal operation
- FAULT: LOW on fault (for example overcurrent or thermal events)
After SLP returns HIGH, wait at least 1.7ms before issuing STEP pulses. FAULT is active-low and open-drain, so a standalone connection to a microcontroller requires a pull-up unless the carrier already provides one.
Orientation warning: do not use the trimmer location as orientation reference. Always align by printed pin labels, especially EN and VMOT/GND positions.
Motor Outputs
- A1, A2: coil A
- B1, B2: coil B
Wiring DRV8825 to Arduino
Recommended Baseline Mapping
| DRV8825 | Arduino UNO | Purpose |
|---|---|---|
| STEP | D3 | Step pulses |
| DIR | D2 | Direction control |
| RST | 5V | Keep HIGH during operation |
| SLP | 5V | Keep HIGH during operation |
| GND | GND | Common ground with Arduino |
Connect VMOT/GND to an external motor supply. Always share ground between supply and Arduino logic side.
Never connect or disconnect a stepper motor while VMOT is energized. Power down the motor supply before changing winding connections, unplugging the motor, or inserting/removing a carrier. An interrupted energized winding can create a transient large enough to destroy the driver.
[SKETCH PLACEHOLDER: full DRV8825 wiring with 47uF capacitor near VMOT]
Identify Coil Pairs First
- Use continuity mode and find the two wire pairs.
- Or short one pair and feel the shaft become harder to rotate.
- Connect one pair to A1/A2 and the other to B1/B2.
STEP and DIR Timing
Keep each DRV8825 STEP pulse HIGH for at least 1.9us and LOW for at least 1.9us. DIR must be stable at least 650ns before the rising STEP edge and remain stable for at least 650ns afterward. The direct-pulse example below exceeds these limits by a wide margin; high-rate timer code must enforce them explicitly.
Bring-Up Safety
- Start with full-step and reduced speed.
- Use 10-20% current headroom below motor nameplate current.
- Increase current and speed in small steps while checking temperature.
Cooling and Thermal Limits
Reaching 2.5A per phase continuously is unrealistic without strong thermal management. For many compact modules, heatsink plus airflow becomes essential above about 1.5A.
- Install the heatsink before high-current testing.
- Avoid heatsink contact with adjacent conductive pins.
- Stress-test for at least 10-15 minutes at expected duty.
[PHOTO PLACEHOLDER: DRV8825 with heatsink and airflow direction]
Current Limit Setup
Phase Current Is Not Supply Current
A stepper motor's current rating applies to each winding. The DRV8825 chops a higher VMOT supply into regulated winding current, so supply input current is not equal to either phase current and may be considerably lower. Set the current limit from the motor's rated phase current, never from an ammeter placed at the power-supply input. The winding's nameplate voltage is not the VMOT limit when current regulation is configured correctly.
A higher supply voltage can improve high-speed behavior, but only if coil current is limited correctly. Without proper limit configuration, the motor and driver overheat rapidly.
A motor that only pulses, stalls, or moves erratically may have an incorrectly adjusted current limit. If reducing the trimmer setting improves the behavior, stop testing and set Vref deliberately. Also verify the coil pairs, supply capacity, and STEP timing, because each of those faults can produce similar symptoms.
Method 1: Measure Coil Current in Full-Step Hold
- Read rated phase current from your motor datasheet.
- Set M0/M1/M2 to full-step.
- With VMOT switched off, insert the ammeter in series with one winding. Then energize the driver and hold the motor at a fixed full step.
- Adjust the trimmer until the measured hold current reaches approximately 70.7% of the intended current limit.
In full-step mode the DRV8825 regulates both energized windings to approximately 0.707 × I_limit. A desired 1.0A current limit therefore reads about 0.707A in either winding during a full-step hold. Setting that reading directly to 1.0A would raise the configured current limit to about 1.41A. After switching to the final microstep mode, verify thermal behavior and reduce the limit if needed.
Method 2: Set Vref Directly (Most Practical)
For the DRV8825, the full-scale current limit depends on both the trimmer reference voltage and the carrier's current-sense resistor:
I_limit = Vref / (5 × R_s), or solved for the trimmer target: Vref = 5 × R_s × I_limit
With the common R_s = 0.10 ohm, this simplifies to I_limit = 2 × Vref, or Vref = I_limit / 2. For example, a 1.4A limit then requires 0.70V. A carrier using 0.05 ohm resistors would require only 0.35V for the same current limit.
Read the resistor marking or the carrier documentation before calculating Vref; do not infer the value from the board color or trimmer position.
The often quoted shortcut Vref = I_limit / 2 applies only when R_s = 0.10 ohm. It is not valid for every DRV8825 carrier and must not be reused for A4988, TMC2208, or TMC2209 modules. Trinamic drivers may also set current through UART, so their potentiometer formula depends on the specific carrier and operating mode.
[PHOTO PLACEHOLDER: top-down close-up of the DRV8825 trimmer potentiometer with the GND test pad labeled, showing exactly where to place the two multimeter probes]
Adjusting the motor current on a DRV8825 always follows the same three steps:
- Look up the motor's maximum rated phase current in its datasheet.
- Disconnect the motor. Unlike an A4988 carrier with a separate VDD pin, the usual DRV8825 carrier derives its internal logic supply from VMOT, so VMOT must be powered for a valid Vref reading. Keep the local VMOT capacitor installed and observe normal high-voltage precautions.
- Set the multimeter to DC volts, secure its black probe to GND, and touch the red probe to the trimmer wiper. Turn the trimmer slowly with a ceramic or otherwise insulated tool until Vref reaches the calculated target. Avoid adjacent components and verify the direction of change on the meter instead of assuming clockwise always increases Vref.
- Connect the stepper motor and verify smooth, quiet operation while monitoring driver temperature.
Driver Vref Calculator
Enter motor phase current and safety margin. The calculator applies the margin first, then computes reference voltages for common driver formulas.
- Effective current after margin: 0.850 A
- Used factor: 0.500 (factor = 5 * R_s)
- DRV8825 Vref: 0.425 V (Vref = I * factor)
NEMA 17 Quick-Start Profile
| Parameter | Recommended Start Value |
|---|---|
| Supply voltage (VMOT) | 12V |
| Microstep mode | Full-step for bring-up, then 1/16 or 1/32 when smoothness is needed |
| Target phase current | 1.0A initial target for thermal margin |
| DRV8825 Vref (initial) | 0.50V (from Vref = I / 2) |
| Pulse timing baseline | 1200us to 2000us HIGH/LOW spacing |
Arduino Example 1: Direct Pulses (No Library)
// DRV8825 + Arduino UNO basic pulse demo
const int dirPin = 2;
const int stepPin = 3;
const int stepsPerRevolution = 200;
void setup() {
pinMode(stepPin, OUTPUT);
pinMode(dirPin, OUTPUT);
}
void singleTurn(bool cw, int pulseDelayUs) {
digitalWrite(dirPin, cw ? HIGH : LOW);
for (int i = 0; i < stepsPerRevolution; ++i) {
digitalWrite(stepPin, HIGH);
delayMicroseconds(pulseDelayUs);
digitalWrite(stepPin, LOW);
delayMicroseconds(pulseDelayUs);
}
}
void loop() {
singleTurn(true, 1800);
delay(800);
singleTurn(false, 1000);
delay(800);
} Speed is set by pulse timing. If the motor skips, lower speed first, then reduce acceleration demands.
Arduino Example 2: AccelStepper for Smooth Motion
- Open Arduino IDE and start Library Manager.
- Install AccelStepper by Mike McCauley.
- Restart IDE if your environment requires it.
#include <AccelStepper.h>
const int dirPin = 2;
const int stepPin = 3;
const int motorInterfaceType = 1;
AccelStepper stepper(motorInterfaceType, stepPin, dirPin);
void setup() {
stepper.setMaxSpeed(1200);
stepper.setAcceleration(120);
stepper.moveTo(400);
}
void loop() {
if (stepper.distanceToGo() == 0) {
stepper.moveTo(-stepper.currentPosition());
}
stepper.run();
} Keep run() in the main loop continuously. Missing calls stop stepping.
Arduino Example 3: Two DRV8825 Drivers
For dual-axis or synchronized systems, use one driver per motor and separate STEP/DIR pin pairs.
#include <AccelStepper.h>
const int motorInterfaceType = 1;
AccelStepper stepper1(motorInterfaceType, 3, 2);
AccelStepper stepper2(motorInterfaceType, 5, 4);
void setup() {
stepper1.setMaxSpeed(1000);
stepper1.setAcceleration(80);
stepper1.moveTo(320);
stepper2.setMaxSpeed(1000);
stepper2.setAcceleration(80);
stepper2.moveTo(-320);
}
void loop() {
if (stepper1.distanceToGo() == 0) {
stepper1.moveTo(-stepper1.currentPosition());
}
if (stepper2.distanceToGo() == 0) {
stepper2.moveTo(-stepper2.currentPosition());
}
stepper1.run();
stepper2.run();
} [SKETCH PLACEHOLDER: dual DRV8825 wiring with independent STEP/DIR lines]
Troubleshooting Checklist
- Motor vibrates only: coil pairs mixed; re-check continuity pairs.
- No movement: SLP or RST not held HIGH, or no shared GND.
- Driver too hot: current limit too high or insufficient cooling.
- Unexpected resets: supply dips or missing bulk capacitor near VMOT.
- Direction mismatch: swap DIR logic or swap one coil pair on outputs.