Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino-Controlled Dual Stepper Motor Driver with DRV8825

View and Edit Project In Cirkit DesignerImage of Arduino-Controlled Dual Stepper Motor Driver with DRV8825

Circuit Documentation

Summary

This circuit is designed to control two stepper motors using DRV8825 stepper motor drivers, which are interfaced with an Arduino UNO microcontroller. The circuit includes a power supply unit that provides the necessary voltage to the drivers and motors. An electrolytic capacitor is used to stabilize the power supply to the drivers. The Arduino UNO is programmed to rotate the stepper motors in a specific pattern, with one revolution forward followed by two revolutions backward.

Component List

Arduino UNO

DRV 8825

Nema 17 42-STH48 Stepper Motor

Electrolytic Capacitor

POWER SUPPLY 12V 5AMP

240v Power Source

Wiring Details

Arduino UNO

DRV 8825 (First and Second Drivers)

Nema 17 42-STH48 Stepper Motor (First and Second Motors)

Electrolytic Capacitor

POWER SUPPLY 12V 5AMP

Documented Code

/*
 * This Arduino Sketch controls a stepper motor using a DRV8825 driver.
 * The motor will rotate 1 revolution forward and then 2 revolutions backward.
 */

#define dirPin 2
#define stepPin 3
#define stepsPerRevolution 200

void setup() {
  pinMode(stepPin, OUTPUT);
  pinMode(dirPin, OUTPUT);
}

void loop() {
  // Rotate 1 revolution forward
  digitalWrite(dirPin, HIGH);
  for (int i = 0; i < stepsPerRevolution; i++) {
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(2000);
    digitalWrite(stepPin, LOW);
    delayMicroseconds(2000);
  }
  delay(1000);

  // Rotate 2 revolutions backward
  digitalWrite(dirPin, LOW);
  for (int i = 0; i < 2 * stepsPerRevolution; i++) {
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(2000);
    digitalWrite(stepPin, LOW);
    delayMicroseconds(2000);
  }
  delay(1000);
}

This code is designed to control a stepper motor using the Arduino UNO and a DRV8825 driver. The dirPin and stepPin are defined and set as outputs. In the loop function, the motor is instructed to rotate one revolution in one direction and then two revolutions in the opposite direction, with a delay between each step to control the speed.