Can’t Get A4988 Stepper Motor Driver to Work using Arduino

I have been stuck on this issues for some time and think that I might have done something to the A4988 that I ordered (like fried it :frowning: ). I hope someone here can look at my setup and Arduino code and determine if it’s me or the A4988.

I am trying to test the A4988 with a small 5V stepper motor (the same one here adafruit.com/products/858) and an Arduino Micro. A schematic and photo of my setup as well as the Arduino code (adapted from Joel Bartlett’s code for running SparkFun’s EasyDriver) can be found at below. When everything is turned on and running, the stepper motor does nothing. Thank you all for your help.


/*************************
Joel Bartlett
SparkFun Electronics
December 27, 2012

This code controls a stepper motor with the 
EasyDriver board. It spins forwards and backwards
***************************/
int dirpin = 2;
int steppin = 3;

void setup() 
{
pinMode(dirpin, OUTPUT);
pinMode(steppin, OUTPUT);
}
void loop()
{

  int i;

  digitalWrite(dirpin, LOW);     // Set the direction.
  delay(100);


  for (i = 0; i<4000; i++)       // Iterate for 4000 microsteps.
  {
    digitalWrite(steppin, LOW);  // This LOW to HIGH change is what creates the
    digitalWrite(steppin, HIGH); // "Rising Edge" so the easydriver knows to when to step.
    delayMicroseconds(1000);      // This delay time is close to top speed for this
  }                              // particular motor. Any faster the motor stalls.

  digitalWrite(dirpin, HIGH);    // Change direction.
  delay(1000);


  for (i = 0; i<4000; i++)       // Iterate for 4000 microsteps
  {
    digitalWrite(steppin, LOW);  // This LOW to HIGH change is what creates the
    digitalWrite(steppin, HIGH); // "Rising Edge" so the easydriver knows to when to step.
    delayMicroseconds(1000);      // This delay time is close to top speed for this
  }                              // particular motor. Any faster the motor stalls.

}

Hello.

Thank you for the detailed post (the schematic, picture, and code are very helpful)! That is a five-lead unipolar stepper motor, which means it cannot be connected in a bipolar configuration and therefore, unfortunately, is not compatible with the A4988.

Also, it looks like you aren’t doing anything with the reset pin. You need to pull/drive it high to bring the board out of the reset state. One way to do this is to connect it to the adjacent sleep pin, as described on the product page and shown in the minimal wiring diagram.

Separately, it looks like there are some discolored spots on the A4988 driver IC, which could be a sign of damage. I suggest you disconnect the stepper motor, fix the reset problem, and then use a multimeter to look at the driver outputs as it steps slowly. If you see the voltage changing appropriately as it tries to step, then the driver is probably fine.

- Ben

You cannot drive a five-lead unipolar stepper motor in a true bipolar configuration because that fifth (red) lead is shorting the centers of the two coils together. If you really want to use it as a bipolar motor, you need to open it up and sever that connection between the two coils.

It is not obvious to me what problems this extra connection might cause, but I think it is not worth trying to debug your system further until you are using an appropriate motor.

- Ben

Thank you for such a detailed write-up of the problem (I really appreciate the videos). I am not sure what is causing your trouble, but I suspect it is a connection issue somewhere. The reason for connecting Reset to Sleep is because that is one convenient way of pulling the Reset pin high. Since that is not working for you, can you try alternate ways of pulling that pin high? What happens if you connect Reset directly to VCC? What if you connect both Reset and Sleep directly to VCC? What if you control Reset (and Sleep) dynamically from one of your Arduino’s I/O pins? Can you use a multimeter to look at the voltage on the Reset and Sleep pins in your two configurations?

- Ben

Hello,
I’m actually having the same issue with the A4988 AND the A4988 Black Edition. I too find that when i re-power my microcontroller, with RESET connected to VCC directly, or to SLP, the driver doesn’t power up and draws no current. The only way i can get it to power up is to touch one lead of a DMM to the SLP pin, with the other pin connected to GND.

Is there a way around this or can this device only be used if it is “reset” after power up?

thanks,

ali

Hello, Ali.

It sounds like your problem could be a different issue. How do you have your DMM set up? If it is configured to measure voltage, just probing some nodes should not affect the circuit unless there is a bad connection.

We are going to see if we can duplicate anon45745741’s issue here.

- Ben

I’m sorry to hear you damaged your driver!

We did our best to duplicate your setup, anon45745741, and were unable to replicate the problem. It worked as expected both with a single 9V power supply to the system and with the stepper motor driver and Arduino micro powered separately. More generally, we tried applying various combinations of motor and logic power in various sequences to see if we could get the driver to start in some fault/error state, but it always started up with the outputs active as expected.

Can you look closely at your driver and see if any of the components might have been knocked off or partially dislodged by your over-sized soldering iron. Another thing you might check is the 5V output from your Arduino in your two setups (is it really 5V in both cases?).

Ultimately, if your new drivers exhibit the same behavior as your now damaged one did, I think you should simplify your setup by removing the Arduino (you can still use it’s 5V regulator for logic power if that is convenient) and just try applying logic and motor power in various sequences while checking to see if your stepper motor is holding its position.

- Ben

Hello Ben,
I have my DMM setup as usual; one probe into GND/COM and another into the voltage input.

i see your response to the other contributor to this thread.
have you looked into the issue i noted?

ali

These drivers do not need to be reset after power-up. The behavior you are describing is not normal, and as I said in my previous post, if probing with your multimeter in voltage mode is affecting the circuit, you very likely have a bad connection somewhere. You mention having multiple drivers; if you swap in a different driver, does it behave the same way? Can you tell me about your setup and post some pictures?

- Ben

My a4988 also started playing up. I was successfully running a test with using an arduino. Everything was fine. Took a break and then when I tried it again it was no longer powering the arduino. My a4988 had a voltage regulator. At first, I was powering up the arduino using the 5v output from a4988 regulator. But before connecting the arduino, I measured the voltage across that pin even when it was jumpered to the VDD. It was 5 volts alright. So I went ahead and used that 5 volt to power the arduino.

Everything was okay. BTW, I was powering the motor with a 12 volt battery.

On the third try however, the arduino failed to turn on. So I measured the voltage again on the 5v and VDD line and found out that it had dropped to 1.6v!! So I thought the regulator got fried!?? So I disconnected the Vdd line and just measured the 5v pin. But it was just 5 volt!!! It seems that the Vdd line is causing the voltage drop?? Is there any reason for this or did I just fried my new a4988??

The A4988 does not come with a voltage regulator. It requires two power sources at different voltages to operate, one for the motor and one for the logic. Did you add a voltage regulator to the A4988? If so, the added regulator must not be functioning properly.

Here is the a4988 with voltage regulator!

pololu.com/catalog/product/1183

But i dont think the problem is with the regulator at all because the voltage on the pins 5v is indeed showing up as 5v. Only when it is jumpered to Vdd does it then sink down to 1.6v even when no stepper motor is connected.

Please ignore everything I said. The problem was in the connection in the cheap breadboard that I bought. When I transfered all the components in my old breadboard, it worked.

Thank you anyway for your response.

My setup is extremely simple. I’m following the diagram posted on the product page exactly, on a bread board:
pololu.com/catalog/product/1182

I’m connecting SLEEP and RESET as indicated in the diagram, with a jumper.

I have tried this with multiple A4988; namely, 1 x normal and 2 x BLACK edition also; same issue on all.

I’m using two power supplies (separate one for the motor).

I still find that some sort of “reset” needs to happen before the driver starts functioning.
All of the drivers i’ve tried beging functioning normally after i “hard reset” the board by touching the red-probe of my DMM to the sleep pin, with the black-prob connected to the microcontroller’s ground, which is also connected to the ground of my motor power supply.

Any advice?
Have you tested the exact circuit from the documentation on a breadboard recently with your latest A4988 boards?

ali

That setup does not specify a particular microcontroller. The details of those connections matter, as does the code you are running.

A multimeter set to measure voltage is not a valid way to perform “hard reset” (any more than touching part of the circuit with your finger would be). Do you see that a multimeter should not affect a properly constructed circuit in the way you describe?

Yes, and no other customers are reporting problems like this (aside from the person who started this thread, and that is very likely a different issue). Given this, if all of your drivers are exhibiting this same problem, it is a near certainty that the issue is with your setup.

I cannot give you advice (beyond a generic “look for a bad connection somewhere in your wiring or on your breadboard”) without knowing exactly what you are doing. Please post some pictures of your setup and tell me as much about your setup as you can. For example, what are your exact connections? What is your stepper motor? What are your power supplies? What is your control source? What code are you running? What is your current limit set to? If you have a connection issue, some pictures might help me identify it. Knowing what you’re doing might help me suggest some ways to simplify the setup so we can home in on the cause of the problem.

- Ben