Motor Shield V2 Not Working

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
stephanofernandes
 
Posts: 8
Joined: Thu Jun 19, 2014 3:35 pm

Motor Shield V2 Not Working

Post by stephanofernandes »

Hi,

Previously in my project I was using the motor shield V1 and everything was working properly until I had to replace this shield by the V2.

I took all the components off that were attached to the Arduino and left only the motor shield and the motor attached to terminals M3 and M4. I am running the example code of the library and the motor does not move. The motor is supplied by a 12 V external power supply. The Power LED of the motor shield board is on and I tested it without the VIN jumper, powering the Arduino trough my USB, and with the VIN jumper disconnecting the USB cable. It didn't work in any of the scenarios.

That's the motor (12V and 0.33A) that I am using: https://www.sparkfun.com/datasheets/Rob ... 011-25.pdf

And that's the code that I am running on the arduino:

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"

// 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);
}
Could you please guys give me any suggestion of what I can do? The wire connections are right since they are pretty much the same as the motor shield V1 and I replicated all of them.

Thank you,
Last edited by adafruit_support_bill on Thu Jun 19, 2014 4:04 pm, edited 1 time in total.
Reason: please use the </> button when submitting code. press </>, then paste your code between the [code] [/code] tags.

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

Re: Motor Shield V2 Not Working

Post by adafruit_support_bill »

The code compiles and uploads without error?
What do you see in the Serial Monitor when it is running?

Post clear photos of the front and back of the board.

stephanofernandes
 
Posts: 8
Joined: Thu Jun 19, 2014 3:35 pm

Re: Motor Shield V2 Not Working

Post by stephanofernandes »

The code compiles and uploads without error.

I attached some pictures of the board. Please let me know if they are good enough.
board.png
board.png (850.77 KiB) Viewed 355 times

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

Re: Motor Shield V2 Not Working

Post by adafruit_support_bill »

I need to see the soldering on the analog pin headers and power headers too.

What kind of Arduino do you have this connected to?

stephanofernandes
 
Posts: 8
Joined: Thu Jun 19, 2014 3:35 pm

Re: Motor Shield V2 Not Working

Post by stephanofernandes »

It is an Arduino MEGA ADK. I am sorry but the resolution of my pictures won't be much better than the ones that I posted, I only have a mobile phone here and the camera focus it's not the best but. However, I believe the soldering is very good, I carefully checked all points ...

Is there anything you suggest me to do?

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

Re: Motor Shield V2 Not Working

Post by adafruit_support_bill »

It looks like you do not have the SDA and SCL header pins installed. I suspect that is because your Mega ADK is a pre-R3 model and does not have those pins. Since these are the i2c pins used to communicate with the shield, you will need to add jumpers from the alternate locations (pins 20 & 21) on your Mega.

stephanofernandes
 
Posts: 8
Joined: Thu Jun 19, 2014 3:35 pm

Re: Motor Shield V2 Not Working

Post by stephanofernandes »

Hi,

It worked! But there is one more thing that I would like to ask you.

In my project I am already using the SDA and the SDL pins on the Arduino to communicate with a LCD screen, using the library Adafruit_RGBLCDShield.h.

I imagine that I cannot just connect the SDA and the SDL pins of the LCD screen and of the motor shield all together on pins 20 and 21, right?

If not, is there a way to change the communication pins of the motor shield or of the LCD screen?

Thank you,

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

Re: Motor Shield V2 Not Working

Post by adafruit_support_bill »

You should be able to use both on the same i2c bus. As long as they have different i2c addresses, there should be no problem. If you do have an address conflict, this page describes how to change the address on the motor shield. https://learn.adafruit.com/adafruit-mot ... ng-shields

stephanofernandes
 
Posts: 8
Joined: Thu Jun 19, 2014 3:35 pm

Re: Motor Shield V2 Not Working

Post by stephanofernandes »

Hi,

I was able to connect the LCD display and the motor shield but now I have another problem.

When I power the Arduino trough my USB port the motor runs very smooth but when I unplug the USB and power my whole system system with a 12 V power supply, which also powers the motor, the motor starts vibrating a lot creating a very loud noise due this vibration in the structure that it is installed.

Do you know what might be causing this?

When I use the Motor Shield V1, with exactly the same circuit, it does not happen. It is something related with this version of the motor shield.

Tks,

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

Re: Motor Shield V2 Not Working

Post by adafruit_support_bill »

If you are powering by USB, the motors will get 5v. If you are powering by 12v, the motors will get 12v. (with the V1 motor shield, the motors would get about 10.6v). At 12v, the motors will have more torque and create more vibration with each step. You can try using INTERLEAVED or MICROSTEP to reduce the vibration.

stephanofernandes
 
Posts: 8
Joined: Thu Jun 19, 2014 3:35 pm

Re: Motor Shield V2 Not Working

Post by stephanofernandes »

First of all, thank you for your support and the prompt replies.

I don't think the vibration is related to this difference of the voltage level between 5V and 12V because even when I set the speed of the motor to a very low value, which means reduce the power that is applied to the coils, I can still observe an abnormal vibration.

I tried to use microsteps but the speed is dramatically reduced. I am working with a speed value of 100 in the code.

Do you think there is something else I could check?

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

Re: Motor Shield V2 Not Working

Post by adafruit_support_bill »

I don't think the vibration is related to this difference of the voltage level between 5V and 12V because even when I set the speed of the motor to a very low value, which means reduce the power that is applied to the coils, I can still observe an abnormal vibration.
That is not the case for stepper motors. Reducing the speed only reduces the step rate. The power to the coils is identical.

stephanofernandes
 
Posts: 8
Joined: Thu Jun 19, 2014 3:35 pm

Re: Motor Shield V2 Not Working

Post by stephanofernandes »

So, it seems that the best solution is to power the motor with 5V, and the only way to do this is applying 5V to the power terminal, right? I am asking you that because I imagine there is not a way to regulate this voltage by any command in the code.

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

Re: Motor Shield V2 Not Working

Post by adafruit_support_bill »

Assuming it is voltage dependent, that should work. You could also use a different power supply for the Arduino. The Arduino can run on anything from 7v-12v. But I recommend sticking to the lower end of that range (~7v-9v) - especially when powering shields and other electronics. At 12v, the Arduino voltage regulator will get quite warm.

The 9v adapters we have in the store would give you about 1.6v less that you get with 12v and the V1 motor shield.

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

Return to “Arduino Shields from Adafruit”