Stepper motor running uneven

I'm experementing with a stepper motor and the zeroborg.
When I use the included zbStepper.py script and run the motor for a lot of sequential steps the speed of the motor varies. I'm using a motor I bought of amazon: https://www.amazon.co.uk/dp/B011NRMXYO/ref=pe_385721_140927991_TE_dp_1
And I use a 2A power supply.
Here is a video that shows the problem:
https://www.youtube.com/watch?v=5fsmmr1uiJg

You can hear it more then see it.

piborg's picture

There are two different likely explanations for this problem:

  1. The delays in the script are too short and the stepper is sometimes missing step commands
  2. The script is not running at a consistent speed

In the case of #1 you should try increasing the stepDelay value and see if it helps.
I would start by doubling it and see what effect that has.

In the case of #2 the Raspberry Pi is probably trying to do other things at the same time.
The example uses time.sleep to perform the delay.
This can be a problem as it only guarantees the delay to be at least that long, it can be longer if it wants.

To help with sleep delays first try setting things up so that nothing else is running.
If this still does not help you can try pygame.time.delay(stepDelay) instead to get a more accurate delay time.

Subscribe to Comments for "Stepper motor running uneven"