Stepper Motor Accuracy

I have a stepper motor that says it is 200 steps per revolution. In testing, i am able to get this when turning 90, 180 or 360 Degrees - it always begins and ends in the same spot.

However, if I try to go in a complete circle moving 1 degree at at time (so .55555556 steps) it is way off.

I am using an Adafruit Motorshield, and the code to control the stepper is as follows:

#include <Adafruit_MotorShield.h>

Adafruit_MotorShield AFMS = Adafruit_MotorShield();
Adafruit_StepperMotor *myMotor = AFMS.getStepper(200, 2);

void setup(void) {
AFMS.begin();
}

void loop(void) {
myMotor->step(.5555556, FORWARD, MICROSTEP); //1*

delay(100);
}

Do stepper motors have the ability to move with that accuracy?

thanks,
-Matt

mthump:
However, if I try to go in a complete circle moving 1 degree at at time (so .55555556 steps) it is way off.

Why would you expect anything else?

When using single steps the motor moves 1.8° at a time. If you use micro-stepping you can move in smaller steps but none of them will be exactly one degree.

If you explain exactly what you are trying to achieve we may be able to help.

...R
Stepper Motor Basics
Simple Stepper Code

I’m using the stepper to rotate an arm using gears with a 2.5:1 ratio. In this setup, the stepper has to rotate 2.5 times to move my arm in a complete circle. Or, in degrees, the stepper has to rotate 900 degrees to move the arm 360 degrees.

I would like the ability to move the arm in 1 degree increments. Doing the math, in my final setup I need the stepper to move 1.388888889 steps to move the arm 1 degree.

Is it possible to control the stepper motor in fractions of steps? You mentioned micro-stepping, but in tests, it seems like it rounds to a whole step. Even if I could move 1.5 steps, that would be better than either 1 whole or 2 whole steps, for my application.

Thanks
-Matt

Is it possible to control the stepper motor in fractions of steps?

Yes, but not very accurately. The divisions are half step, quarter step, 1/8 step, etc.

However, for microstepping to work properly, you need a stepper driver capable of microsteps, you need to wire it properly and you MUST set the motor current limit correctly.

Pololu has a video explaining how to do that for their drivers, but those instructions are not necessarily applicable to other motor drivers, even if the driver is of the same type (A4988, DRV8825, etc.).

The Adafruit Motorshield V2 is not a microstepping driver, despite the misleading advertising.

mthump:
I'm using the stepper to rotate an arm using gears with a 2.5:1 ratio. In this setup, the stepper has to rotate 2.5 times to move my arm in a complete circle. Or, in degrees, the stepper has to rotate 900 degrees to move the arm 360 degrees.

With stepper motors it is much better to think in steps rather than degrees. With a 2.5:1 ratio moving 360 degrees on the output shaft would require 200 * 2.5 = 500 motor steps.

...R

Rather than trying to move in fractions of a step, move to a step count that you calculate:

stepper.moveTo (degrees * 200 * 2.5 / 360) ;

(this is the way you've do it with AccelStepper library)

With microstepping (you should always use microstepping if possible, MUCH less vibration),
then you'd add in the microstepping factor too.

mthump:
I would like the ability to move the arm in 1 degree increments.

Obviously, you can play around with gear ratios to achieve this. Why particularly is a single degree increment important though?

the 200 * 2.5 / 360 is how I arrived at the 1.38888889 steps. This works if I'm moving larger distances, but generally speaking I want to move a degree, then preform an action.

It doesn't have to be perfect, but over the course of time moving in 1 or 2 whole steps it will be off. I am using the Adafruit Motorshield v2.3, and per jremington, he has informed that it won't do microstepping.

The only thing I found is to use INTERLEAVE mode and maybe that will give me the ability to move in half-steps.

Or i'll just have to make do with moving one or two whole steps at a time. Then just periodically adjust for the skew over time.

Or, you could buy a much, much better stepper motor driver, which will do what you want.

But, there is almost never a need to move in "exact" 1 degree increments.

If you are using this motor to orient your compass setup, with full steps you know the compass orientation at all times quite accurately. It does not matter that the individual orientations are not integer degrees.

mthump:
It doesn't have to be perfect,

Have you tried MarkT's suggestion from reply #5?

Go create a loop from 1 to 360 degrees
Use MarkT's formula to calculate the steps and move there.

There will be 360 movements. None of them will be off by more than a degree.
Is that good enough?

mthump:
the 200 * 2.5 / 360 is how I arrived at the 1.38888889 steps. This works if I’m moving larger distances, but generally speaking I want to move a degree, then preform an action.

It doesn’t have to be perfect, but over the course of time moving in 1 or 2 whole steps it will be off.

I think what you need to do is keep track of the error and add or subtract an extra step - a bit like a leap-year corrects for the error in the number of days per year.

For example with 400 steps per revolution (i.e. 2x microstepping) each step will be 0.9°. So one step is approximately one degree. But after 10 steps you have only moved 9° so you need to move an extra step to get closer to the expected 10°

If you are using full steps then each step is 1.8° and the minimum resolution is really only 2°

You can get stepper motors that have 400 full steps per revolution.

…R

I still don't understand why degrees are important to you. A degree is an arbitrary definition which can be very useful, but you can achieve similar things with a stepper that has 200 steps per rotation. Or get one that has 400. Or perhaps one that has an integrated gearbox that needs many steps per degree. What do you need for your application?

mthump:
the 200 * 2.5 / 360 is how I arrived at the 1.38888889 steps. This works if I'm moving larger distances, but generally speaking I want to move a degree, then preform an action.

You clearly miss the point. Don't use incremental values, use absolute values. If you keep incrementing
the errors build up. If you compute an absolute position it will be as close as possible every time you do it.

You can get geared steppers with a 3.6 : 1 (18 : 5) ratio, 1.8 degrees in = 0.5 degrees out.

I can't attest to cost & quality. :confused:
GM42BYGH416-G3.6

Is the OP forgetting that when the 200 step motor is moved 200 steps, it returns to 1 step beyond where it started? To turn 1 complete turn and end up in the beginning position, 199 steps are needed.

Paul

By that logic, a 2 step/revolution motor returns to its starting position after taking 1 step.