Putting robotics at your service™

Free shipping on orders over $75

Motor Shield help

Print view Share :
Previous topicNext topic

Page 1 of 1 [ 5 posts ]

New ( offline )
Posts: 4
Posted: 2012-04-02 19:00 
 Post subject: Motor Shield help

This is my first post but I'm a total noob when it comes to robots. I have a question about a Motor Shield. I am using http://www.robotshop.com/adafruit-motor-shield-kit-arduino.html?utm_source=google&utm_medium=base&utm_campaign=jos
from Robotshop, along with this stepper motor from Pololu http://www.pololu.com/catalog/product/1208

My question is this what is the correct way to hook up the wires?

I have tried multiple combinations and the only reaction I get out of the motor is that it moves back and forth with no real movement. It just kinda shakes really fast. I am using this code

I am using the Arduino MEGA and a 7.2 volt Ni-MH battery

// Adafruit Motor shield library
// copyright Adafruit Industries LLC, 2009
// this code is public domain, enjoy!


// Connect a stepper motor with 48 steps per revolution (7.5 degree)
// to motor port #2 (M3 and M4)
AF_Stepper motor(48, 2); < -- I have changed this from 48 to 200 and tried the other side of the motor shield by changing 2 to 1.
void setup() {
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println("Stepper test!");

motor.setSpeed(10); // 10 rpm

void loop() {
Serial.println("Single coil steps");
motor.step(100, FORWARD, SINGLE);
motor.step(100, BACKWARD, SINGLE);

Serial.println("Double coil steps");
motor.step(100, FORWARD, DOUBLE);
motor.step(100, BACKWARD, DOUBLE);

Serial.println("Interleave coil steps");
motor.step(100, FORWARD, INTERLEAVE);
motor.step(100, BACKWARD, INTERLEAVE);

Serial.println("Micrsostep steps");
motor.step(100, FORWARD, MICROSTEP);
motor.step(100, BACKWARD, MICROSTEP);

I have changed multiple parameters in the code including changing the number of steps from 48 to 200 in the code.
The current wire combination I have is
(orientation of the board horizontal to my view I can read MEGA left to right and M4, Gnd and M3 are vertical. Sorry no camera)

So from my view I see it like so.

M4 = Green
M4 = Blue
Gnd = null
M3 = black
M4 = Red.

As I said I have tried multiple combinations and changes to the code. I have read the tutorial and I have tried "The center taps should both be connected together to the GND terminal on the motor shield output block. then coil 1 should connect to one motor port (say M1 or M3) and coil 2 should connect to the other motor port (M2 or M4)." In every which way I can think of.

Is my problem a Hardware, Code, or power problem. I have some lipos lying around but they are quite large and I don't want to risk seeing the magic smoke again. The smallest lipo I have is 3 cell 11.1V 2650 mAh.

My goal is to have the motors move a device forward and backwards. Essential I'm using it for wheels. If I could get some help getting this code to work I can figure out how to input the sensor data I want.

Thank you

New ( offline )
Posts: 4
Posted: 2012-04-02 19:30 
 Post subject: Re: Motor Shield help
I want to add that I have hooked up the same coils to the same port.
Now I have the motor hooked up like this
M4 black
M4 Green
Gnd Null
M3 blue
M3 Red

New ( offline )
Posts: 4
Posted: 2012-04-02 19:37 
 Post subject: Re: Motor Shield help
I just tried hooking up the aforementioned lipo. I used a voltage divider to limit the voltage but it still not work.

User avatar
Admin ( offline )
Posts: 4384
Posted: 2012-04-03 08:24 
I have tried multiple combinations

Be careful about doing things like that in robotics - great way to fry many things at the same time.
Take a look at the user manual on page (hmm.. no pages).. on the section about "Steppers". The first image shows a bipolar stepper motor connected to the terminals. The center connection is not used. The wiring diagram on their site indicates:
Black: coil 1
Green: coil 1
Red: coil 2
Blue: coil 2

Connect the black and green wires to M3, and red and blue wires to M4. The one issue you may have is accidentally reversing the wires. Follow the steps in the guide, and copy the sample code.

Your battery should be connected to the "external power" and the PWR jumper should not be in place. Make sure you have the polarity right. Read the section in the user guide about "Power". If you have questions, ask them here.

Coleman Benson

RobotShop inc.
Putting Robotics at your service!™

Imagine it. Build it. Control it.™

New ( offline )
Posts: 4
Posted: 2012-04-03 13:29 
 Post subject: Re: Motor Shield help
Thanks for the help, after a good nights rest and your suggestion it worked fine. However the motors we are using do not fit our needs. This does not mean I'm giving up just need to find the right motor.


All times are UTC - 5 hours [ DST ]. It is currently 2015-05-23 06:17
Feedback Form