Motor shield V2 and stepper issue

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

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
ardufan
 
Posts: 11
Joined: Tue Nov 12, 2013 12:10 am

Motor shield V2 and stepper issue

Post by ardufan »

I have the V2 motor shield with two 5.7V 1A per phase steppers. This is a link to the spec sheet http://media.digikey.com/pdf/Data%20She ... 3Hx18D.pdf

and this is the link to wiring diagram http://media.digikey.com/pdf/Data%20She ... iagram.pdf.

The motors are supplied with 6V from a dc supply and there used for a dual axis solar tracker. When the light sensors receive light which in turn cause the motors to adjust position I hear a motor hum and the shield drops to 2.4V then the power light turns off on the motor shield. One side the of header for M1 & M3 from left to right I have it wired black, yellow, gray, red. The other side is connected in the same fashion. Could this problem be from supplied power or a motor wiring issue?
Last edited by ardufan on Wed Feb 26, 2014 2:40 pm, edited 1 time in total.

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

Re: Motor shield V2 and stepper issue

Post by adafruit_support_bill »

I am supplying the motors with 6V from a dc supply
motor starts to hum and the shield drops to 2.4V and the power light turns off on the motor shield.
Sounds like maybe a power problem. What are the specs for your 6v supply?

ardufan
 
Posts: 11
Joined: Tue Nov 12, 2013 12:10 am

Re: Motor shield V2 and stepper issue

Post by ardufan »

It's an adjustable dc supply that plugs into the wall with two configurable outputs. What other specs would be needed from it? The document for the shield does not specify what is + or - for M1 - 4 is there a proper way to connect beside having one coil connect to each since they are bipolar?
Last edited by ardufan on Wed Feb 26, 2014 2:49 pm, edited 1 time in total.

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

Re: Motor shield V2 and stepper issue

Post by adafruit_support_bill »

We would need to know the current capabilities (usually listed in milliamps - "mA" or amps - "A").
Most adjustable supplies are in the few-hundred mA range and would not have enough power to run 2 1A/phase motors. Since each motor has 2 phases active at a time for most stepping modes, you would need a supply capable of at least 4A to power both motors.

We don't have any 6v supplies, but we have a 5v/4A supply: http://www.adafruit.com/products/1466
That would work with your motors, if you can manage with about 17% less torque than a 6v supply.

ardufan
 
Posts: 11
Joined: Tue Nov 12, 2013 12:10 am

Re: Motor shield V2 and stepper issue

Post by ardufan »

The dc supply's spec is 0-30V 1A. This is only used for initial testing and was planned to be operated off of a 6v 2AH battery. Will the battery be strong enough to keep the shield operating? Is there a wiring diagram for the shield for bipolar motors? I did not see one in the PDF guide.

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

Re: Motor shield V2 and stepper issue

Post by adafruit_support_bill »

The dc supply's spec is 0-30V 1A. This is only used for initial testing and was planned to be operated off of a 6v 2AH battery.
A 1A supply is going to have trouble moving 2 motors of that spec.

Since stepper motors draw pretty much the same power whether they are moving or not, a 6v 2AH beter might last you about 30 minutes - provided that it can handle a 4A discharge rate. You can reduce the power requirements somewhat by using SINGLE step mode. It will run a little rougher and have less torque, but it will only energize one phase at a time.

The wiring for bipolar motors is the same as for unipolar - without the center-tap to ground. From you description, you have them connected right.

ardufan
 
Posts: 11
Joined: Tue Nov 12, 2013 12:10 am

Re: Motor shield V2 and stepper issue

Post by ardufan »

adafruit_support_bill wrote:
The dc supply's spec is 0-30V 1A. This is only used for initial testing and was planned to be operated off of a 6v 2AH battery.
A 1A supply is going to have trouble moving 2 motors of that spec.

Since stepper motors draw pretty much the same power whether they are moving or not, a 6v 2AH beter might last you about 30 minutes - provided that it can handle a 4A discharge rate. You can reduce the power requirements somewhat by using SINGLE step mode. It will run a little rougher and have less torque, but it will only energize one phase at a time.

The wiring for bipolar motors is the same as for unipolar - without the center-tap to ground. From you description, you have them connected right.
That's great I thought I did something wrong. Thank you for all of your help. :D

ardufan
 
Posts: 11
Joined: Tue Nov 12, 2013 12:10 am

Re: Motor shield V2 and stepper issue

Post by ardufan »

Another question for you. There are several gold terminals above where it says adafruit motor shield V2. Are they wired anywhere on the shield? I was looking to put some resistors there to avoid placing a breadboard on top.

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

Re: Motor shield V2 and stepper issue

Post by adafruit_support_bill »

The grid of holes is a prototyping area. None of the holes are connected to anything. You can use these as you wish.

ardufan
 
Posts: 11
Joined: Tue Nov 12, 2013 12:10 am

Re: Motor shield V2 and stepper issue

Post by ardufan »

I was incorrect with the amp hours from my battery. It is 6V 36AH, when running in single or double modes the motors run rough as you described. Trying to run them with micro stepping I still get a hum from the motor and they do not move at all. This is the battery I am using http://www.batterysharks.com/6-Volt-36- ... 6-36nb.htm. Do you have any suggestions to get the motors to run with micro stepping?

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

Re: Motor shield V2 and stepper issue

Post by adafruit_support_bill »

Can you post the code you are using? The maximum speed that the motor can achieve will be lower with microstepping due to the reduced torque. Try running at a lower RPM.

ardufan
 
Posts: 11
Joined: Tue Nov 12, 2013 12:10 am

Re: Motor shield V2 and stepper issue

Post by ardufan »

adafruit_support_bill wrote:Can you post the code you are using? The maximum speed that the motor can achieve will be lower with microstepping due to the reduced torque. Try running at a lower RPM.
Sure here is my code.

Code: Select all

#include <AccelStepper.h>	// include AccelStepper library
#include <Wire.h>                                                  // include Wire library
#include <Adafruit_MotorShield.h>                                  // include Adafruit Motorshield library
#include "utility/Adafruit_PWMServoDriver.h"                       // include Adadfruit PWMServoDriver library
#include <Timer.h>              // include Timer library

Timer t;
int pin = 9;

Adafruit_MotorShield AFMStop(0x60);                                // Default motorshield address

// Defining of the Steppers
Adafruit_StepperMotor *myStepper1 = AFMStop.getStepper(200, 1);    // Vertical Stepper 200 steps per rev
Adafruit_StepperMotor *myStepper2 = AFMStop.getStepper(200, 2);    // Horizontal Stepper 200 steps per rev

void forwardstep1() {                                              // setting microstepping for vertical
  myStepper1->onestep(FORWARD, DOUBLE);
}
void backwardstep1() {  
  myStepper1->onestep(BACKWARD, DOUBLE);
}
void forwardstep2() {                                              // setting microstepping for horizontal
  myStepper2->onestep(FORWARD, DOUBLE);
}
void backwardstep2() {  
  myStepper2->onestep(BACKWARD, DOUBLE);
}

AccelStepper stepper1(forwardstep1, backwardstep1);                // Wrap both steppers in an AccelStepper object
AccelStepper stepper2(forwardstep2, backwardstep2);
	                
//LDR Pin initialization
#define ldrul 0		        	                // LDR Upper Left 
#define ldrur 1		          	                // LDR Upper Right
#define ldrll 2		          	                // LDR Lower Left
#define ldrlr 3		         	                // LDR Lower Right

int ulv,urv;			                        // Upper Left and Upper Right LDR values
int llv,lrv;			                        // Lower Left and Lower Right LDR values
int vdif,hdif;			                        // Vertical difference and Horizontal difference
int avgu,avgl;                                          // Upper and Lower averages
int avgle,avgri;                                        // Left and Right averages

void setup()  
{
Serial.begin(9600);
AFMStop.begin();
stepper1.setMaxSpeed(1000);
stepper1.setAcceleration(500);
stepper2.setMaxSpeed(1000);
stepper2.setAcceleration(500);
pinMode(pin, OUTPUT);
Serial.print(pin, BIN);
t.oscillate(pin, 5000, LOW);
}

void loop()
{
  t.update();
  ulv=analogRead(ldrul);				           // Upper Left LDR Value
  urv=analogRead(ldrur);				           // Upper Right LDR Value
  llv=analogRead(ldrll);				           // Lower Left LDR Value
  lrv=analogRead(ldrlr);				           // Lower Right LDR Value
  Serial.print(ulv);
  Serial.print(urv);
  Serial.print(llv);
  Serial.print(lrv);
  int avgu = (ulv + urv) / 2;				           // average value upper
  int avgl = (llv + lrv) / 2;				           // average value lower
  int avgle = (ulv + llv) / 2;				           // average value left
  int avgri = (urv + lrv) / 2;				           // average value right
  Serial.print(avgu);
  Serial.print(avgl);
  Serial.print(avgle);
  Serial.print(avgri);
  if(avgu > avgl)                                                  // Upper > Lower move CCW
  stepper1.move(1);                                                // Counter Clockwise Rotation
  else                                                             // Upper < Lower move CW
  stepper1.move(-1);                                               // Clockwise Rotation
  stepper1.run();                                                  // Initiate motor movement
  if(avgle > avgri)                                                // Left > Right move CCW
  stepper2.move(1);                                                // Counter Clockwise Rotation
  else                                                             // Left < Right move CW
  stepper2.move(-1);                                               // Clockwise Rotation
  stepper2.run();                                                  // Initiate motor movement
;}                                                                 // end Void Loop



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

Re: Motor shield V2 and stepper issue

Post by adafruit_support_bill »

Code: Select all

stepper1.setMaxSpeed(1000);
1000 RPM is a lot to expect from a 200-step motor with this shield. Especially in microstep mode. These motors are designed for precision, not speed. A few hundred RPM is a more reasonable expectation.

ardufan
 
Posts: 11
Joined: Tue Nov 12, 2013 12:10 am

Re: Motor shield V2 and stepper issue

Post by ardufan »

adafruit_support_bill wrote:

Code: Select all

stepper1.setMaxSpeed(1000);
1000 RPM is a lot to expect from a 200-step motor with this shield. Especially in microstep mode. These motors are designed for precision, not speed. A few hundred RPM is a more reasonable expectation.
I will see how it operates at a much lower speed with microsteps. Thanks for your help again :D

ardufan
 
Posts: 11
Joined: Tue Nov 12, 2013 12:10 am

Re: Motor shield V2 and stepper issue

Post by ardufan »

Bill

I have two limit switches that I want to stop the motors with when they are pressed but the stop command does not do anything. What is the best method to stop a motor as quick as possible with a limit switch?

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

Return to “Arduino Shields from Adafruit”