Go Down

Topic: Adafruit motor shield - Sparkfun stepper wiring? (Read 2579 times) previous topic - next topic



I'm using the Adafruit motor shield and the Sparkfun stepper. I'm trying to wire the motor up correctly. Can anyone tell me the correct wiring? See attached.


So long as you make sure one winding goes to one channel and the other to the other channel it will be fine.  You can use a multimeter to check which motor wires are connected by a winding.

It the motor goes the wrong way simply reverse one of the two windings.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]


Thanks for the reply. I got it wired right in the end. However the speed is rubbish - nothing above 20rpm. I think it's power related even though i'm feeding it the 12v it says it needs.


With stepper motors to hold steps at speed you have to accelerate and decelerate the stepping frequency to allow the mass of the motor to keep up - if you were just going from stationary to 20rpm instantly that would explain its failure to manage any faster.

If you feed steps from standstill at a high rate the rotor won't be able to make the first step before the next pulse arrives owing to inertia.

I would expect something more like 200rpm to be readily achievable with an accelerating step rate.  I think IIRC there's an AccelStepper library?
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]


Thanks for the tip.

I'm still not getting any kind of speed out of the motor. Here's the code i'm now using:

Code: [Select]

#include <AccelStepper.h>
#include <AFMotor.h>

AF_Stepper motor1(200, 1);

void forwardstep1() { 
  motor1.onestep(FORWARD, DOUBLE);
void backwardstep1() { 
  motor1.onestep(BACKWARD, DOUBLE);

AccelStepper stepper1(forwardstep1, backwardstep1);

void setup()



void loop()
    if (stepper1.distanceToGo() == 0)


It's a version of one of the examples. It's the only one that would work with a bit of tweaking. The result i get is as follows. It speeds up to about 20rpm then wiggles back and forth - then it obviously reached it's distance and does the same in the other direction.

Any other tip? With the code i'm using what would the expected results be?



May 03, 2011, 08:34 pm Last Edit: May 04, 2011, 02:39 pm by PogCarr Reason: 1
Just a suggestion, but try setting your setMaxSpeed(700); setSpeed(700); and most importantly setAcceleration(1000).  An accellof 15 is soooo slow and I am sure you never really get to speed before you reach your final position!

Also, make sure you are using the latest AccelStepper library as I have found some significant changes in the different version.

Finally, it is common and recommended to drive a stepper motor system with 4 to 6 times the rated voltage of the coils.  I believe this has to do with the pulsed nature of the driving circuitry (good description of all matters Stepper Motor related at http://www.geckodrive.com/ark-2/support.html ), but in any case, if the coils are rated 12V try driving it with as high a voltage as the Motor Shield will take, I think 36VDC.


Go Up