Stepper Motor With CNC Shield Not Working

Hi,

I have been trying to get a stepper motor with a CNC shield and a DRV8825 motor driver but nothing seems to be working.

I got it working at first but it was buggy and not spinning correctly. Then suddenly it stopped working.

I have done all the troubleshooting I can and everything seems to be okay individually, but in the full setup something is wrong.

I have a CNC Sheild on an Arduino UNO R3, connected to my MacBook and a 12.8V battery. The stepper motor is plugged into the shield with the driver and I am trying to run simple code just to spin the motor.
DRV8825 is set to 0.7V
Sometimes the motor will buzz for half a second when the battery is connected and then quiet and no noise or movement.

Here is a picture of the data sheet for the stepper motor if anyone can see any issues.

This is the code that was working for a very short period of time:

#define X_STEP 2
#define X_DIR  5

void setup() {
  pinMode(X_STEP, OUTPUT);
  pinMode(X_DIR, OUTPUT);
  digitalWrite(X_DIR, HIGH); // start forward
}

void loop() {
  // 20 steps forward slowly
  digitalWrite(X_DIR, HIGH);
  for (int i = 0; i < 20; i++) {
    digitalWrite(X_STEP, HIGH);
    delay(200);   // 200 ms HIGH
    digitalWrite(X_STEP, LOW);
    delay(200);   // 200 ms LOW
  }
  delay(1000); // 1 second pause

  // 20 steps backward slowly
  digitalWrite(X_DIR, LOW);
  for (int i = 0; i < 20; i++) {
    digitalWrite(X_STEP, HIGH);
    delay(200);   // 200 ms HIGH
    digitalWrite(X_STEP, LOW);
    delay(200);   // 200 ms LOW
  }
  delay(1000); // 1 second pause
}

Thanks in advance. Any help would be much appreciated

Turns out both my drivers (DRV8825) were faulty and therefore was not communicating with the motor.

Hi,
I don’t know if the drv8825 has this issue, but some drivers are sensitive for bad powerup sequence, that is activating the IO pins before the motor supply is applied. This will lead to powering the driver from the IO pins and frying internal diode protections and whatnot.

Also, I don’t recommend powering stuff with batteries as they will just deliver very high currents if anything goes wrong. And hooking such a source up to a board usually results in high inrush currents, possibly damaging components.

1 Like

Hello,

First of all yes, as @SA2KNG said it’s not recommended to use battery especially high current one, an adaptor is much more preferable.

The DRV8825 can get really hot even not doing anything if the enable pin is triggered. A good heatsink and a fan for a hot climate region like mine is a highly recommended. Also try to limit the current to around 0.8 to 1 Amps for NEMA 17 stepper and use ampere meter to adjust the current limit, my experience is using the reference voltage for the current limit isn’t that accurate. I use TMC 2208 now as it’s totally silent and can run waay cooler than DRV8825.

And yes, I already killed a lot of DRV8825 from various reasons though mostly was due overheating :grin:

Hopefully this help.

Adhito
YG4SLJ

1 Like

Thanks for the help and I didn’t know that about the battery. I have a few more questions if you could kindly help.

What power supply could you recommend? Is this setup okay?


Where do you guys place the power supply? At a mains plug and run a long cable to the control board? would it be okay to have the control board inside and run a few meters cable to the motors?

Do you power the Raspberry Pi and Arduino with 5V mains power cables?

When dealing with power supplies with output voltages in the 5-24V range, you do not want long cables on the low voltage side due to voltage drop.
I prefer different power supplies for motors and the control logic or rpi’s. If you’re designing a end product you might look in to dc/dc converters to supply the 5V from 12/24V.
Go for a separate supply for the rpi and you’ll save yourself a lot of hassle.

2 Likes