Stepper motor vibrating, but not turning

Hello,

I am trying to use an Arduino Uno to control a closed looper stepper motor via a stepper motor driver, but am just getting vibration from the motor instead of turning. I am using the following setup:

Stepper Motor: https://www.omc-stepperonline.com/stepper-motor-w-encoder/nema-23-closed-loop-stepper-motor-l-56mm-gear-ratio-100-1-high-precision-planetary-gearbox.html

Stepper Driver: https://www.omc-stepperonline.com/download/CL57T_V4.0.pdf

  • I have the rotating switch set to 4 (5.6A peak current, 4A RMS), but I've tried multiple values to no effect
  • My dip switches are set to 1600 pulses/rev, and otherwise all off (but have played around with other combinations here to no effect)

My power supply is 36V/10A.

Here is a picture of my setup:

For arduino code, I've tried using analogWrite for PWM on the PUL pin, and just rapidly setting it to HIGH and LOW with small delays in between. For example:

void setup() {
  pinMode(9,OUTPUT); // set Pin9 as PUL
  pinMode(8,OUTPUT); // set Pin8 as DIR
  digitalWrite(8,HIGH); // set high level direction
}

void loop() {
  analogWrite(9,127);
}

or

void setup() {
  pinMode(9,OUTPUT); // set Pin9 as PUL
  pinMode(8,OUTPUT); // set Pin8 as DIR
}

void loop() {
  digitalWrite(8,HIGH); // set high level direction
  digitalWrite(9,HIGH);
  delayMicroseconds(10);
  digitalWrite(9,LOW);
  delayMicroseconds(10);
}

The faster the modulation (be it PWM or manually writing high and low with lower delay times) leads to faster vibration in the motor and a higher pitches noise from the motor, but still no movement.

Additional notes: I actually got the motor rotating successfully yesterday morning using this same setup and code -- however, I then tried to run it through python using pyfirmata/pymata4, which didn't work. After that, it would no longer run properly via Arduino IDE either. There are no flashing red lights on the stepper driver to indicate an error, however.

Please let me know any other information I can provide that would be helpful. Thank you!

9 LOW and 9 LOW again? No move....

Also test initially at lower speeds
delay(1) for example. = delayMicroseconds(1000);

I don't think that the motor is able to start from standstill with such high speed ( if you correct htat LOW to HIGH :wink: ). Steppers need acceleration and deceleration for higher speeds to not stall. Try with much more delay.

You could use my MobaTools library to drive your stepper. There is a very simple example to get it turning. You only have to adjust the pin numbers and the steps/revolution.

Oops, yes that is meant to be HIGH then LOW. I had just temporarily changed it to stop the program.

Increasing the delay does not seem to help, unfortunately. I've tried up to 10 millisecond delay with no improvement.

Doesn't appear to be a ramping issue -- I used that simple example from MobaTools (and thanks for linking that), and it just caused a ramping clicking/vibrating in the motor instead of full speed clicking. So I think ramp-up can be ruled out as the problem.

I think with such a delay it should work. Did you check all your connections thoroughly?

Yes, and many times... Had these same connections yesterday when it did seem to work for a bit.

My best guess is that it is either an electrical interference issue, or that there is something in the closed loop encoder side that I am not fully understanding that would cause it to not work.

Is there anything in the wiring image that I showed that could be causing an interference issue?

Could you try open loop, without the encoder or feedback?

Yes, I've tried with dip switch 6 set to on, which should run it in open loop mode. This still yields the same result.

And the encoder output physically disconnected?

Fix the double LOW in loop. Let the first be a HIGH.
Increase the second delay to 10 000.

@Railroader
Ran the following:

void setup() {
  pinMode(9,OUTPUT); // set Pin9 as PUL
  pinMode(8,OUTPUT); // set Pin8 as DIR
}

void loop() {
  digitalWrite(8,HIGH); // set high level direction
  digitalWrite(9,HIGH);
  delayMicroseconds(10);
  digitalWrite(9,LOW);
  delay(10);
}

Same result, just slower. It almost feels like the motor is ticking back and forth...

Yes, fully disconnected. Same result.

I was having the same problem, and it is because my stepper motor was not able to do half-step or full-step mode for some reason. I am having great results with 1/8 steps though. The info here should help though.

Go back to single step and check.
Eventually swap the coils connections to the driver

Verify the coils using. DMM in resistance measuring. Once I got a stepper with one coil cable broken.

1 Like

This. Are you sure you've identified/connected the coils correctly to the driver?

@tays22 @Railroader
Ok, appears to be a microstepping issue. Set it back to 200 pulse/rev (full step), and I have rotation. Good call!

Given the 100:1 ratio on the gearbox of this stepper, I don't think I'll need to be microstepping it, so I should be good to go. With that said, how can I determine that maximum speed that I can run this at? When I use a 1 millisecond delay, I get movement but a lot of chatter in the motor - but if I go down to more like a a 50 microsecond delay, I get no movement at all. Is there a value in the specifications that would tell me what the best area to run this in is in terms of pulse frequency?

Thanks for the help.

1 mS is very short. Go for 10. If that works, try 9 etc.
Steppers have parameters called run in resp. run out. That's the maximum frequency when starting at zero speed.
All kinds of initial load lowers that frequency.

Such as a gearbox and whatever the stepper is actually driving. Just experiment and don't forget about the possibility of accelerating too.

The closed loop aspect complicates matters as well - you may want to consult the driver manual to see what happens when the stepper can't do what you asked it and whether there is a point where it just says "I give up".