Did I break my motor shield?

Totally new to the Arduino world, and I have a standard understanding of C++ from college. I'm building the RFID Pet Feeder (http://www.instructables.com/id/RFID-pet-feeder/) that I've seen mentioned on here in a few other threads, but none of them seem to have the problem I'm having.

I have an Arduino Duemilanove with ATmega328 with the Adafruit Motor Shield v2 to drive a CD-ROM drive. I disassembled the drive down to the bones and had the motor running from the two wires running directly to the motor. I modified the code (http://www.writtensound.com/arduino/cat_feeder7.pde) to remove the button sensors that detect an open or closed door and run the motors for a set amount of time (1.5 seconds just to test it) instead.

I tested the board using the AFMotor > MotorTest demo, and it worked at first, to where I could watch the drive just constantly open and close at a variable speed. Knowing that worked, I assembled the components from the instructions on the RFID Pet Feeder page, using the Arduino USB port as my power source -- figuring the CD drive motor couldn't use THAT much voltage to drive it. Once all the components were assembled, the motor stopped working on any of the four screw-down terminals, regardless of changing the code to match the pins to which it was attached on the Motor Driver. I'm new enough that I don't know what to check with my voltmeter to see what might be the problem, so I'm kind of stuck with (as far as I know) a non-functioning device.

Please ask any questions, and I'll try to answer them. I could even upload some pictures of the way I have the breadboard set up if it helps. I mainly want to know what I might have done wrong, especially if I fried the board.

There is too much detail here to deal with using just words. You need to draw a schematic with pen and paper , take a photo of it with your cell phone . Take a photo of you hardware and post the photos along with your code posted using the CODE TAGS “#”
tool button. We also need a SITREP on the hardware, (SITUATION REPORT) stating what is still working and what is “broken”.
If the motor shield is ok (test it with a different motor) we need to know that. Get a meter and measure the resistance across your motor leads. I don’t know if that will help but it may tell us something. Did you ever smell anything like burning motor ?
Remove the motor from the assembly and test it on a different output of the motor shield. (with nothing connected to the shaft if possible). Take voltage measurements across the motor when you test it.

Alright, here goes.

The motor, by itself, reads 11.4 ohms when unpowered. I never smelled anything burning, but I wondered if I might have shorted something on the board by connecting the wrong wire somewhere by accident.

I attached a schematic (hopefully it’s legible). There are three wires soldered together running to the 5V pin – the IR sensor, the On/Off switch for switching to “Manual mode”, and the push button that runs the motor when the box is in “Manual mode”. All of the grounds run to the right side of the breadboard, where they’re tied into a common soldered ground.

Something else that made me think something was wrong with the board was that I wasn’t even able to get the IR sensor to give any legitimate readings.

I haven’t attached the RFID reader yet because I wanted to diagnose the other problems first.

I ran the MotorTest app as shown here, and it didn’t work by itself – but it did run before I attached the other components.

// Adafruit Motor shield library
// copyright Adafruit Industries LLC, 2009
// this code is public domain, enjoy!

#include <AFMotor.h>

AF_DCMotor motor(3);

void setup() {
  Serial.begin(9600);           // set up Serial library at 9600 bps
  Serial.println("Motor test!");

  // turn on motor
  motor.setSpeed(200);
 
  motor.run(RELEASE);
}

void loop() {
  uint8_t i;
  
  Serial.print("Speeding up forward... ");
  
  motor.run(FORWARD);
  for (i=0; i<255; i++) {
    motor.setSpeed(i);  
    delay(10);
 }
 
 Serial.print("Slowing down forward... ");
 
  for (i=255; i!=0; i--) {
    motor.setSpeed(i);  
    delay(10);
 }
 
 Serial.print("Stopping for one second...");
 
 motor.run(RELEASE);
 delay(1000);

 Serial.print("Speeding up backward... ");

  motor.run(BACKWARD);
  for (i=0; i<255; i++) {
    motor.setSpeed(i);  
    delay(10);
 }
 
 Serial.print("Slowing down backward... ");
 
  for (i=255; i!=0; i--) {
    motor.setSpeed(i);  
    delay(10);
 }
  

  Serial.print("Stopped. ");
  motor.run(RELEASE);
  delay(1000);
}

Here’s the code for the Pet Feeder itself:

#include <Adafruit_MotorShield.h>
#include <SoftwareSerial.h>
#include <AFMotor.h>

const int MODE_pin=16;
const int MANUALOPEN_pin=17;
const int IR_pin = 4;   
const int IR_cutoff=200;
int printed_already;

//RF reader is connected to RX pin 0 for serial input

const int OPEN=1;
const int CLOSE=0;
int door_state;
int val; 

const int set_time1=5000;
long startMillis;
AF_DCMotor motor(3, MOTOR12_64KHZ); 
SoftwareSerial mySerial(2, 3);

int incomingByte = 0; 

void setup() {
  Serial.begin(9600);           
  mySerial.begin(9600);
  Serial.println("Cat feeder!");
  motor.setSpeed(200);
  digitalWrite(16, LOW);
  digitalWrite(17, LOW);
  door_state=CLOSE;
  printed_already=0;
}

void loop() {
  byte valr;
  if(digitalRead(MODE_pin)==LOW) //switch set to manual
  {
    delay(10);
    if(digitalRead(MODE_pin)==LOW)//debouncing
    {
     if((printed_already==0) || (printed_already==2))
     {
     Serial.println("MODE = manual");
     printed_already=1;
     }
      if(digitalRead(MANUALOPEN_pin)==HIGH) //toggle button is pressed
      {
        delay(10);
        if(digitalRead(MANUALOPEN_pin)==HIGH)//debouncing
        {  
          if(door_state==OPEN)  
          {
            Serial.println("trying to close now ...");
            MoveDoor(CLOSE);//close the door
          }
          else if(door_state==CLOSE)  
          {
            Serial.println("trying to open now ...");
            MoveDoor(OPEN);//close the door
          }          
        }
      }
    }
  }
  else if(digitalRead(MODE_pin)==HIGH) //switch set to automatic
  {  
  delay(10);
  if(digitalRead(MODE_pin)==HIGH) //debouncing
    {
    if((printed_already==0) | (printed_already==1))
     {
      Serial.println("MODE = automatic");
      printed_already=2;
     }  
    if((RFID() == 1) && (door_state==CLOSE))//RF activated
      {
      MoveDoor(OPEN);
      }
    else //RF not active, we may have to close the door
      {
      if(door_state==OPEN)//DOOR is open
        {
        if(analogRead(IR_pin)<IR_cutoff)//there is no cat
          {
          startMillis = millis();
          Serial.println("starting timer...");
          //while nothing happens, the timer runs out
          while(millis()-startMillis<set_time1) 
            {
            if(millis()%500<5)
            Serial.println(analogRead(IR_pin));  
            if(analogRead(IR_pin)>=IR_cutoff)
              {
              Serial.println("Cat detected. Resetting timer ...");
              delay(1000);
              startMillis = millis();
              }
            }  
        
          if(analogRead(IR_pin)<IR_cutoff) 
          //RF is still not activated, there really is no cat
            {
            Serial.println("Timer ran out.");  
              while(mySerial.available())
              valr = mySerial.read();//empty the buffer
            MoveDoor(CLOSE); //close the door
            }
          }
        }  
      }
    }
  }
}  
    
    
void MoveDoor(int openclose)
    {
    int cat_alert;
    cat_alert=0;  
    if(openclose==CLOSE) //close the door!
      {
      motor.run(BACKWARD); 
      delay(2000); //run the motor for 1.5 seconds to close the door  
      while (cat_alert==0)
         {if(analogRead(IR_pin)>IR_cutoff)
           {delay(20);
           if(analogRead(IR_pin)>IR_cutoff)
             {
             cat_alert=1;  
             motor.run(RELEASE);
             openclose=OPEN;
             }
           }
         }  
      
       //if there is no cat
       //if there is, door opens in next if-statement
        if(cat_alert==0)
          {
          motor.run(RELEASE);
          door_state=CLOSE;
          Serial.println("it's closed.");
          }
      }
    
    if(openclose==OPEN) //open the door!
      { 
      motor.run(FORWARD); 
      delay(2000); //run the motor for 1.5 seconds to open the door
      motor.run(RELEASE); 
      door_state=OPEN;
      Serial.println("it's open.");
      }

}    
    
int RFID() 
  {
  byte i = 0;
  byte val = 0;
  byte code[6];
  byte checksum = 0;
  byte bytesread = 0;
  byte tempbyte = 0;
  int result = 0;

  if(mySerial.available()) {
    result=1;
    if((val = mySerial.read()) == 0x02) { 
      bytesread = 0; 
      Serial.println("I read it");
      while (bytesread < 12) {// read 10 digit code + 2 digit checksum
        if(mySerial.available()) { 
          val = mySerial.read();
          if((val == 0x0D)||(val == 0x0A)||(val == 0x03)||(val == 0x02)) {  
            break; // stop reading
          }

          // Do Ascii/Hex conversion:
          if ((val >= '0') && (val <= '9')) {
            val = val - '0';
          } else if ((val >= 'A') && (val <= 'F')) {
            val = 10 + val - 'A';
          }

          // Every two hex-digits, add byte to code:
          if (bytesread & 1 == 1) {
            // make some space for this hex-digit by
            // shifting the previous hex-digit with 4 bits to the left:
            code[bytesread >> 1] = (val | (tempbyte << 4));

            if (bytesread >> 1 != 5) {// If we're at the checksum byte,
              checksum ^= code[bytesread >> 1];// Calculate the checksum... (XOR)
            };
          } else {
            tempbyte = val; // Store the first hex digit first...
          };
          bytesread++; // ready to read next digit
        } 
      } 

      // Output to Serial:

      if (bytesread == 12) {  // if 12 digit read is complete
        Serial.print("5-byte code: ");
        for (i=0; i<5; i++) {
          if (code[i] < 16) mySerial.print("0");
          Serial.print(code[i], HEX);
          Serial.print(" ");
        }
        Serial.println();
        Serial.print("Checksum: ");
        Serial.print(code[5], HEX);
        Serial.println(code[5] == checksum ? " -- passed." : " -- error.");
        if(code[5] == checksum)
        result=1;
        Serial.println();
      }
      bytesread = 0;
    }
  }
  return result;
}