Simple Mistake: stepper failure

Hi guys

I’ve been working on some steppers and I made the same mistake TWICE, by hardware and by software

The system I’m working is:
Arduino UNO
A4988
Stepper Motor of 1.8 degrees/step NEMA 17
12V/5A power source

The problem is:
During my tests, I accidentally turned the system, with everything correctly setup, except for the
STEP input (from the arduino to the A4988)

My Stepper1 stopped working then and even bruned one driver.

I had two motors… then I started working on the code with the other stepper and I accidentally changed the stepperPin variable, instead of the other variable I was working.

Now my two motors are apparently dead.
Has this ever happened to anyone here? Is there a salvation for my steppers?

The codes I was supposed to upload:

int dirPin = 2;
int stepperPin = 3;
int vel = 5  ; //values from 1 to 10
int x = (40000-3500*vel)/10;

void setup() {
 pinMode(dirPin, OUTPUT);
 pinMode(stepperPin, OUTPUT);
}
 void step(boolean dir,int steps){
 digitalWrite(dirPin,dir);
 delay(50);
 for(int i=0;i<steps;i++){
   digitalWrite(stepperPin, HIGH);
   delayMicroseconds(x);
   digitalWrite(stepperPin, LOW);
   delayMicroseconds(x);
 }
}    
void loop(){
 step(false,1600);
 delay(500);
 step(true,1600);
 delay(500);
}

The code I uploaded, damaging the stepper:

int dirPin = 2;
int stepperPin = 5;
int vel = 5  ; //values from 1 to 10
int x = (40000-3500*vel)/10;

void setup() {
 pinMode(dirPin, OUTPUT);
 pinMode(stepperPin, OUTPUT);
}
 void step(boolean dir,int steps){
 digitalWrite(dirPin,dir);
 delay(50);
 for(int i=0;i<steps;i++){
   digitalWrite(stepperPin, HIGH);
   delayMicroseconds(x);
   digitalWrite(stepperPin, LOW);
   delayMicroseconds(x);
 }
}    
void loop(){
 step(false,1600);
 delay(500);
 step(true,1600);
 delay(500);
}

Thanks a lot!

ssraf: During my tests, I accidentally turned the system, with everything correctly setup, except for the STEP input (from the arduino to the A4988)

Did you ever have the motors working properly?

I'm not sure that your code would have caused any problem - apart from the motor not rotating. As far as I can see your code just sends the step instructions to the wrong pin.

I suspect you had a wiring problem.

Make a pencil drawing showing clearly how you had everything wired and post a photo of the drawing.

...R

The problem is: During my tests, I accidentally turned the system, with everything correctly setup, except for the STEP input (from the arduino to the A4988)

Do you mean "accidentally turned the system off" ?

This would have left the A4988 powered from the Arduino pin which could easily burn it or the Arduino pin out.

Add 4k7 resistor in series is one solution, as is using opto isolators or driving the step pin open-drain with a pull-up resistor to the A4988's 5V supply.

Was the A4988 5V supply different to Arduino's then?

I checked the connections and they were ok (I successfully used the setup earlier and before that)

I checked the motor coils and apparently nothing was damaged

I took the stepper to a friend's house who has another system (he uses Tip122) and he kinda re-started the stepper. I put it back in my system and it worked!

I'm not sure what happened there and I'm not willing to spend another Driver to find that out!

Thanks for the help anyway : )