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.
5V
connected to DRV 8825 RST and SLP pinsGND
connected to DRV 8825 GND LOGIC pinsD5
connected to DRV 8825 STEP pin (first driver)D4
connected to DRV 8825 DIR pin (first driver)D3
connected to DRV 8825 STEP pin (second driver)D2
connected to DRV 8825 DIR pin (second driver)VMOT
connected to the positive output of the power supply through an electrolytic capacitorGND MOTOR
connected to the ground of the power supply through an electrolytic capacitorRST
and SLP
connected to the 5V output of the Arduino UNOGND LOGIC
connected to the GND pin of the Arduino UNOA1
, A2
, B1
, B2
connected to the corresponding pins of the Nema 17 stepper motorsA1 Green
, A2 (black)
, B1 Blue
, B2 Red
connected to the corresponding pins of the DRV 8825 drivers+
connected to the 12V-24V output of the power supply-
connected to the ground of the power supply220V Positive Pole (AC)
connected to the live wire of the 240v power source220V Negative Pole (AC)
connected to the neutral wire of the 240v power sourceGND (DC)
and 12V-24V Output (DC)
provide power to the DRV 8825 drivers and the electrolytic capacitor/*
* 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.