I have been trying to use the example code to run a robotzone planetary gear DC motor. The motor is able to run when directly connected to a supply and the serial monitor shows the correct serial.println()'s but power is not being supplied to the motor no matter which motor port I have it connected to (I checked with a voltmeter). I did not solder the ports myself, only the headers. Are there any ideas on what could be going wrong?
/*
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 <Adafruit_MotorShield.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);
// Select which 'port' M1, M2, M3 or M4. In this case, M1
Adafruit_DCMotor *myMotor = AFMS.getMotor(1);
// You can also make another motor on port M2
//Adafruit_DCMotor *myOtherMotor = AFMS.getMotor();
void setup() {
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println("Adafruit Motorshield v2 - DC Motor test!");
if (AFMS.begin()) { // create with the default frequency 1.6KHz
// if (!AFMS.begin(1000)) { // OR with a different frequency, say 1KHz
Serial.println("Could not find Motor Shield. Check wiring.");
while (1);
}
Serial.println("Motor Shield found.");
// Set the speed to start, from 0 (off) to 255 (max speed)
myMotor->setSpeed(255);
myMotor->run(FORWARD);
delay(3000);
// turn on motor
// myMotor->run(RELEASE);
}
void loop() {
uint8_t i;
Serial.print("tick\n");
myMotor->run(FORWARD);
for (i=0; i<255; i++) {
myMotor->setSpeed(i);
delay(10);
}
for (i=255; i!=0; i--) {
myMotor->setSpeed(i);
delay(10);
}
Serial.print("tock\n");
myMotor->run(BACKWARD);
for (i=0; i<255; i++) {
myMotor->setSpeed(i);
delay(10);
}
for (i=255; i!=0; i--) {
myMotor->setSpeed(i);
delay(10);
}
Serial.print("tech\n");
myMotor->run(RELEASE);
delay(10);
}
It's hard to tell from the angle of the photo, but make sure you don't have the VIN jumper installed when using a separate power supply (the batteries) for the motors.
Have you measured the power at the power connector (i.e. is it getting power from the batteries)?
There is nothing on the VIN jumper that I can take off. I can touch an led to the top of the power connector and it turns on. This is not true for the motor connectors. The specs of the motor are attached. Thank you!
Motor startup current is essentially the same as the stall current until the rotor starts moving. That motor has a stall current of 4.9A which is considerably more than the 3A peak rating of the drivers on the shield. It is very possible that the driver is burned out.
Try your LED test (without the motor) on some of the other motor channels. The damage might be limited to the M1 channel.
Just to confirm, do I need to buy both a new shield and driver, or can I bypass the burnt-out driver with two of the DRV8871's? Thank you for explaining!
The DRV8871 is a standalone single-channel motor driver. It is not compatible with the shield or the shield library. You control it with 2 GPIO pins (PWM capable if you need speed control).