# how can i understand when a stepper motor get a complete round?

i have just get out from an old printer a stepper motor and i'm experimenting with it and arduino and easydriver board. the motors has 4 pin and 8 magnets. i can drive it correctly: i run it and change direction. but now i just wondering the best solution to understand when it makes a complete round.

i've done a simple circuit: with a button i get it moving, when i press the button i reset a counter, when the button is pressed the counter is incrementing and then i realease the button the counter is saved. then i print the counter: more or less it is near 1600. this is empiric and for now it works. but: how to find out a precise value?

• The datasheet for the motor should say how many steps there are per revolution. Aug 1, 2012 at 18:22
• If you can't find a datasheet, then have it do 1000 revolutions and average your counter to get a more accurate estimate. Aug 1, 2012 at 18:24
• 1600 sounds like you are at least half- or quarter-stepping (or more!). Are you sure you're making full steps to count? Aug 1, 2012 at 19:28
• Ah! Here is the answer on the page you link to: It defaults to 8 step microstepping mode. It is indeed in microstepping mode. en.wikipedia.org/wiki/Stepper_motor#Microstepping Aug 1, 2012 at 19:38
• Keep in mind that if there is sufficient load on the stepper shaft, it will not step at all, and might even jump backwards. Feb 28, 2013 at 18:53

Stepper motors usually have a sensible number of steps per revolution, 100, 200, 400 are popular numbers. So my guess would be that 1600 is the precise value for your motor.

The way to check it is simply this:

for (i=0; i<400; i++)
{
pause_ms(100);

for (k=0; k<1600; k++)
take_one_step();
}


Watch what happens. If the number is exactly 1600, then you'll simply see the motor rotate 360º 400 times, with a 0.1s pause between each rotation.

If the number was actually 1599, then you'd see the motor pausing at a slightly different place each time. And after 400 revolutions, would end up facing 90º from where it started.

• good answer, it is just that your test will take almost 18hrs to complete... Aug 1, 2012 at 19:27
• @nkint - Fiddle a bit with the MS1 or MS2 pins to ground, check the datasheet ( allegromicro.com/Products/Motor-Driver-And-Interface-ICs/… ) for setting it to full stepping mode. Aug 1, 2012 at 19:49
• @jippie, no, it won't. It's pausing every revolution, not every step, so the total pausing would be 40 seconds. Stepper motors aren't the fastest to begin with, so the 400 revs might take a few minutes. But another possibility would be to just have the motor do 100 revs and then stop permanently - with a pointer glued to the shaft and a protractor underneath to measure any error (x100). A few trials of that test would, if the result was repeatable, indicate if the step rate was reliable. But 1600 fractional steps/rev is an extremely likely answer - if it was off, it would be off by a lot. Aug 1, 2012 at 20:00
• @ChrisStratton - you are correct about the pausing, I overlooked that. Aug 1, 2012 at 20:02

Motor doesn't have a label? You should find an indication of the step angle (how many degrees the shaft rotates in one full step). Divide 360 by the Step Angle and you get the total steps per revolution.

If there is no label, and you can't find the data sheet for your motor, you can measure the step angle connecting some kind of hand/needle/pointer to the shaft. In almost all stepper motors, you can feel the steps, as the shaft gets "locked" in each step position as you turn it manually. So, use a protractor to read the angular displacement in a single step, and your're done.