Go Down

Topic: Motors were working - now they're not. Have I burned my driver/chip? (Read 1 time) previous topic - next topic

stevenjryall

Hi there - thanks for reading!

So I have an arduino uno with an adafruit motor shield running two stepper motors and a servo. The steppers are 28BYJ-48 5V DC. The servo is a micro servo.

I am controlling this through a) my hacked TV remote sending hex codes to an IR receiver and b) a processing sketch sending serial information.

My problem still occurs regardless of whether I'm powering the system through either USB or external power.

The problem is that this entire system used to work perfectly. Now it doesn't. At all. Literally within a single minute it went from working completely to not responding in all cases.

The servo responds by moving to angle 100 when I start up the system - but won't respond to anything after that. At one point, only the servo would respond - now...nothing.

I haven't changed anything, I've re-uploaded the same code a few times. I'm at a loss. I don't have good enough income to just buy a new arduino or motor shield, so I'm really hoping I haven't blown the system.

I've attached some pictures and will c + p the code below.

Has this ever happened to you? If so, what was the problem and how did you solve it? Have I blown my equipment somehow?

NOTE: Most of the code used in this project depicts how the system will react to input from either processing or my TV remote, so there's a lot of repeating information, and a lot of it won't seem relevant.

Code: [Select]
#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_MS_PWMServoDriver.h"
#include "IRremote.h"
#include <Stepper.h>
#include <Servo.h>

const int STEPS = 32;   // Number of steps per revolution of Internal shaft
int receiver = 6; // Signal Pin of IR receiver to Arduino Digital Pin 6
int dir;
int angle = 0;

#define UP 0xFE609F
#define DOWN 0xFEE01F
#define LEFT 0xFE827D
#define RIGHT 0xFEC23D
#define OPEN 0xFEE21D
#define CLOSED 0xFE847B
#define speedOneHundred 0xFE8877
#define speedTwoHundred 0xFE48B7

Adafruit_MotorShield AFMS = Adafruit_MotorShield();

Adafruit_StepperMotor *stepperLR = AFMS.getStepper(200, 1);
Adafruit_StepperMotor *stepperUD = AFMS.getStepper(200, 2);
Servo servo;


IRrecv irrecv(receiver);    // create instance of 'irrecv'
decode_results results;     // create instance of 'decode_results'

void setup()
{
 Serial.begin(9600);
 irrecv.enableIRIn(); // Start the receiver

 AFMS.begin();  // create with the default frequency 1.6KHz
 //AFMS.begin(1000);  // OR with a different frequency, say 1KHz

 stepperLR->setSpeed(200);
 stepperUD->setSpeed(200);
 servo.attach(10);

 servo.write(100);


}

void loop()
{
if (irrecv.decode(&results)) // have we received an IR signal?

 {
   Serial.println(results.value);
   Serial.println(results.value,HEX);
   irrecv.resume();
if(results.value == UP){
 dir = 1;
 stepperUD->step(50,FORWARD,DOUBLE);
}

else if(results.value == 4294967295 && dir == 1){
 stepperUD->step(50,FORWARD,DOUBLE);
}

else if(results.value == DOWN){
 dir = -1;
 stepperUD->step(50,BACKWARD,DOUBLE);
}

else if(results.value == 4294967295 && dir == -1){
 stepperUD->step(50,BACKWARD,DOUBLE);
}
   
  else if(results.value == LEFT){

dir = 2;
stepperLR->step(100,FORWARD,DOUBLE);
     
     
   }
   else if (results.value == 4294967295 && dir == 2)
{
stepperLR->step(50, FORWARD, DOUBLE);
}
   else if(results.value == RIGHT){

     dir = -2;
     stepperLR->step(100,BACKWARD,DOUBLE);
   
   }
   else if (results.value == 4294967295 && dir == -2)
{
stepperLR->step(50, BACKWARD, DOUBLE);
}
else if(results.value == OPEN){
 dir = 0;

 servo.write(100);
}else if(results.value == CLOSED){
 dir = 0;

 servo.write(75);
}
   else { dir = 0; }
 }

 else if(Serial.available() > 0){
   char buttonPress = Serial.read();

   if(buttonPress == '0'){

     stepperUD->step(5,FORWARD,DOUBLE);
     
   }
   else if(buttonPress == '1'){

     stepperUD->step(5,BACKWARD,DOUBLE);
     
   }
   else if(buttonPress == '2'){

     stepperLR->step(5,FORWARD,DOUBLE);
     
   }
   else if(buttonPress == '3'){

     stepperLR->step(5,BACKWARD,DOUBLE);
     
   }
   if(buttonPress == '4'){

     stepperUD->step(50,FORWARD,DOUBLE);
     
   }
   else if(buttonPress == '5'){

     stepperUD->step(50,BACKWARD,DOUBLE);
     
   }
   else if(buttonPress == '6'){

     stepperLR->step(50,FORWARD,DOUBLE);
     
   }
   else if(buttonPress == '7'){

     stepperLR->step(50,BACKWARD,DOUBLE);
     
   }
   else if(buttonPress == 'a'){

     stepperLR->setSpeed(50);
     
   }
   else if(buttonPress == 'b'){

     stepperLR->setSpeed(100);
     
   }
   else if(buttonPress == 'c'){

     stepperLR->setSpeed(200);
     
   }
   else if(buttonPress == 'd'){

     stepperUD->setSpeed(50);
     
   }
   else if(buttonPress == 'e'){

     stepperUD->setSpeed(100);
     
   }
   else if(buttonPress == 'f'){

     stepperUD->setSpeed(200);
     
   }
   else if(buttonPress == 'g'){

     stepperUD->step(50,FORWARD,DOUBLE);
     stepperLR->step(50,FORWARD,DOUBLE);
     stepperUD->step(50,BACKWARD,DOUBLE);
     stepperLR->step(50,BACKWARD,DOUBLE);
     
   }
   else if(buttonPress == 'h'){

     stepperUD->step(100,FORWARD,DOUBLE);
     stepperLR->step(50,FORWARD,DOUBLE);
     stepperUD->step(100,BACKWARD,DOUBLE);
     stepperLR->step(50,BACKWARD,DOUBLE);
     
   }
   else if(buttonPress == 'i'){

     stepperLR->step(500,BACKWARD,DOUBLE);
     stepperUD->step(100,FORWARD,DOUBLE);
     stepperUD->step(100,BACKWARD,DOUBLE);
     stepperUD->step(100,FORWARD,DOUBLE);
     stepperUD->step(100,BACKWARD,DOUBLE);
     stepperUD->step(100,FORWARD,DOUBLE);
     stepperUD->step(100,BACKWARD,DOUBLE);
     stepperUD->step(100,FORWARD,DOUBLE);
     stepperUD->step(100,BACKWARD,DOUBLE);
     stepperLR->step(500,FORWARD,DOUBLE);
     
   }
   else if(buttonPress == 'j'){
                               

 servo.write(100);
     
   }
    else if(buttonPress == 'k'){

     

 servo.write(75);
   

     
    }
 }
 }


jremington

Please read the post "How to use this forum" and follow the directions. Edit your post to add code tags.

stevenjryall

Done that. Apologies. And thanks for the heads up!

An UPDATE: I have tried my Uno with another project and everything seems fine. So I don't think I've bust my controller...

PaulS

Quote
So I don't think I've bust my controller...
So, you've either damaged the motor controller, or the batteries you are using to power the motors are dead (or the power supply is).
The art of getting good answers lies in asking good questions.

stevenjryall

But it happens also when I don't use batteries and use USB, so perhaps it's the shield...

I've only JUST noticed that one of the stacking headers is a little wobbly. Could this be shorting it out?

stevenjryall

So I just resoldered it and it worked for a little while and then cut out again.

I'm using two 28BYJ-48 motors. Are they drawing too much current and causing the motor shield to shut down to prevent itself from overheating?

It works and then doesn't. If I leave it for a while, it may work again. So it's functional - seems to me like it's shutting itself down to protect itself.

stevenjryall

Well now the green light won't turn on indicating power. At all. I'm going to try again a little later, and maybe some tomorrow, but I think something is definitely very wrong with it.

I don't know whether it's the way I've soldered it or what, but I'm quite annoyed I've spent money on a product that would break so easily. Perhaps it's because I'm not a professional but should it have really broken THIS easily? I haven't done anything majorly wrong.

Go Up