# How to determine proper stepper polarity?

In one of the answers to this question, it is stated that wiring one of the coils on a bipolar stepper backwards can cause the motor to step improperly, or not at all. I've salvaged several steppers from discarded electronics (printers, scanners, typewriters), and I'm curious, is there a better method than trial and error for determining the proper polarity of the coils?

If I reverse both coils, does the motor simply run in reverse?

-
it's probably too much to hope that those leads are color coded to any kind of standard. – JustJeff May 10 '11 at 20:46
@JustJeff - They're usually color coded, but the color-code is different for almost every motor, and you don't know how it maps to the coils. – Connor Wolf May 10 '11 at 21:43
@Fake Name - that's what i'm saying. if you pulled the same motor from the same model of three printers, i imagine the phases would have the same colors. but two different motors? wouldn't count on it. – JustJeff May 10 '11 at 21:45
@JustJeff - Whoops, I somehow completely glossed over the "Any kind of standard" part of your comment. Too early in the morning for me, I guess. – Connor Wolf May 10 '11 at 22:34

If you think of the phases of the stepper, it would go from [--] to [-+] to [++] to [+-], and then repeat.

If we label those phases as: [--] J [-+] K [++] L [+-] M

Then you go "forward" by stepping JKLMJLKMJLKM... and "backwards" by stepping MKLJMKLJMKLJ...

If you flip the bit on both, we now have: [++] J' [+-] K' [--] L' [-+] M'

So when you drive, you get J'K'L'M'J'K'L'M'... But J' is really L, K' is really M, L' is really J and M' is really K on the motor, so you are moving LMJKLMJKLMJK... which is the same sequence of the "forward" stepping, but with the cycle starting half-way in the middle of the original cycle.

So, yes, if you reversed the polarity on BOTH coil sets, you would still move in the same direction. However, you will be off by half a stepper revolution. Depending on the gearing, the difference would probably not make a difference.

EDIT

I updated to indicate polarity as +/- (versus 1/0 in my original posting).

This is easier to visualize graphically -- if you treat each winding 1 as the X coordinate, and winding 2 as the Y coordinate, then you are stepping between four quadrants. If you then half- or quarter- step, you are just increasing the number of points that define your loop. Taken to the limit, if you have the X=sin(wt) and Y=cos(wt), you'll have a smooth circle; and if you reverse the sign of one (say X=-sin(wt)), you'll just go through the circle in reverse direction.

-
Perfect, thank you. Indeed, it looks like swapping the polarity on one of the coils will send you in reverse and off by one or two steps, depending on which coil was reversed. I wonder what happens when you're half/eighth/sixteenth stepping... – Mark May 11 '11 at 17:35