Go Down

Topic: stepper motor skips steps (Read 8971 times) previous topic - next topic

stellirinu

Hello Arduino users,

Im trying to learn control stepper motors. I lack of experience in pogramming and electronics and now I have been stuck at this problem. In both on my motor shields stepper motor keeps skipping every 4th step, if i step one step at time. If i make full rotate (200 steps) it might make it correct or not. Sometimes it will turn exactly 360 degrees and sometimes about 320 degrees.

I would be extremely happy if someone has glue about what is wrong on my setup.

Here is video about this problem:
http://www.youtube.com/watch?v=Pfl946S0wfw&feature=youtu.be


I have arduino Mega ,Arduino motor shield R3 ( and dfrobot 2A motor shield) and Mercury SM-42BYG011-25 stepper motor. I have wired my stepper this way:
red -> A+
green -> A-
yellow -> B+
blue - > B-

Motor shield is using external 12v power supply.


#include <Stepper.h>
int led = 53;
const int stepsPerRevolution = 200;  // change this to fit the number of steps per revolution
                                     // for your motor
const int pwmA = 8;
const int pwmB = 11;
const int dirA = 9;
const int dirB = 10;
                       
And here is program that im running on arduino:             

// initialize the stepper library
Stepper myStepper(stepsPerRevolution, pwmA, pwmB,dirA,dirB);           

void setup() {

  myStepper.setSpeed(110); // set stepper speed
  pinMode(led, OUTPUT);     
}

void loop() {

  digitalWrite(led, HIGH); // turn led on
   myStepper.step(1);  // step one step
   delay(100);
  digitalWrite(led, LOW); // turn led off
  delay(500);
 
  }

Grumpy_Mike

Quote
I would be extremely happy if someone has glue about what is wrong on my setup

That is a sticky question.  :)

Simple, if you are skipping steps you are trying to get the motor to go too fast. Cures are:-
1) go slower.
2) ramp up to the final speed
3) supply the motor with more voltage - you might need a regulating driver for this to keep the current down

stellirinu

Hi Grumpy_Mike

Thank you for your answer,

I have tried to go slower, but when i try to go much faster or slower motor starts shaking or skipping more steps. In this example video stepper moves just one step at time and it skips every 4th.

I have tried also accelstepper library with ramps, but it didnt help.




Grumpy_Mike

OK sorry it is usually the speed.
However on this occasion I suspect it is your driver. The PWM input is normally used to turn the motor on and off, so that when it is off there is no current flowing. You can't drive a stepping motor like this you need current all the time. You need a motor driver that is suitable for stepping motors.

stellirinu

I also have dfrobot motorshield wich have something called PLL control mode. Do you mean something like this?

http://www.dfrobot.com/wiki/index.php?title=Arduino_Motor_Shield_(L298N)_(SKU:DRI0009)

Grumpy_Mike

Quote
Do you mean something like this?

Hard to tell because I couldn't find any information with that link other than it uses an L298.

Thinking about it using your existing arrangement you could do it if you don't treat it like a 4 unipolar motor but the bipolar motor it is. So that means you only have two signals controlling the motor. Use only the direction signal, if you think about it that controls the direction of current through each coil. I don't know if your library can cope with that.
Get yourself a bit of theory by looking at:-
http://www.thebox.myzen.co.uk/Workshop/Motors_4.html

stellirinu

Ok, I will study more theory little bit and try to figure out how to get motor controlled with only two signals.

Thank you for helping !


Grumpy_Mike

Remember with the motor on the dir controls the direction of current through the motor. So you have two coils each one always energised but having the direction of current through them change.

loz_the_bear

G'day, what are the LED's on the stepper driver indicating? I notice in the video, that when no LED's are on is when it skips a step... I havent used this driver myself so not sure how it's meant to operate.

from my experience, having the current either too high or too low will cause a stepper to skip steps, check that you're providing enough current. also check the datasheet for your motor. it might require a higher voltage. over-voltage on a stepper is fine as long as you can limit the current.

to be honest if it's skipping a specific step, then I doubt it's the current, but good practice to isolate each possibility when troubleshooting because you never know what you'll miss. I had a problem with my stepper randomly skipping steps, and it was due to current. I had adjusted the current limiting resistor on my driver only to find out later that the silkscreen was backwards, and while I thought I was increasing the current I was actually decreasing it making the problem worse :/.

would it be possible to get a copy of the function you're calling from the stepper library? open Stepper.h and search for the myStepper.step() function.

I might have a look at specs on the parts you're using later tonight if I get a chance because at the moment I'm not 100% sure how it's all setup..

Go Up