A4988 Stepper Motor Driver Configuration

I am U.S. based and am attempting to configure an Arduino Uno with an Elegoo A4988 stepper motor driver to control a Nema 17 planetary geared bi-polar stepper motor. According to the URL printed on the back of the driver, the instructions can be found at http://reprap.org/wiki/Stepstick.

I have uploaded the following stepper motor code to the Arduino:
int Index;

void setup() {
pinMode(6,OUTPUT); // Enable
pinMode(5, OUTPUT); // Step
pinMode(4, OUTPUT); // Direction
pinMode(13, OUTPUT); // pin 13 LED

digitalWrite(6, LOW);
digitalWrite(13, LOW); // Turn off LED light on pin 13

}

void loop() {
digitalWrite(4, HIGH);

for(Index = 0; Index < 200; Index++)
{
digitalWrite(5,HIGH);
delayMicroseconds(500);
digitalWrite(5,LOW);
delayMicroseconds(500);
}
delay(1000);

digitalWrite(4,LOW);

for(Index = 0; Index < 200; Index++)
{
digitalWrite(5,HIGH);
delayMicroseconds(500);
digitalWrite(5,LOW);
delayMicroseconds(500);
}
delay(1000);

I then connected the Uno, driver, and 12 volt DC power source according to http://www.instructables.com/id/Drive-a-Stepper-Motor-with-an-Arduino-and-a-A4988-/?ALLSTEPS (see attachment). Even though the Elegoo and instructables instuctions didn’t call for it, I added a 100 uF capacitor in parallel to the motor leads. This was done because some A4988 instructions recommend using the capacitor to protect the A4988 Driver from voltage spikes.

After connecting the driver to the Uno and the power source, but before connecting to the motor, I attempted to limit the current. This was done by turning the potentiometer on the driver fully counterclockwise (based on the Elegoo instructions), turning on the power souce, and then using a multi-meter to check the current, which registered zero. At that point, it smelled like one of the components was hot, and it turned out to be the parallel capacitor, so I turned off the power source.

A couple of questions:

  • Do I need the 100 uF capacitor?
  • The Elegoo instructions (http://reprap.org/wiki/Stepstick) said to turn the potentiometer fully counterclockwise to minimize the current, and then incrementally turn it clockwise until I get the current limit I want. Is that correct? One article I read said to start with the potentiometer turned fully clockwise.
  • Do you have any suggestions on what might be wrong or how to troubleshoot?

I’m re-attaching the Word document since .docx extensions are not allowed.

Procedure to configure and test Stepper with A4988 Driver and Arduino Uno - 20161204.doc (56 KB)

The Pololu A4988 web page has clear and simple connection instructions and instructions for setting the current just by measuring a voltage.

You need to have the motor connected and the multimeter is series with a motor coil and the motor stationary to measure the current BUT BEWARE the quickest way to destroy the A4988 is to disconnect it from the motor while it is powered up.

Do your initial tests with a much slower stepper speed - perhaps delay(500) rather than delayMicroseconds(500).

Post a link to the datasheet for your motor.

...R
Stepper Motor Basics
Simple Stepper Code

  1. Yes, it is useful to have a capacitor between the motor power supply rail.
    -> I guess that you didn't watch the polarity of that capacitor, did you? There is a +/- symbol on the caps which have to be connected according to the polarity!

  2. Unfortunately I only can pre-dict the direction to turn the potentiometer, when you are using an original Pololu motor driver. All clones might behave alike or differently.

The only way to limit the current on a A4988 correctly is to measure the voltage at the reference point.
I suggest to

  • disconnect the motor first (all devices POWERLESS at this moment of disconnecting (and re-connecting later!)
  • measure the voltage at the reference point (have a look where that is on your clone A4988)
  • turn the potentiometer in either direction to adjust the voltage to a value that ensures the right current limit following the ref.voltage / current formula (iii. Vref = phase current / 2.5 = 1.68 / 2.5 = 0.672 V)

I wrote a little instruction how to adjust the current of stepper drivers A4988 and DRV8825. Here you will also read about some specifics on originals and clones and, based on the feedback of another user, that it works best to adjust the current (by adjusting the ref. voltage) having NO motor connected.

The capacitor getting hot is not unexpected, its taking a lot of ripple current.

When you said:

I added a 100 uF capacitor in parallel to the motor leads.

You did mean across the 12V supply leads didn't you? Otherwise I'm not suprised things
got hot!

Thanks for your responses. rpt007, you were right about the polarity of the capacitor. I switched the polarity, set the current limit, connected the motor and power source, and it worked! Thanks also for your detailed instructions for adjusting the current limit. It definitely answered some questions I had. You guys are great!