A4988 suddenly stops working

Hi ,
I was testing my motors and drivers , and I made the circuit but nothing happened . So I took the A4988 out of the breadboard and placed another one , it was working . After testing a bit , only 1 driver out of 3 works . The one that was OK and worked when I tested doesn't work .
Is that a software problem or hardware ?
(I have read similar posts they weren't the same)
(After a while the a4988 is a little bit warmer than room temperature but not hot . maybe 2 % warmer than room temperature , but not working at all)
and here's my schematic and code :

//simple A4988 connection
//jumper reset and sleep together
//connect  VDD to Arduino 3.3v or 5v
//connect  GND to Arduino GND (GND near VDD)
//connect  1A and 1B to stepper coil 1
//connect 2A and 2B to stepper coil 2
//connect VMOT to power source (9v battery + term)
//connect GRD to power source (9v battery - term)


int stp = 13;  //connect pin 13 to step
int dir = 12;  // connect pin 12 to dir
int a = 0;     //  gen counter

void setup() 
{                
  pinMode(stp, OUTPUT);
  pinMode(dir, OUTPUT);       
}


void loop() 
{
  if (a <  200)  //sweep 200 step in dir 1
   {
    a++;
    digitalWrite(stp, HIGH);   
    delay(10);               
    digitalWrite(stp, LOW);  
    delay(10);              
   }
  else 
   {
    digitalWrite(dir, HIGH);
    a++;
    digitalWrite(stp, HIGH);  
    delay(10);               
    digitalWrite(stp, LOW);  
    delay(10);
    
    if (a>400)    //sweep 200 in dir 2
     {
      a = 0;
      digitalWrite(dir, LOW);
     }
    }
}

add an analog in for battery voltage.

I would use a power supply, not battery. for all testing. the few minutes of life you get should be saved for your application.

if you are wired for full that that code should make one revolution.

the schematic did not come over, have a picture of the setup ?

Hi
my 'schematic' is the commented parts on the code , no actual schematic :frowning: I just found this sample code here and used it .
I'm using a (regulated) power supply set to 9v ( 0.5 A ) and I guess that's more than enough for a stepper with 100+ ohms of resistance .
The code makes one counter-clockwise revolution followed by a clockwise .

If the drivers are actually damaged it may be due to a loose connection between the driver and the motor. Breaking that connection (or allowing it to break) while the system is powered is very bad for the driver.

I can't imagine any software problem that could damage the driver if it is properly connected.

A pencil drawing of the connections is much more reliable than a text description. It is very easy to misunderstand a description. Just post a photo of the pencil drawing. There is a good connection diagram on Pololu's A4988 webpage. By the way it is also good to have a pencil drawing of the ACTUAL connections in case they differ from the INTENDED connections.

...R
stepper motor basics

I also tried using them with your code and the connections here , on the polulu website but it doesn't work .
I guess it's the loose connections (I guess these boards are REALLY fragile if a motor getting disconnected destroys them)
I also remember taking the motor away unaware of this fact .

but is there any tests to make sure the board is destroyed before I buy another one ? (like , testing the coil outputs to see if there is any electricity there ?)

I think if you wire the A4988 correctly and the motor does not move with simple code you can be fairly sure it is damaged.

I don't think the problem is so much that the boards are fragile as that there is a lot of uncontrolled energy released when the connection to the motor coil is broken so you get a very high voltage spike.

...R

Motive power involves field energy. When the current gets turned off, the field collapses and usually there's at least a diode in the motor driver shunting it off. But that's when the circuit is together, otherwise where does it go?

For small motors, a ULN2803 can be used as a driver. It has protection built-in. It might or not need a heatsink, each channel is 500 mA up to 50V max (200 mA 12V easy) and IIRC (anyone?) you use 4 to 6 channels to run a stepper.
The ULN2803 has 7 channels, there's an 8 channel ULN28XX that costs a lot more.

Perhaps FETs would be better, then you'd have to wire protection circuitry as well.
I might be getting lazy, I ordered 4050's for voltage leveling. They're protected too.

ULN2003 is 7 channels, ULN2803 is 8 channels.