Pages: [1]   Go Down
Author Topic: Stepper Motor Accuracy  (Read 1611 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Karma: 0
Posts: 27
What does this button do?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Doing some testing using a Pololu stepper controller:

and SparkFun stepper motor:

Connected to a 12V, 12 amp power supply.

I calibrated the amps going into the motor. (basically 70% of the motors rated amps)

There is no weight load on the motor.

But when I feed it this code about every 20 seconds:

int j;
digitalWrite(3, HIGH); //direction

for(j=0; j<=200; j++) {
digitalWrite(stepPin, LOW);
digitalWrite(stepPin, HIGH);

After a very few rotations the stop point is always shifting farther and farther. Like it's adding steps each rotation.

200 steps should end in the same place every time I call this code. But it never does.

Am I doing something wrong?

Thanks for any help  : )

Side questions. Is there any documentation on how the combination of delay times between the HIGH/LOWs affect the speed/torque/motion?

Are there example sketches for using this controller board? Or do I have to substitute? For example dir/step code for the EasyDriver should work on the Pololu?


Phoenix, Arizona USA
Offline Offline
Faraday Member
Karma: 39
Posts: 5551
Where's the beer?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Am I doing something wrong?

Yes - you are assuming that a stepper motor a) has no mass, and therefore no inertia, and b) has no need for any kind of encoder to ensure repeatability in positioning.

Both of these assumptions are false; the rotor of a stepper has mass, and inertia once you have it moving. It takes time to stop such a moving mass, possibly enough time to overshoot the stopping point. A way around this would be to ramp up and down the speed as you approach end-points. With that said, a better way of determining shaft position is with an encoder of some sort.

Finally - even with all the encoders and careful stepping in the world, you're still possibly going to end up with some form of error in positioning. Welcome to the world of mechatronics.


I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

Leighton Buzzard, UK
Online Online
Edison Member
Karma: 21
Posts: 1339
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

j=0; j<=200
that is 201 steps!!

there are only 10 types of people
them that understands binary
and them that doesn't

Global Moderator
Offline Offline
Brattain Member
Karma: 474
Posts: 18696
Lua rocks!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quite right. If it was not advancing one step per execution of that code, then there would be something wrong.

Pages: [1]   Go Up
Jump to: