Stepper Motors dont behave like they should

Hello,
Im currently working on a scara like robot. For that I use nema 17 stepper motors(stepper), an arduino, a cnc shield and DRV8825 motor drivers. I have to use 1/32 microstepping, because if I dont they "vibrate" to much. For my understanding if I use 1/32 microstepping one full revolution should be 3200 steps, because 200 steps * 16 = 3200. But first of all the motor is very slow even if I multiply the speed by 16. I would expect this code to do one full revolution and then stop but I dont get a full one maybe a 60% one. Am I doing something wrong?

#include <AccelStepper.h>
AccelStepper stepper(1, 2, 5);

void setup(){
  stepper.setMaxSpeed(16000); //default value 1000 (bounce example)
  stepper.setSpeed(320); //default 20 (bounce example)
  stepper.setCurrentPosition(0);
  stepper.move(3600);
}

void loop(){
  stepper.run();
}

AccelStepper on an Uno R3 is limited to about 4000 steps per second.
Leo..

Alternatively, 200 steps per revolution *32 microsteps per step = 6400 microsteps/revolution

Oh yes of course I have to multipy everything by 32 instead of 16 :man_facepalming:. But still I get not a 360° rotation I get idk maybe 365°. Why could that be?

What current did you set the DRV8825 to, and is your supply 12volt minimum with a minimum current rating of 1.5x the set current.
Leo..

The motor won't work properly if you don't set the motor driver current limit correctly, load the motor too heavily and/or drive it too rapidly.

I set the driver to 0.5V and I use a lab bench power supply. I set it to 12V and 1A.

What do you think that means?

I set the VREF of the driver to 0.5V.

And what do you think that means? The current limit depends on the sense resistor value.

This might help, since different motor driver boards use different current sense resistors:
https://www.circuitist.com/how-to-set-driver-current-a4988-drv8825-tmc2208-tmc2209/

Also, the stepper has two coils, so if you set the current limit for 1 A/winding, the motor power supply has to provide more than that. I would choose 2A for safety.

The article states, that the resistor value is irrelevant for the Drv8825. I used the calculator on the website and set the VREF to 0.45V and I set my power supply to 2A but I still get the wrong movement.
By the way I already changed the driver, the cable, the motor and connected the driver directly to the arduino without the shield.

Post the revised code.

my current code:

#include <AccelStepper.h>
AccelStepper stepper(1, 2, 5);

void setup(){
  stepper.setMaxSpeed(32000); //default value 1000 (bounce example)
  stepper.setSpeed(640); //default 20 (bounce example)
  stepper.setAcceleration(1280);
  stepper.setCurrentPosition(0);
  stepper.move(7200);
}

void loop(){
  stepper.run();
}

(expletive deleted) me :man_facepalming: I should go back to grade 3 and lern basic math 32 * 200 = 6400. Im sorry for wasting your time but still thanks for your help

Don't restrict current with the supply. The driver will draw what it needs.
Try a higher voltage too.
Leo..

Please give Solution to the post that helped you the most, to show respect and acknowledge for time and insight spent on helping you.

Also, happy to hear your succes.

That's still totally crap, as already stated in #2 by @Wawa . run() isn't able to accelerate to that speed on an UNO R3.

This doesn't make sense either if you use run(). It's only needed if you use runSpeed().

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