Arduino Forum upgrade scheduled for Monday, October 20th, 11am-4pm (CEST). Sorry for the inconvenience!
Pages: [1]   Go Down
Author Topic: Adafruit motor shield - Sparkfun stepper wiring?  (Read 1698 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

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.



* photo.JPG (347.12 KB, 598x550 - viewed 58 times.)
Logged

0
Offline Offline
Shannon Member
****
Karma: 226
Posts: 12963
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Shannon Member
****
Karma: 226
Posts: 12963
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#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()

    stepper1.setMaxSpeed(300.0);
    stepper1.setAcceleration(15.0);
    stepper1.moveTo(1000);

   
}

void loop()
{
    if (stepper1.distanceToGo() == 0)
stepper1.moveTo(-stepper1.currentPosition());
    stepper1.run();

}

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?

Thanks
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 19
Arduino controlled scanning...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

-Paul
« Last Edit: May 04, 2011, 07:39:29 am by PogCarr » Logged

Pages: [1]   Go Up
Arduino Forum upgrade scheduled for Monday, October 20th, 11am-4pm (CEST). Sorry for the inconvenience!
Jump to: