How to prevent Arduino from getting fried

I am new to arduino coding.

Following are the hardware that i have:

stepper motor: Nema 17

controller: DRV8825

Capacitor: 100uF

power source: 36V Power Supply 4A

arduino uno : link

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:


For one thing, the stepper motor is rated at 1.25 HP at 12 volts. That would require a hundred amps or there about. Can you really trust the web site?

The other spec shows the motor requires a 2 amp current to work. That is the setting you should use if you trust it.

And how are you powering the Arduino? Show us how you have the wiring, not the example.

1 Like

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.

1 Like

I see.
Yeah i was using the 2 amp reference. Which is why i set the current limiting to 1.5 amp on the driver DRV8825.

To power the arduino, i am just connecting it with the usb cable to my PC.

Uploaded pic

Uploaded few pictures. Sorry the wiring is messy.

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.

1 Like

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.

2 Likes

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.

4 Likes

I don't know about the shipping charges but that driver is cheaper on the stepperonline website.

Thanks.

Currently i have a adapter : Amazon.com : ALITOVE 36V Power Supply 4A 144W AC/DC Adapter 100~240V AC to DC 36 Volt 4 Amp Converter 36 vdc 4A 3.5A 3A 2A Transformer with 5.5mmx 2.5mm Plug for LED Lights Printer Laser Engraver : Electronics power source.

Should i order Switching Power Supply like this one? https://www.omc-stepperonline.com/50w-triple-output-5v-3a-12v-1a-24v-1a-switching-power-supply-stepper-motor-cnc-router-kits-t-50d

Please suggest what is the safe way to power the stepper motor.

I will use dm542Te for the driver instead as recommended by Jim.
Hopefully i dont burn the arduino again.

The 36V 4A adaptor you have is fine.
You can cut the 2.5 mm plug off and strip the wies or usesomething like this to connect to the DM542

You may find something cheaper