Stepper motor behaving strange at certain speeds...

Hey!

I am using an A4988 board to drive a Nema17 stepper motor with an ArduinoUno.
At the moment I am using both the Polulu4988 Library as well as the AccelStepper library.

Whilst trying out the motor at different speeds I encountered a strange behaviour, at one particular speed or small range of speeds.
The motor does not run in a continuous forward motion anymore but starts moving jerky as if the motor was changing directions very quickly.

It happens in the lower third of it’s speed range i guess but the slowest speeds work fine.

Here is the code I was using recently

#include <AH_Pololu.h>
#include <AccelStepper.h>


//AH_Pololu(int RES, int DIR, int STEP, int MS1, int MS2, int MS3, int SLEEP, int ENABLE, int RESET);
AH_Pololu stepper(200,4,3,7,8,12,9,5,10);   // init with all functions

AccelStepper stepperAcc(AccelStepper::DRIVER, 3, 4); //DriverBoard-Mode, Step-Pin, Dir-Pin


void setup() {
  stepper.resetDriver();                  // reset driver
  stepper.disableDriver();                // enable driver 
  stepper.enableDriver();               // enable driver 
  stepper.setMicrostepping(0);            // 0 -> Full Step                                
                                          // 1 -> 1/2 microstepping
                                          // 2 -> 1/4 microstepping
                                          // 3 -> 1/8 microstepping
                                          // 4 -> 1/16 microstepping

  stepperAcc.setMaxSpeed(200.0);
  stepperAcc.setAcceleration(50.0);                                    
  

  stepper.sleepOFF();                     // set Sleep mode OFF
}

void loop() {
    stepperAcc.runToNewPosition(500);
}

Stepping motors have a resonant frequency, and if you step at that frequency, unusual actions might occur.

Oh then I will have to do some research on how to avoid hitting that frequency I guess.

The motor needs to be able to do smooth ramping because it is supposed to be used for a camera slider and smooth movement is the whole purpose of it.

Microstepping is used for smooth motion, and helps to reduce resonance effects. The A4988 can microstep, but you have disabled it.

Note that the behavior of a motor sitting on your desktop will be VERY different from one mounted in some sort of assembly and possibly geared down.

jremington:
Microstepping is used for smooth motion, and helps to reduce resonance effects. The A4988 can microstep, but you have disabled it.

Ok with every other setting except of full step it works flawlessly,
Thank you very much!

“Midband resonance” is a relevant search term here. Note an unloaded motor is the most likely to suffer
from resonance effects.