Motos shield V2 doesn't work...

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

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
clemmi
 
Posts: 8
Joined: Sun Aug 11, 2013 12:21 pm

Motos shield V2 doesn't work...

Post by clemmi »

I had used the V1 shield successfully with 2 steppers but I need to control 3 steppers so I got two of the new V2 shields.
I' using the library testing sketch "Stacking Test" as well as other simple testing sketches that worked on my V1 shield.

On my Arduino Mega the motors have erratic movements even with a blank program, just "setup" and "loop".
How does the V2 shield uses digital pins 20-21 as described on the web page? do I have to manually connect them?

On my Arduino Uno the motors have stepping flapping motions with the "Staking Test" sketch or just with "myStepper1->step(200,HIGH, DOUBLE);"
It should give 360 degree turn with 200 steps but it moves just a bit.

I'm using the Adafruit 5 Amp 12 V power supply on the board round power input with the jumper in.
The motor cables are red/yellow and green/blue as I did on my shield v1 that worked.

I have no idea what to do from here on...
Thank you.

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

Re: Motos shield V2 doesn't work...

Post by adafruit_support_bill »

How does the V2 shield uses digital pins 20-21 as described on the web page? do I have to manually connect them?
What version Mega are you using. If it is R2 or earlier, you need to connect jumpers from pins 20 & 21 to SDA & SCL as noted in the FAQ.

User avatar
clemmi
 
Posts: 8
Joined: Sun Aug 11, 2013 12:21 pm

Re: Motos shield V2 doesn't work...

Post by clemmi »

Thank you. Jumping SDA-Digital 20 and SCL-Digital 21 made the steppers to be quiet with an empty loop. Good.
But, when I use:
myStepper1->step(200, FORWARD, DOUBLE);
delay(200);
myStepper1->step(200, BACKWARD, DOUBLE);
delay(200);
the motor turns always clockwise and erratic portions of the circle.
I expected to go one turn CW and one turn CCW.
the same with the other 2 steppers.
"step" is in the keyword list and it worked with the v1 version of the shield.
How should be use it with this version 2?
Thanks!

fumpel
 
Posts: 5
Joined: Wed Aug 28, 2013 2:34 am

Re: Motos shield V2 doesn't work...

Post by fumpel »

just to be sure... you got the library for the V2 of the shield? The old one won't work...

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

Re: Motos shield V2 doesn't work...

Post by adafruit_support_bill »

Post your full code (Use the "Code" button and paste your code between the tags.)
And tell us what kind of steppers you are using.

User avatar
clemmi
 
Posts: 8
Joined: Sun Aug 11, 2013 12:21 pm

Re: Motos shield V2 doesn't work...

Post by clemmi »

Yes, I got the V2 library Adafruit_MotorsShield including the "utility/Adafruit_PWMServoDriver.h".
This is the code "Stepper Test" from the from the "examples" folder in the library..

I commented out the original loop code and added the added the lines "myStepper1->step(200, FORWARD, DOUBLE);" to get a simple movement as I did with my previous shield v1.
The motors move two times forward, never CCW, using HIGH and LOW does the same as FORWAD/BACKWARD.
The movements are not ~360 degrees and varies in amount of movement (~ 1/4, ~1/2, etc. parts of a full turns).

The motors move in various way with the commented code which I can't say if it's right or not, but I need a simple control.
"onestep" requires a 'for loop' that makes the code much longer and harder to use to control all the movements.
I placed the jumper on the bottom shield and all three steppers move. As i said previously I added the jumps to Digital 20 and 21.

I'm using three "Canary Stepper Motors" which look like those on the Adafruit web page and they worked fine with the previous shield v1.
I must either be using the "step" function improperly, there may a need for other connections or the shields are defective.
I'm using two Adafruit Motor Shield V2 for Arduino with the stacking headers and I tried with my Mega and Uno Arduino boards and other code variations that worked before with the v1 shield.

Please advice. - thank you.

Code: Select all

/* 
This is a test sketch for the Adafruit assembled Motor Shield for Arduino v2
It won't work with v1.x motor shields! Only for the v2's with built in PWM
control

For use with the Adafruit Motor Shield v2 
---->	http://www.adafruit.com/products/1438
*/

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

Adafruit_MotorShield AFMSbot(0x61); // Rightmost jumper closed
Adafruit_MotorShield AFMStop(0x60); // Default address, no jumpers

// On the top shield, connect two steppers, each with 200 steps
Adafruit_StepperMotor *myStepper2 = AFMStop.getStepper(200, 1);
Adafruit_StepperMotor *myStepper3 = AFMStop.getStepper(200, 2);

// On the bottom shield connect a stepper to port M3/M4 with 200 steps
Adafruit_StepperMotor *myStepper1 = AFMSbot.getStepper(200, 2);

// And a DC Motor to port M1
Adafruit_DCMotor *myMotor1 = AFMSbot.getMotor(1);

void setup() {
  while (!Serial);
  Serial.begin(9600);           // set up Serial library at 9600 bps
  Serial.println("MMMMotor party!");

  AFMSbot.begin(); // Start the bottom shield
  AFMStop.begin(); // Start the top shield
   
  // turn on the DC motor
  // myMotor1->setSpeed(200);
  // myMotor1->run(RELEASE);
}

int i;

void loop() {
myStepper1->step(200, FORWARD, DOUBLE);
delay(200);

myStepper1->step(200, BACKWARD, DOUBLE);
delay(200);

myStepper2->step(200, FORWARD, DOUBLE);
delay(200);

myStepper2->step(200, BACKWARD, DOUBLE);
delay(200);

myStepper3->step(200, FORWARD, DOUBLE);
delay(200);

myStepper3->step(200, BACKWARD, DOUBLE);
delay(200);
 }

/*
    myMotor1->run(FORWARD);
    for (i=0; i<255; i++) {
    myMotor1->setSpeed(i);  
    myStepper1->onestep(FORWARD, INTERLEAVE);
    myStepper2->onestep(BACKWARD, DOUBLE);
    myStepper3->onestep(FORWARD, MICROSTEP);
    delay(3);
 }
  for (i=255; i!=0; i--) {
    myMotor1->setSpeed(i);  
    myStepper1->onestep(BACKWARD, INTERLEAVE);
    myStepper2->onestep(FORWARD, DOUBLE);
    myStepper3->onestep(BACKWARD, MICROSTEP);
    delay(3);
 }
  myMotor1->run(BACKWARD);
   for (i=0; i<255; i++) {
    myMotor1->setSpeed(i);  
    myStepper1->onestep(FORWARD, DOUBLE);
    myStepper2->onestep(BACKWARD, INTERLEAVE);
    myStepper3->onestep(FORWARD, MICROSTEP);
    delay(3);
 }
   for (i=255; i!=0; i--) {
    myMotor1->setSpeed(i);  
    myStepper1->onestep(BACKWARD, DOUBLE);
    myStepper2->onestep(FORWARD, INTERLEAVE);
    myStepper3->onestep(BACKWARD, MICROSTEP);
    delay(3);
 }

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

Re: Motos shield V2 doesn't work...

Post by adafruit_support_bill »

I don't have your exact configuration here. It would take me a while to put one together. But I notice that you don't set the motor speeds anywhere in your sketch.

User avatar
clemmi
 
Posts: 8
Joined: Sun Aug 11, 2013 12:21 pm

Re: Motos shield V2 doesn't work...

Post by clemmi »

I added:
myStepper1->setSpeed(25);
myStepper2->setSpeed(25);
myStepper3->setSpeed(25);
and also tried in the loop:

Code: Select all

 
     for (i=200; i<255; i++) 
     {
        myStepper1->onestep(FORWARD, DOUBLE);
        delay(20);
        myStepper1->onestep(BACKWARD, DOUBLE);
        delay(20);
        myStepper2->onestep(FORWARD, DOUBLE);
        delay(3);
        myStepper2->onestep(BACKWARD, DOUBLE);
        delay(20);     
        myStepper3->onestep(FORWARD, DOUBLE);
        delay(20);
        myStepper3->onestep(BACKWARD, DOUBLE);
        delay(20);
      }
All three motors move in sequence always CW by flapping a few seconds and then advancing about 1.5 of a turn, erratically.
Changing the value of the speed doesn't seem to change the speed.
I don't seem to be able to control the steppers motors as I was with shield v1 which worked great except only for 2 motors.
I can send you a video if possible.

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

Re: Motos shield V2 doesn't work...

Post by adafruit_support_bill »

To help isolate the problem, try it with one motor/one shield. If it works that way, keep adding motors and shields until it fails.

User avatar
clemmi
 
Posts: 8
Joined: Sun Aug 11, 2013 12:21 pm

Re: Motos shield V2 doesn't work...

Post by clemmi »

Well, I decided to check all connections and found that the motors were connected wrong.
The red cable and the green are a pair, not the red and yellow as they seem to be connected in the web site pictures.
I should had used my ohmmeter like I did originally with my v1 shield.

'step' and 'oneStep' work fine but "setSpeed" doesn't seem to make any difference.
Either adding them in 'setup' on in the 'loop'.
Are they supposed to change the speed? I tried 2, 10, 25, 500 and the speed seems to be the same.

The 200 steps does a 360 turn as it should.
Thank you all the help an I apologize for my mistake.

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

Re: Motos shield V2 doesn't work...

Post by adafruit_support_bill »

Good that you got the wiring problem diagnosed. I'll look into the setSpeed() issue.

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

Re: Motos shield V2 doesn't work...

Post by adafruit_support_bill »

I tested with a 200-step motor at 10-400 RPM. I do see a proportional speed change from 10-100 RPM. Faster than that it seems to top out. Still looking into the cause.

User avatar
clemmi
 
Posts: 8
Joined: Sun Aug 11, 2013 12:21 pm

Re: Motos shield V2 doesn't work...

Post by clemmi »

The shields seems to be working fine now as the previous V1 but with 3 steppers motors.
I don't need high speeds just 1 and 25-50 it's enough for the work I 'm doing.
Thanks for all your help!
Do I understand correctly that except for pins SCL and SDA all the others pins are available
at the top of the shields (I'm using the Mega)?

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

Re: Motos shield V2 doesn't work...

Post by adafruit_support_bill »

Do I understand correctly that except for pins SCL and SDA all the others pins are available
at the top of the shields (I'm using the Mega)?
SCL and SDA are connected to A4 and A5, so you would need to cut those traces on the back of the shield to use those pins. Also, if you are using the servo headers, these are connected to digital pins 9 and 10.

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

Return to “Arduino Shields from Adafruit”