Motor Shield V2, Wifi shield and Mega

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

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
Bub7
 
Posts: 9
Joined: Sun Apr 24, 2016 11:23 pm

Motor Shield V2, Wifi shield and Mega

Post by Bub7 »

Hello, I am trying to get my motor shield to turn a single bipolar stepper motor with the example code that is provided by the shields library. My current configuration is Mega 2560, Wifi shield and then the Motor Shield V2. They all work individually but when I try run everything stacked the motor will not turn. Any help on this matter will be greatly appreciated.

User avatar
Franklin97355
 
Posts: 23938
Joined: Mon Apr 21, 2008 2:33 pm

Re: Motor Shield V2, Wifi shield and Mega

Post by Franklin97355 »

Which wifi shield and what is the code you are running? How are you powering the motor and what are the specs on the stepper, specifically the resistance per phase?

User avatar
Bub7
 
Posts: 9
Joined: Sun Apr 24, 2016 11:23 pm

Re: Motor Shield V2, Wifi shield and Mega

Post by Bub7 »

Hello! Ok, this is the only part that I thing we may have a problem with. The wifi shield that I am using is the arduino wifi shield 101 https://www.arduino.cc/en/Main/ArduinoWiFiShield101. The code that I am running is this:

Code: Select all

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

// Create the motor shield object with the default I2C address
Adafruit_MotorShield AFMS = Adafruit_MotorShield(); 
// Or, create it with a different I2C address (say for stacking)
// Adafruit_MotorShield AFMS = Adafruit_MotorShield(0x61); 

// Connect a stepper motor with 200 steps per revolution (1.8 degree)
// to motor port #2 (M3 and M4)
Adafruit_StepperMotor *myMotor = AFMS.getStepper(200, 2);


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

  AFMS.begin();  // create with the default frequency 1.6KHz
  //AFMS.begin(1000);  // OR with a different frequency, say 1KHz
  
  myMotor->setSpeed(10);  // 10 rpm   
}

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

  Serial.println("Double coil steps");
  myMotor->step(100, FORWARD, DOUBLE); 
  myMotor->step(100, BACKWARD, DOUBLE);
  
  Serial.println("Interleave coil steps");
  myMotor->step(100, FORWARD, INTERLEAVE); 
  myMotor->step(100, BACKWARD, INTERLEAVE); 
  
  Serial.println("Microstep steps");
  myMotor->step(50, FORWARD, MICROSTEP); 
  myMotor->step(50, BACKWARD, MICROSTEP);
}
I have my project code that actually implements the wifi shield but for the time being I am just trying to run the stepper by itself as if sits atop the wifi shield. I am powering the motor externally with a lithiam ion battery pack: https://www.adafruit.com/products/354 that is being run through a charging circuit. For the stepper it is the NEMA-17 200 steps/rev, 12V, 350 mA. Is this what you were looking for: 28 oz*in, 20 N*cm, 2 Kg*cm holding torque per phase. https://www.adafruit.com/products/324

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

Re: Motor Shield V2, Wifi shield and Mega

Post by adafruit_support_bill »

Please post some photos of the soldering and connections to both shields.

User avatar
Bub7
 
Posts: 9
Joined: Sun Apr 24, 2016 11:23 pm

Re: Motor Shield V2, Wifi shield and Mega

Post by Bub7 »

I have attached the pictured you have requested. I will have to make another post with the rest of the pictures I do not know a better way so I apologize. Thank you!
Attachments
Motor Shield
Motor Shield
IMG_3011.JPG (397.8 KiB) Viewed 272 times
Wifi shield
Wifi shield
IMG_3010.JPG (372.59 KiB) Viewed 272 times
Wifi Shield
Wifi Shield
IMG_3009.JPG (448.1 KiB) Viewed 272 times

User avatar
Bub7
 
Posts: 9
Joined: Sun Apr 24, 2016 11:23 pm

Re: Motor Shield V2, Wifi shield and Mega

Post by Bub7 »

Here are the rest of the pictures of my build.
Attachments
All connected to Mega
All connected to Mega
IMG_3014.JPG (458.94 KiB) Viewed 272 times
All connected to Mega
All connected to Mega
IMG_3013.JPG (464.3 KiB) Viewed 272 times
Motor Shield
Motor Shield
IMG_3012.JPG (460.38 KiB) Viewed 272 times

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

Re: Motor Shield V2, Wifi shield and Mega

Post by adafruit_support_bill »

Can you post a photo of the top of the motor shield also?

What do you get when you run the i2c scanner: http://playground.arduino.cc/Main/I2cScanner

User avatar
Bub7
 
Posts: 9
Joined: Sun Apr 24, 2016 11:23 pm

Re: Motor Shield V2, Wifi shield and Mega

Post by Bub7 »

Here is the top view of the motor shield. Do you want me to run that program while everything is stacked or just with the motor on top of the mega?
Attachments
Top view of Motor Shield
Top view of Motor Shield
IMG_3015.JPG (694.68 KiB) Viewed 262 times

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

Re: Motor Shield V2, Wifi shield and Mega

Post by adafruit_support_bill »

What kind of headers are you using and why are the two pins on the end different?

User avatar
Bub7
 
Posts: 9
Joined: Sun Apr 24, 2016 11:23 pm

Re: Motor Shield V2, Wifi shield and Mega

Post by Bub7 »

They are Arduino stackable header kit from Sparkfun (the old model). They are different because when I purchased them I did not realize they were for the older versions of board. At the time I was not using a Mega so I did not bother to waste time by sending the pins back and order new ones. When I realized that I needed a mega for my project I took some header pins not for stacking so I can use those pins necessary for the Motor shield to communicate with the Mega.

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

Re: Motor Shield V2, Wifi shield and Mega

Post by adafruit_support_bill »

What do you get when you run the i2c scanner: http://playground.arduino.cc/Main/I2cScanner

User avatar
Bub7
 
Posts: 9
Joined: Sun Apr 24, 2016 11:23 pm

Re: Motor Shield V2, Wifi shield and Mega

Post by Bub7 »

Am I running the program with the shields stacked or just the Mega and Motor Shield?

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

Re: Motor Shield V2, Wifi shield and Mega

Post by adafruit_support_bill »

With the shield stacked. That is the configuration we are trying to debug, is it not?

User avatar
Bub7
 
Posts: 9
Joined: Sun Apr 24, 2016 11:23 pm

Re: Motor Shield V2, Wifi shield and Mega

Post by Bub7 »

Yea, I just wasn't sure if you wanted to develop a base case before extrapolating. This was the serial output:

Scanning...
I2C device found at address 0x60 !
I2C device found at address 0x70 !
done

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

Re: Motor Shield V2, Wifi shield and Mega

Post by adafruit_support_bill »

OK. So the shield is responding to the right i2c address.

How are you connecting your battery pack to the shield? When you run the stepper test code, do you get any vibration or noise from the motor at all?

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

Return to “Arduino Shields from Adafruit”