The DRV8825 is a stepper motor driver module designed by Texas Instruments, which allows for precise control of stepper motors in a wide range of applications. It is commonly used in 3D printers, CNC machines, and other automated equipment where precise motor control is required. The module can handle up to 2.5A per phase without a heat sink and operates from 8.2V to 45V, making it suitable for driving a wide range of stepper motors.
Pin Number | Name | Description |
---|---|---|
1 | VM | Motor voltage supply (8.2 V to 45 V) |
2 | GND | Ground connection |
3 | 2B | Motor coil B output 2 |
4 | 2A | Motor coil B output 1 |
5 | 1A | Motor coil A output 1 |
6 | 1B | Motor coil A output 2 |
7 | VDD | Logic voltage supply (2.5 V to 5.25 V) |
8 | FAULT | Fault output (active low) |
9 | SLEEP | Sleep mode input (active low) |
10 | RESET | Reset input (active low) |
11 | STEP | Step input |
12 | DIR | Direction input |
13 | M0 | Microstep selection input 0 |
14 | M1 | Microstep selection input 1 |
15 | M2 | Microstep selection input 2 |
16 | EN | Enable input (active low) |
Q: Can I use the DRV8825 without a microcontroller?
Q: What is the purpose of the microstep settings?
Q: How do I know if the module is in a fault state?
// Define the connections
const int dirPin = 2; // DIR pin connected to digital pin 2
const int stepPin = 3; // STEP pin connected to digital pin 3
const int stepsPerRevolution = 200; // Change this depending on the steps per revolution of your motor
void setup() {
// Set the two pins as Outputs
pinMode(stepPin, OUTPUT);
pinMode(dirPin, OUTPUT);
}
void loop() {
// Set the spinning direction clockwise
digitalWrite(dirPin, HIGH);
// Spin the stepper motor 1 revolution slowly
for (int i = 0; i < stepsPerRevolution; i++) {
// These four lines result in 1 step:
digitalWrite(stepPin, HIGH);
delayMicroseconds(2000);
digitalWrite(stepPin, LOW);
delayMicroseconds(2000);
}
delay(1000); // Wait a second
// Set the spinning direction counterclockwise
digitalWrite(dirPin, LOW);
// Spin the stepper motor 1 revolution quickly
for (int i = 0; i < stepsPerRevolution; i++) {
// These four lines result in 1 step:
digitalWrite(stepPin, HIGH);
delayMicroseconds(1000); // This delay controls the speed
digitalWrite(stepPin, LOW);
delayMicroseconds(1000); // This delay controls the speed
}
delay(1000); // Wait a second
}
This example code will rotate a stepper motor one revolution in each direction. Adjust the delayMicroseconds()
value to control the speed of the motor. Ensure that the DRV8825 is properly connected to the Arduino UNO and that the current limit is set correctly for your motor.