Stacking 2 motor shields (v2.0)

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
sushku
 
Posts: 8
Joined: Wed Mar 26, 2014 4:33 am

Stacking 2 motor shields (v2.0)

Post by sushku »

Hi,

I have a question regarding stacking two of the version 2.0 motor shields, to drive 4 stepper motors. Since the Arduino Uno is to be powered using the DC barrel jack, how should the VIN jumper be placed on the shields ? Should both the shields be stacked with the VIN jumper on, or is it sufficient to place the VIN jumper only on the top shield ?

User avatar
adafruit_support_bill
 
Posts: 88144
Joined: Sat Feb 07, 2009 10:11 am

Re: Stacking 2 motor shields (v2.0)

Post by adafruit_support_bill »

Motor power for each shield is separate. If you want to power all motors on both shields from the Arduino DC power jack, then you need to have VIN jumpers installed on both shields.

sushku
 
Posts: 8
Joined: Wed Mar 26, 2014 4:33 am

Re: Stacking 2 motor shields (v2.0)

Post by sushku »

Thank you. I guess I will have to break the plastic off of the VIN jumper of the bottom shield to reduce its length, as the top shield wont sit correctly if the jumper is placed as is.

User avatar
adafruit_support_bill
 
Posts: 88144
Joined: Sat Feb 07, 2009 10:11 am

Re: Stacking 2 motor shields (v2.0)

Post by adafruit_support_bill »

That should be fine. The plastic tab is only there to make it easier to grab.

sushku
 
Posts: 8
Joined: Wed Mar 26, 2014 4:33 am

Re: Stacking 2 motor shields (v2.0)

Post by sushku »

This worked fine and I was able to test the motors. But I am having another problem now. When I am testing all 4 stepper motors together, they stop after 9-10 cycles. Details of the setup and problem below.

Setup:
2 Adafruit motor shields v2 stacked on Arduino Uno.
4 stepper motors (Small Reduction Stepper Motor - 5VDC 32-Step 1/16 Gearing), 2 each connected to the 2 shields.

Problem:
The motors are fired one by one at double coil steps. After all 4 are fired, the cycle is repeated. The motors run fine for about 9-10 cycles (sometimes less). Then they stop. The green LEDs on the shields start blinking intermittently. Also the "Serial Port" option in the Arduino program becomes grayed out.

Code:
Code used is given below.

Code: Select all

/* 
All Steppers Test
*/

#include <Wire.h>
#include <Adafruit_MotorShield.h>
//#include "utility/Adafruit_PWMServoDriver.h"

int i = 1;
  
// Create the motor shield object with the default I2C address
Adafruit_MotorShield AFMS12 = Adafruit_MotorShield(0x60);
// Or, create it with a different I2C address (say for stacking)
Adafruit_MotorShield AFMS34 = Adafruit_MotorShield(0x61);

// Connect a stepper motor with 200 steps per revolution (1.8 degree)
Adafruit_StepperMotor *stepperMotor1 = AFMS12.getStepper(200, 1);
Adafruit_StepperMotor *stepperMotor2 = AFMS12.getStepper(200, 2);
Adafruit_StepperMotor *stepperMotor3 = AFMS34.getStepper(200, 1);
Adafruit_StepperMotor *stepperMotor4 = AFMS34.getStepper(200, 2);

void setup() {
  Serial.begin(9600);           // set up Serial library at 9600 bps
  Serial.println("All Steppers test!");

  AFMS12.begin();  // create with the default frequency 1.6KHz
  AFMS34.begin();  // create with the default frequency 1.6KHz
  //AFMS.begin(1000);  // OR with a different frequency, say 1KHz
  
  stepperMotor1->setSpeed(200);  // 200 rpm
  stepperMotor2->setSpeed(200);  // 200 rpm
  stepperMotor3->setSpeed(200);  // 200 rpm
  stepperMotor4->setSpeed(200);  // 200 rpm
}

void loop() {
  Serial.println("==");
  Serial.println(i);
  Serial.println("==");
  Serial.println("Double coil steps Motor 1");
  stepperMotor1->step(100, FORWARD, DOUBLE); 
  stepperMotor1->step(100, BACKWARD, DOUBLE);
  Serial.println("Double coil steps Motor 2");
  stepperMotor2->step(100, FORWARD, DOUBLE); 
  stepperMotor2->step(100, BACKWARD, DOUBLE);
  Serial.println("Double coil steps Motor 3");
  stepperMotor3->step(100, FORWARD, DOUBLE); 
  stepperMotor3->step(100, BACKWARD, DOUBLE);
  Serial.println("Double coil steps Motor 4");
  stepperMotor4->step(100, FORWARD, DOUBLE); 
  stepperMotor4->step(100, BACKWARD, DOUBLE);
  i++;
}

User avatar
adafruit_support_bill
 
Posts: 88144
Joined: Sat Feb 07, 2009 10:11 am

Re: Stacking 2 motor shields (v2.0)

Post by adafruit_support_bill »

That sounds like your power supply is going into overload. What are you using to power this?

sushku
 
Posts: 8
Joined: Wed Mar 26, 2014 4:33 am

Re: Stacking 2 motor shields (v2.0)

Post by sushku »

I am using the Arduino Uno power supply (supplied along with the Arduino starter kit) to power this. I have placed the VIN jumpers on both the shields. The Arduino USB is connected to the computer. The image of the power supply is below.
Image

The setup is as below.
Image
Attachments
setup.jpg
setup.jpg (206.05 KiB) Viewed 899 times
powersupply.jpg
powersupply.jpg (162.54 KiB) Viewed 899 times

User avatar
adafruit_support_bill
 
Posts: 88144
Joined: Sat Feb 07, 2009 10:11 am

Re: Stacking 2 motor shields (v2.0)

Post by adafruit_support_bill »

That is a 1A (1000mA) supply. These motors are designed to run at 5v and will draw about 130mA per phase or 260mA total in DOUBLE step mode. But you are running them at 9v, so the current draw will be more like 240mA/phase or 480mA total in DOUBLE step mode. You will need a 2A supply to run all those motors.

Also note that over-volting by 40% will shorten the life of the motor considerably. Unless you really need the extra torque, you would be better off using a separate 5v supply connected via the external power terminals. (Be sure to remove the VIN jumper when doing that).

sushku
 
Posts: 8
Joined: Wed Mar 26, 2014 4:33 am

Re: Stacking 2 motor shields (v2.0)

Post by sushku »

Thank you. I knew I was doing something wrong :).

For powering the motors through an external power supply, should I use 2 separate supplies for the two shields each at 5V 260mA or should I go for a single 5V 520mA supply and connect to both the shields via a splitter ?

sushku
 
Posts: 8
Joined: Wed Mar 26, 2014 4:33 am

Re: Stacking 2 motor shields (v2.0)

Post by sushku »

Sorry. I should have said, 5V 520 mA for per shield as there are 2 motors for each shield.

So is it better to use two 5V 520mA power supplies one each for each shield ?
Or
One 5V 1040mA single supply and connect to both shields via a splitter ?

User avatar
adafruit_support_bill
 
Posts: 88144
Joined: Sat Feb 07, 2009 10:11 am

Re: Stacking 2 motor shields (v2.0)

Post by adafruit_support_bill »

You can use a single supply and add jumpers from one shield to the other. It is close, but at 1040mA, a 1A supply will probably overheat. I'd recommend a 5v/2A supply: https://www.adafruit.com/products/276

sushku
 
Posts: 8
Joined: Wed Mar 26, 2014 4:33 am

Re: Stacking 2 motor shields (v2.0)

Post by sushku »

That product seems to be out of stock. Can I use a 5V 1.25A supply like this one ? https://www.adafruit.com/product/184

User avatar
adafruit_support_bill
 
Posts: 88144
Joined: Sat Feb 07, 2009 10:11 am

Re: Stacking 2 motor shields (v2.0)

Post by adafruit_support_bill »

That comes in kit form, and is designed for breadboard use. You can make it work, but it may not be so convenient.

For about the same price, we have these which would probably work better for you: https://www.adafruit.com/products/1466

sushku
 
Posts: 8
Joined: Wed Mar 26, 2014 4:33 am

Re: Stacking 2 motor shields (v2.0)

Post by sushku »

Ok. Thanks.

User avatar
designCPU
 
Posts: 41
Joined: Sun Aug 24, 2014 2:24 pm

Re: Stacking 2 motor shields (v2.0)

Post by designCPU »

Here's my setup:

1 Arduino Uno
2-3 Adafruit v2 Motor Shields
8-12 12V/.08A CPU Fans (~8-12W total)

The 2 or 3 motor shields will be stacked. Each fan will switch on randomly and run for maybe 10 seconds every minute. Can the Arduino and stacked shields be powered from this 12V/5A switching power supply https://www.adafruit.com/products/352? Or could I use a cheaper 12V/2A power supply as well?

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”