2

My goal is to have my Arduino fire two stepper motors. They need not be simultaneous. I'm using an Arduino Uno with 2 motor shields - specifically, the Seeed Studio Motor Shield v1.0. I know this shield uses D8-13.

Question is, how can I get the Arduino to use both shields? Is there a way to make one of the shields take D0-D7? If I could do that that'd be great. As far as I can tell, there's no way. The motor shields cannot be physically mounted either.

  • What's wrong with breadboarding the motor shields and then running wires to the Arduino? Or see if a breakout for the shield exists? – SoFLy Apr 21 '14 at 8:48
  • 1
    Part of the problem is that you've picked a shield that uses the L298 and hence requires the Arduino to control the stepper in detail, and use much of the MCU time, and many signals, to do so. Other shields based on more sophisticated chips like A4988 or DRV8825, only require the Arduino to send Direction and Step signals, and one select line for each motor. See particularly the shields commonly used for 3D printer control, if you have an Arduino Mega, or smaller ones (eg: DF Robot DRI0023). (But note differing current capabilities.) – gwideman Apr 21 '14 at 23:42
  • SoFly, thanks, but for some reason stepper #2 is not responding when i "connect" it to pins 2-7. for code please see my comment to Karl B. below – user40632 Apr 26 '14 at 23:17
1

Some shields let you use jumpers or something to change the pin assignments, but I don't believe the Seed motor shield does. What you can use is a go-between shield between the two shields to remap the pins on the top shield. Then in your code, you just initialize the second instance using different pins. You just have to make sure the alternate pins have the features you need, like pwm.

  • Thanks! Tried effectively that by using breadboard. BUT, any motor shield thats connected to pins 2-7, which are PWM, output pins, won't work. Original Code below. I just subtracted 6 from each pin number to get pins 2-7. Why not working? Is the "~" sign next to pin 3,5,6,9,10 and 11 important? – user40632 Apr 26 '14 at 22:52
  • #include <Stepper.h> const int stepsPerRevolution = 340; // initialize the stepper library on pins 8 through 11: Stepper myStepper(stepsPerRevolution, 8,11,12,13); void setup() { // set the speed at 60 rpm: myStepper.setSpeed(60); Serial.begin(9600); pinMode(9,OUTPUT); pinMode(10,OUTPUT); digitalWrite(9,HIGH); digitalWrite(10,HIGH); } void loop() { Serial.println("clockwise"); myStepper.step(stepsPerRevolution); delay(500); Serial.println("counterclockwise"); myStepper.step(-stepsPerRevolution); delay(500); } – user40632 Apr 26 '14 at 22:52
  • Nevermind, I can't paste code into this window. Basically, it boils down to: Stepper myStepper(stepsPerRevolution, 8,11,12,13); myStepper.setSpeed(60); pinMode(9,OUTPUT); pinMode(10,OUTPUT); digitalWrite(9,HIGH); digitalWrite(10,HIGH); – user40632 Apr 26 '14 at 23:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.