Arduino is connected to PC via usb cable and thats how it is powered.
I set the current limiting on the DRV8825 to be around 1.5 Amp.
Arduino code:
This code is to rotate the motor by 60 degree back and forth:
#include <AccelStepper.h>
// --- Hardware Pins ---
const int dirPin = 2;
const int stepPin = 3;
// --- Physical Setup ---
const int numRollers = 22; // Your N=22 (Rollers)
const float reductionRatio = numRollers - 1; // Ratio is 21:1
const float motorStepsPerRev = 200.0; // Standard NEMA 17
const float microstepping = 1.0; // Set this to 4, 8, 16 etc. if your driver is toggled
// --- Target ---
const float targetOutputDegrees = 60.0;
// Calculate X steps: ((200 * 21) / 360) * 60
long X_steps = ((motorStepsPerRev * microstepping * reductionRatio) / 360.0) * targetOutputDegrees;
AccelStepper stepper(1, stepPin, dirPin);
void setup() {
Serial.begin(9600);
stepper.setMaxSpeed(500); // Steps per second
stepper.setAcceleration(500); // Steps per second^2
Serial.print("Reduction Ratio: ");
Serial.println(reductionRatio);
Serial.print("Steps to move output 60 degrees: ");
Serial.println(X_steps);
// Command the rotation
stepper.move(X_steps);
}
void loop() {
// This must run constantly to process the steps
if (stepper.distanceToGo() != 0) {
stepper.run();
} else {
X_steps = -1* X_steps;
stepper.move(X_steps);
}
}
What happened?
I turned on the power and for 10 seconds the motor rotated randomly. and then i saw smoke from DRV8825. After that obviously the DRV8825 was fried. But arduino uno is no longer detected by my PC. I can see the green light for on and the L orange light flicker when i plug the usb. But arduino IDE no longer detects the port. I think i have fried the board.
My question is what went wrong and how can i prevent this from happening again?
Setup
I am following this guide and had set up circuit to be exactly like this:
Without seeing the actual wiring, it's impossible to know what happened.
Whenever you are considering a project like this, find 3 sources and compare them very carefully. If there are any differences, figure out why and which, if any, are correct. That is also the answer to your second question about happening again.
Why are you using a 36V power supply? The information in the sales page suggests 12 to 24 volts. If I were doing this I'd start with a low voltage, maybe 6V, and slowly increase it while monitoring the performance of the circuit, paying particular attention to the temperature of components.
The coil resistance is shown as 1.4 Ohm, with 36V that would give 25A.
Not with a DRV8825. This is not a simple H-bridge but a current controlling stepper driver. Here I tried to explain the principle how this type of driver work. It's very similar to a buck converter.
There's a warning that you should connect a capacitor 'close to the driver'. As the images show, there are several connector wires between the capacitor and the driver IC. This reduces the protective effect. From the photos, it’s also impossible to tell whether the capacitor is inserted the correct way. Are the connections between the motor and the driver reliable? If there is a poor connection there, it can also damage the driver.
Since you burned out the Driver and Arduino and need to buy new ones, I suggest that you use a driver like this:
You don’t need the extra capacitor, you don’t need a breadboard that can cause problems with high currents and it isolates/protects the Arduino from any high voltages. Since it has screw terminals for all the connections, wiring will be easier.