Stepper motor doing nothing but jittering

Hello! I'm trying to get a Nema 17 (12v 0.4A 1.8˚ step size) to work with an a4988. I've looked at all sorts of tutorials and I'm getting strange behavior no matter what I try. I feel best about this tutorial and have given it the most attention. I followed it to a T and when I turn on the circuit the motor does nothing but jitter back and forth like it's on cocaine. Not in my christian household! I'd love some help to see if it is a component problem or a me problem.

What I'm using:

  • 47 uF capacitor
  • 12V 2A power source (wall plug)
  • Of course the arduino (Elegoo Uno R3), the Nema 17 stepper motor (12v 0.4A 1.8˚ step size) and an a4988
  • Wiring & code from tutorial above

What I've tried:

  • Adjusted the potentiometer on the a4988 board until the voltage between the potentiometer head and GND was 0.16V (since Current Limit = Vref x 2.5 according to above tutorial)
  • Wired the stepper motor to the a4988 all sorts of ways, but have mostly settled on this: 2B-Green, 2A-Red, 1A-Blue, 1B-Black
  • Changed out the a4988 board for a new one (also adjusted potentiometer)
  • Tried both with and without the AccelStepper package (used code as listed in tutorial)

Main questions:

  • Is my wiring between the motor and the a4988 correct? Pic below. I imagine that the tutorial's wiring is correct, and that I've followed it correctly.
  • Should I use a common ground?
  • Is it possible that my motors are defective?

I hope I'm just missing something stupid and that I didn't get crummy motors (I bought two and they're both behaving the same way). If it's helpful to see a video of its behavior, you can watch it here. The tutorial says "[the code] accelerates the stepper motor in one direction and then decelerates to come to rest. Once the motor makes one revolution, it changes the spinning direction. And it keeps doing that over and over again." That does not at all sound like what I'm seeing.

The "normal" colors are black and green for one coil and red and blue for the other, although there is no "standard", do you have an Ohm meter to verify?
Make sure ALL power is OFF, then connect black - 1A, green - 1B, red - 2A, blue - 2B.
Post a datasheet or part number for the motor. Do you have a Volt meter?

1 Like

Welp I'm an idiot. As you can see in the picture, I had clipped the stepper motor wires and replaced the four female jumper wire ends with four male jumper wire ends. I realized just before you replied that that was probably a bad idea and that the original wire order was probably the right one. I tried it and it worked first try haha. My wiring was similar to what you suggested (with two switched): 2B-Blue, 2A-Red, 1A-Green, 1B-Black. Thanks for replying so quick.

Way to go! Have fun.

1 Like

If the stepper motor is really 12volt, and you use a chopper driver (A4988), then your supply should be a lot higher than 12volt for the driver to work as it should.
Leo..

1 Like

I'm a bit confused by this. I thought the input voltage had to match the motor voltage. Is that not true?

Also, just to note, I do have it working now with the 12v power input. Would it be more powerful or something if I used a power supply with a higher voltage?

Not with a current driver like A4988. These drivers control the current through the coils and they work very similar to a buck converter. With a higher voltage the current control is better - especially with high step rates. If the input voltage is equal to the rated voltage of the stepper no effective current control is possible.
Steppers that are designed to work together with such drivers usually have a much lower rated voltage - maybe 2..4 Volt. In the end the rated voltage is not important in this case - only the rated current.

1 Like

Thanks very much, I hadn't found this information looking around online (probably cuz I use duckduckgo haha). Is it the case that the higher the input voltage, the better current control (up to the maximum limit for the board)? I have access to a 21V power supply for example, is that sufficient?

At least it is better than a 12V supply. The higher the voltage ( within the limits ) the less torque you will lose with higher step rates.

1 Like

This is very helpful, thank you. One more set of questions and I believe I'll be done haha.

What should the current input be from the power supply? I've read some places that having excess current is fine, you should just not have underrated current. I've read all over that the A4988 can deliver 1A per coil (or up to 2A with a heat sink), but with my motor only being rated for 0.4 A, it should only deliver that much (hence the on-board potentiometer), correct? Would that mean that at minimum my power supply should deliver 0.4 A?

Thanks again and sorry for all the newbie questions.

Yes, that's correct. You must adjust the current by means of that potentiometer.

The current of 0.4 A is per coil, so the total current is 0.8A. But because the A4988 works like a buck converter, the current from the power source isn't the same as the current through the coils. The higher the voltage, the less current the supply must deliver. But it's not a problem if the source is able to deliver more current than needed.
The buffer capacitor at the Vin of the A4988 should be at least 100µF.

1 Like

@MicroBahner thanks very much.

I can do greater than 100µF then, yeah? Can I do three 47µF in parallel? That's what I got atm, but if that's bad, I can get a higher rated capacitor.

Greater is no problem. The bigger the better :wink:
I have already done this with 1000µF.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.