Stepper motor skipping only at specific speed

Short version: Controlling a NEMA 17 stepper motor with a DRV8825, stepper motor skips at a specific speed. Specific speed varies with amperage when changing the pot, and varies when changing to different drivers. How do I fix this?

Long version: My son and I built a CNC pen plotter machine and didn't have great results. We didn't know much about steppers, so it has been a learning experience for both of us. We're using GRBL and ChiliPeppr to control the machine. Didn't think about power requirements, and didn't know how to tune the driver motor, but we got it working anyway. Figured out the power supply was under-powered, upgraded to a 12V 15A unit. Found videos on how to tune the drivers and set them to 500mA with the direct measurement method (ammeter inline with stepper motor). The stepper motors are rated at 1.3A. We also tried 1A. The resulting drawing was okay, but it was clearly skipping. Through a lot of troubleshooting, we fixed a few things in the construction but the issue still exists (but not as much). At this point, when we move the X axis with G1X200F1200, the motor skips a lot. F1000 works fine, F1400 works fine, as well as lower speeds and higher speeds. When we move the Y axis, F2200 is the issue. If we change the amperage, the speed that causes the issue changes, but never goes away. As the motor speeds up and slows down through acceleration, it inevitably crosses the point that skips for a few split seconds here, few split seconds there. What are we doing wrong? How do we solve this?

Additional troubleshooting: I wired up a motor driver to a breadboard and wrote a small script to control the speed through a potentiometer and tested 5 different motors. 4 were of the same make (came off a RepRap 3D printer), 1 was a different motor (purchased separately for troubleshooting). The 4 of the same make have the same issue at the same speed, which happens to be around 120 in my code with this particular driver. The other doesn't have any issue at all, at any speed. As mentioned, if I change the amperage, the speed at which the issue occurs changes, but doesn't go away. Same if I change the driver, the speed at which the issue occurs just changes, doesn't go away.

Thanks for the help, hope the additional info wasn't too long.

As mentioned, we're using this with GRBL, but here's my troubleshooting code in case it's helpful:

#include <AccelStepper.h>

AccelStepper stepper(1 /*motorInterfaceType*/, 3 /*stepPin*/, 2 /*dirPin*/);
int maxSpeed = 2400;
int currentSpeed = 0;
int speedCounter = 0;
int displayCounter = 0;

void setup() {
  Serial.begin(9600);
  delay(2000);
  Serial.println("Starting!");
  
  stepper.setMaxSpeed(maxSpeed);
  pinMode(A0, INPUT);
  setRunSpeed();
}

void loop() {
  if (speedCounter > 20000) {
    setRunSpeed();
    speedCounter = 0;

    if (displayCounter > 10) {
      Serial.print("Speed: ");
      Serial.println(currentSpeed);
      displayCounter = 0;
    }

    displayCounter++;
  }
  
  speedCounter++;
  stepper.runSpeed();
}

int setRunSpeed() {
  currentSpeed = map(analogRead(A0), 0, 1023, 0, maxSpeed);
  stepper.setSpeed(currentSpeed);
}

That can happen when the step rate coincides with or is a (sub)multiple of a mechanical resonance. Microstepping will reduce or eliminate the effect.

Changing the motor mount, adding vibration absorbers, etc. can also affect the motor resonance behavior.

You should have bought a 24volt supply (2Amp/motor).
A higher supply voltage gives you more torque at higher speeds.

I think you should set the driver to the current rating of the motor, and leave it there.
Acceleration/deceleration/microstepping should be used to prevent the motor from loosing steps.
Leo..

That's completely wrong. Speed entirely depends on the stepping rate. Possibly lost steps is happening but when losing a few steps steppers usually lose all steps and stalls.

Yup, I wasn't clear. The specific speed that causes the skipping varies with changes in amperage. For example, at 1A the speed that causes the skipping was F2400, at 500mA, it was F2200. Thanks for letting me clarify that =)

Do you mean the current limit setting? If so, that behavior is expected.

I agree with Wawa that the current limit should be set properly, at just below the rated current limit. Use of a higher voltage supply considerably improves stepper responsiveness.

Thanks for the info everyone! I think I'll try enabling microstepping first. When microstepping is enabled, do I have to send more steps to move the same distance / same speed? For example, if I'm sending 1,000 pulses per second to move 50mm in 5 seconds, with half stepping do I have to send 2,000 pulses for the same movement? (Not real numbers, just giving it a value for the discussion)

Yes, of course. There are plenty of on line tutorials where you can learn the basics of steppers.

1 Like

Yes, thanks again for adding clarity! It makes sense that it's expected behavior. I'm just confused at why it skips/stalls at very specific speeds, somehow related to the current limit setting.

See post #2 and look up "stepper motor resonance behavior".

Wow, yup, that's what we needed to know. Thank you! Learned so much in the first 30 seconds after knowing what to search for!

This page has an explanation of the resonance problem and some recommendations.

1 Like

Absolutely amazing. Thanks so much! Enabling even half stepping completely resolved it.

Bad idea, because coil current depends on motor position/speed. See page14 in the DRV8825 datasheet. Better measure the board's reference voltage.
Pololu has good instructions, but make sure YOUR board has the same sense resistors.
Leo..

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