Adafruit motor shield v1.0

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
hodgeswt
 
Posts: 3
Joined: Sun Jan 25, 2015 6:22 pm

Adafruit motor shield v1.0

Post by hodgeswt »

I am having trouble with my adafruit motor shield v 1.0. I am trying to run the code for testing the motors in Michael Margolis' books "Build an Arduino powered robot". I have the connections to the motors soldered, the power led on the adafruit board turns on, and so does the arduino Leonardo. I am building the 4wd robot. I know the motors operate because I have taken the power from the 5 AA battery pack straight to each of the batteries and they all run.

Question 1: the m1-m4 connections. When looking at m1 (with the letter and number sideways on the left) which is the power to the motor, and which is ground? Same with m2, m3, m4.

Question 2: What are ways to troubleshoot the adafruit board?

Here is the code I am using. It compiles without problem:

Code: Select all

/*******************************************
* MotorTest4wd.ino
* Initial motor test for 4WD 
* robot rotates clockwise 
*  (Left motors driven forward, right backward)

* Michael Margolis 24 July 2012
********************************************/
const int LED_PIN = 13;
const int speed = 60; // percent of maximum speed

#include <AFMotor.h>  // adafruit motor shield library (modified my mm)
AF_DCMotor Motor_Left_Front(4, MOTOR34_1KHZ);   // Motor 4 
AF_DCMotor Motor_Right_Front(3, MOTOR34_1KHZ);  // Motor 3
AF_DCMotor Motor_Left_Rear(1, MOTOR12_1KHZ);    // Motor 1 
AF_DCMotor Motor_Right_Rear(2, MOTOR12_1KHZ);   // Motor 2

int pwm;

void setup()
{
  pinMode(A
  Serial.begin(9600);
  blinkNumber(8); // open port while flashing. Needed for Leonardo only  
   
  // scale percent into pwm range (0-255) 
  pwm= map(speed, 0,100, 0,255);  
  Motor_Left_Front.setSpeed(pwm);
  Motor_Right_Front.setSpeed(pwm);
  Motor_Left_Rear.setSpeed(pwm);
  Motor_Right_Rear.setSpeed(pwm);
}

// run over and over
void loop()
{  
  Serial.println("rotate cw");
  Motor_Left_Front.run(FORWARD);
  Motor_Left_Rear.run(FORWARD);
  
  Motor_Right_Front.run(BACKWARD);
  Motor_Right_Rear.run(BACKWARD);

  delay(5000); // run for 5 seconds
  Serial.println("stopped");
  Motor_Left_Front.run(RELEASE);  // stop the motors
  Motor_Right_Front.run(RELEASE);
  Motor_Left_Rear.run(RELEASE);  // stop the motors
  Motor_Right_Rear.run(RELEASE);

  delay(5000); // stop for 5 seconds
}

// function to indicate numbers by flashing the built-in LED
void blinkNumber( byte number) {
   pinMode(LED_PIN, OUTPUT); // enable the LED pin for output
   while(number--) {
     digitalWrite(LED_PIN, HIGH); delay(100);
     digitalWrite(LED_PIN, LOW);  delay(400);
   }
}

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

Re: Adafruit motor shield v1.0

Post by adafruit_support_bill »

When looking at m1 (with the letter and number sideways on the left) which is the power to the motor, and which is ground? Same with m2, m3, m4.
There is no "power" and "ground". It is an H-bridge output, so it is reversible.
What are ways to troubleshoot the adafruit board?
That depends on what the trouble is. You have not explained that. The guide is always a good place to start:
https://learn.adafruit.com/adafruit-motor-shield/faq

User avatar
hodgeswt
 
Posts: 3
Joined: Sun Jan 25, 2015 6:22 pm

Re: Adafruit motor shield v1.0

Post by hodgeswt »

Okay, I have gotten the motors working...briefly. Then my arduino Leonardo (r3) blew up! I now have no digital output (or analog input) for the Leonardo! The motors work briefly on my Uno, then stop. The Uno still has digital output and analog input. Is it possible that the motor shield blew up my Leonardo?

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

Re: Adafruit motor shield v1.0

Post by Franklin97355 »

Is it possible that the motor shield blew up my Leonardo?
More likely you had power applied incorrectly and the motor load was involved in the failure. Did you follow the instructions here? https://learn.adafruit.com/adafruit-motor-shield.

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

Re: Adafruit motor shield v1.0

Post by adafruit_support_bill »

If you post photos of the soldering and connections to the shield we can look for any problems.

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

Return to “Arduino Shields from Adafruit”