# Nema 17 stepper + EasyDriver + AccelStepper; positions per rotation?

Hi,

The subject says it all. I have a nema 17 and EasyDriver board. From my understanding it's 1.8 degree per step. So, 200 steps for 360 degrees. The EasyDriver board is supposed to give 8 microsteps per step (if I understand correctly). So, that should be 1600 steps per revolution. I'm driving all of this with the AccelStepper library. When I am using the moveTo(position) command in AccelStepper it takes a position variable of 6400 to get approximately one rotation. So, my question is this - what is the precise number for position that equals an exact 360 degree revolution? How is it computed?

Thanks! Scott

If the board is set for x8 microstepping (I think that’s the default) there should be 8x200 = 1600 steps per revolution.

However you haven’t given a link to the spec sheet for your motor. Nema17 just defines the size of the front face of the motor and its fixing holes.

It seems like your motor is missing steps.

How are you powering the motor - not from the Arduino, I hope. The Arduino can’t provide enough power for motors. And a stepper motor must have a power supply that is capable of meeting its current (amps) requirement or it may miss steps.

This simple code should work also work with the EasyDriver if you ensure the appropriate connections are made. It doesn’t use any library so it should be easy to see exactly what is happening.

``````// testing a stepper motor with a Pololu A4988 driver board
// on an Uno the onboard led will flash with each step
// as posted on Arduino Forum at http://forum.arduino.cc/index.php?topic=208905.0

byte directionPin = 9;
byte stepPin = 8;
int numberOfSteps = 50;
byte ledPin = 13;
int pulseWidthMicros = 50;  // microseconds
int millisbetweenSteps = 50; // milliseconds

void setup()
{

Serial.begin(9600);
Serial.println("Starting StepperTest");
digitalWrite(ledPin, LOW);

delay(2000);

pinMode(directionPin, OUTPUT);
pinMode(stepPin, OUTPUT);
pinMode(ledPin, OUTPUT);

digitalWrite(directionPin, HIGH);
for(int n = 0; n < numberOfSteps; n++) {
digitalWrite(stepPin, HIGH);
delayMicroseconds(pulseWidthMicros);
digitalWrite(stepPin, LOW);

delay(millisbetweenSteps);

}

delay(3000);

digitalWrite(directionPin, LOW);
for(int n = 0; n < numberOfSteps; n++) {
digitalWrite(stepPin, HIGH);
delayMicroseconds(pulseWidthMicros);
digitalWrite(stepPin, LOW);

delay(millisbetweenSteps);

}

}

void loop()
{

}
``````

…R

For a given supply voltage each motor has a maximum step rate it can handle, try to step faster and it will mis-step. This is made worse by resonances (a motor under load may actually perform a bit better due to damping of mechanical resonances).

There is also a limit to the acceleration rate.

So you generally have to tune the maximum step rate and maximum acceleration for a motor and driver combination. This tuning depends on the mechanical load too.

The fact that you seem to see 6400 steps per revolution suggests you might have misconfigured the driver for x32 microstepping? Although the motor mis-stepping is also possible.