Stepper motor controling

Hi, as per your advice, I purchased a DRV8825 driver and connected it to a motor with a 220 UF capacitor in full-step - mode, When I operate the motor by toggling the STEP pin on and off, it works properly. However, when using library functions such as AccelerateStepper, even for the simplest commands, it simply vibrates and does not rotate. I'm attaching a video of the motor's response to the following code

#include <AccelStepper.h>
#define pul1 2
#define dir1 3
AccelStepper stepper1(1,pul1,dir1);
void setup() {
  // Set the speed of the motor
  stepper1.setMaxSpeed(200);  // Adjust this value as needed
    stepper1.setAcceleration(100);
}
void loop() {
stepper1.runToNewPosition(0);
stepper1.runToNewPosition(200);
stepper1.runToNewPosition(100);
}

Connecting Scheme:

The motor's response to the code above:

So, did you start with a very slow speed, and increase it until the motor failed to perform as expected?

it still gets stuck also for acceleration value of 10 and maxspeed of 40 . i am adding that the motor is NEMA17 type.

Is your motor supply GND connected to your Arduino GND?

Please show the sketch that works with exactly the same wiring.
The wiring in your picture doesn't fit to your sketch. We need a schematic how exactly YOUR project is wired.

Using D0 or D1 is a bad choice as the are used for downloading code and they are valuable for debugging.

I hope the following picture explains the connection scheme well.

no..do i need to do this ?

Yes, although looking at your diagram, it might be done implicitly through the two GND connections to the motor driver. I would do it externally, regardless.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.