RAMPS A4988 Stepper Driver not working

I purchased this driver
http://www.ebay.com/itm/like/201084529309?lpid=82
datasheet for A4988 attached
schematic of RAMPS stepstick attached

I connected the motor power (+12V) to VMOT
+5V to Vdd
GND to GND
MS1,MS2, & MS3 to GND
RST & SLP to +5V
EN(NOT) to GND
Stepper motor is this one:

I connect RED & GRN of coil -1 to 1A, 1B
YEL & BLU of coil -2 to 2A, 2B

I ran this example sketch

int dirPin = 8;
int stepperPin = 7;
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(800);
   digitalWrite(stepperPin, LOW);
   delayMicroseconds(800);
 }
}
void loop(){
 step(true,1600);
 delay(500);
 step(false,1600*5);
 delay(500);
}

from here:
http://www.geeetech.com/wiki/index.php/A4988_Stepper_Motor_Driver_Carrier_Board

and nothing happens. I can see the STEP clock and DIR changing. I have 12V on VMOT, 5V on Vdd,
the MSX pins are grounded and RST & SLP are tied high.
No voltage changing on the motor pins.
The stepper motor was tested with a DK motor driver and the Adafruit Motor Shield example sketch "multistepper test"

I have no idea what's wrong. I tried turning off the motor power and reversing the motor winding polarity with no effect.
Appreciate any help to get it working.
NOTE: I should mention that my motor power supply is a variable power supply with current control and independent voltage and current displays so I can see if the voltage drops or the current goes up. The motor voltage never dropped and the motor current was 0.00 the whole time. I never saw any current whatsoever on the display. Also, the current control circuitry in the power supply has a relay that you can hear "click" whenever the current reaches the limit set by the knob. Never heard any click
and the red "Limit" led never came on. For all practical purposes, the driver is either not enabled or it is dead and if it is dead it couldn't be because it is blown because it never turned on (no current was ever measured).

a4988_DMOS_microstepping_driver_with_translator.pdf (371 KB)

498px-StepStick.Schematic.png

Do you know if the way you have the MS pins connected gives microstepping or single stepping? I have Pololu A4988s and they default to single stepping whereas the BigEasydriver (using the same A4988) defaults to microstepping.

I think you need to connect Reset and sleep to each other. I don't connect them to anything else.

This is code that I use for testing. It is much slower than yours.

Also note that the delay after the HIGH is short, and can probably be deleted altogether. It is not part of the motion timing.

// testing a stepper motor with a Pololu A4988 driver board or equivalent
// on an Uno the onboard led will flash with each step
// as posted on Arduino Forum at http://forum.arduino.cc/index.php?topic=208905.0

byte directionPin = 9;
byte stepPin = 8;
int numberOfSteps = 100;
byte ledPin = 13;
int pulseWidthMicros = 20;  // microseconds
int millisbetweenSteps = 25; // milliseconds


void setup() 
{ 

  Serial.begin(9600);
  Serial.println("Starting StepperTest");
  digitalWrite(ledPin, LOW);
  
  delay(2000);

  pinMode(directionPin, OUTPUT);
  pinMode(stepPin, OUTPUT);
  pinMode(ledPin, OUTPUT);
  
 
  digitalWrite(directionPin, HIGH);
  for(int n = 0; n < numberOfSteps; n++) {
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(pulseWidthMicros);
    digitalWrite(stepPin, LOW);
    
    delay(millisbetweenSteps);
    
    digitalWrite(ledPin, !digitalRead(ledPin));
  }
  
  delay(3000);
  

  digitalWrite(directionPin, LOW);
  for(int n = 0; n < numberOfSteps; n++) {
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(pulseWidthMicros);
    digitalWrite(stepPin, LOW);
    
    delay(millisbetweenSteps);
    
    digitalWrite(ledPin, !digitalRead(ledPin));
  }
  
}

void loop() 
{ 

}

...R

Edit to add last few lines of code that got lost in copying --- apologies to anyone confused. ...R

Thanks. I'll give that a try when I get home. Since I never saw any current measured and the chip never got hot I am assuming it is some simple configuration thing .

How did you adjust the idle current?

polymorph:
How did you adjust the idle current?

What idle current?

...R

See the resistor in the lower left that says "trim"? That sets the current.

That's the one I couldn't adjust with no current.

// testing a stepper motor with a Pololu A4988 driver board or equivalent
// on an Uno the onboard led will flash with each step
// as posted on Arduino Forum at http://forum.arduino.cc/index.php?topic=208905.0

byte directionPin = 9;
byte stepPin = 8;
int numberOfSteps = 100;
byte ledPin = 13;
int pulseWidthMicros = 20;  // microseconds
int millisbetweenSteps = 25; // milliseconds


void setup() 
{ 

  Serial.begin(9600);
  Serial.println("Starting StepperTest");
  digitalWrite(ledPin, LOW);
  
  delay(2000);

  pinMode(directionPin, OUTPUT);
  pinMode(stepPin, OUTPUT);
  pinMode(ledPin, OUTPUT);
  
 
  digitalWrite(directionPin, HIGH);
  for(int n = 0; n < numberOfSteps; n++) {
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(pulseWidthMicros);
    digitalWrite(stepPin, LOW);
    
    delay(millisbetweenSteps);
    
    digitalWrite(ledPin, !digitalRead(ledPin));
  }
  
  delay(3000);
  

  digitalWrite(directionPin, LOW);
  for(int n = 0; n < numberOfSteps; n++) {
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(pulseWidthMicros);
    digitalWrite(stepPin, LOW);
    
    delay(millisbetweenSteps);
    
    digitalWrite(ledPin, !digitalRead(ledPin));
  }

@Robin,
Where's the "void loop() {} " ?

I would try to eliminate the possibility that the power supply is the issue (relay needs to turn on as stated ). You have got to have another P.S. available sitting around.

Also do as you have stated to others about providing schematics and pictures of your setup (heed your own advice).

The power supply is a 24V variable , current controlled Lab supply. (one of two that I have) and I think you misunderstood my comment about the relay. I said that when the current reaches the limit set by the knob, the red Over limit Led lights and you can hear the relay click as it goes into Over-current limit mode. That sound can be used to detect overcurrent when you are not looking directly at the voltage display or the current display on the power supply. I just meant it gets your attention. Since I never saw any current on the display (and yes I tried the other ps and no difference) I concluded that the driver cannot be blown because it has
not drawn any current. Therefore , there must be another explanation.
Attached is a photo of the circuit.
Also attached is a schematic that shows the pins on the breakout bd.

RAMPS A4988 SCHEMATIC.jpg

raschemmel:
@Robin,
Where's the "void loop() {} " ?

Very sorry about that. A few lines fell off the bottom during copying. Loop() is empty, anyway. I have corrected my earlier post.

See the resistor in the lower left that says "trim"? That sets the current.

@polymorph, that does not adjust the idle current. It adjusts the max current through the motor coils.

@raschemmel - on my boards you can adjust the max current with a voltmeter - there is a test point. Look at the Pololu webpage for their A4988. That's where I got all the advice and it all seems to be correct and comprehensive. It seems (from another Thread here) that the max can be set to very low levels so that might be a reason for no action. If in doubt set the pot in the middle :slight_smile:

Have you had a chance to check if reset and sleep are connected?

...R

You are correct, I should not have said idle. That is a different setting not available on the A4988.

From the picture provided it looks like you have not hooked up VDD to the driver board (a pretty busy breadboard so hard to tell).

Also the examples for steppers in the IDE can be used for testing Pulse and Direction stepper boards by just using 2 pins in the call to the function.

P.S. see Pololus website about having a capacitor near Vmot

The Vdd is a small red 22 ga solid copper insulated (red) jumper hidden by the other jumpers. I have some 1970' s style solid pre-cut jumpers (the kind sold in a kit with about a dozen different sizes) . I'll replace every thing with those and repost the photo so it will be easier to see everything. I'll add a cap for VMOT but with no switching on the motor pins at this point it doesn't matter.

@raschemmel, I suggest you start over and follow the instructions on the Pololu A4988 web page if (as it seems) your driver board is the same as theirs.

My code (now that you have all of it :)) works for me using their wiring diagram and their boards

...R

I followed the same wiring. As I said I am going to replace the flexible jumpers with stiff solid short jumpers tonight. I don't see how that will make a difference

If any of the wires to the stepper was intermittent, it could blow the driver.

It's beginning to look like there is a problem with your driver or it is different in some way from the Pololu version.

I would try connecting enable to GND and sleep and reset to +5 to see if that helps. (But you have probably already tried that).

...R

Edit to add ...
Lookng back, I'm not clear if your power supply is variable voltage or variable current or both? If it is variable current, what have you it set to?

...R

Both. I set the current to about 150mA but with no current to measure that just means the knob is at the midpoint.

raschemmel:
Both. I set the current to about 150mA but with no current to measure that just means the knob is at the midpoint.

Have you checked the setting of the current limiting on the driver board? Might it be set too low?

I would be inclined to turn the power supply current up to 1 amp and the voltage to (say) 12v and leave the stepper board to do the regulating. My usual test situation draws motor power from a large 12v lead acid battery.

...R