Stepper Motor Nema 17 does not work with A4988

I have 2 Stepper Motors, a NEMA 23 and a NEMA 17. NEMA 23 works perfectly, I use a DM542 driver. But, my problem comes with the NEMA 17 that uses a driver of Pololu A4988

I have everything well connected in my Arduino MEGA. As it shows the image of the official page of Pololu:

The stepper motor seems to be drilled, I play with the number of steps and speed, sometimes moves a little but drilled, and sometimes nothing moves (stays in the same place, drilled). With “drilled” I mean that the Stepper motors tries to move but does not do anything.

I use 3 codes to try and with no one works. Use this one who is using with my NEMA 23 (NEMA 23 works well, fluid):

include <Stepper.h>

const int stepsPerRevolution = 1600;  
Stepper motor1(stepsPerRevolution, 50, 51);
#define motor1_ena 52

int stepsPerRevolutionNema17 = 200;
Stepper motor2(stepsPerRevolutionNema17, 46, 47);
#define motor2_ena 48

void setup() {
  // initialize the serial port:
  Serial.begin(115200);
  Serial.setTimeout(0);
  
  motor1.setSpeed(200); //RPM - MAX: 370
  pinMode(motor1_ena, OUTPUT);

  motor2.setSpeed(60); //RPM - MAX: 370
  pinMode(motor2_ena, OUTPUT);
  
}

void loop() {
  // step one revolution  in one direction:
  Serial.println("clockwise");
  motor1.step(stepsPerRevolution);
  motor2.step(stepsPerRevolutionNema17);
  delay(500);

  // step one revolution in the other direction:
  Serial.println("counterclockwise");
  motor1.step(-stepsPerRevolution);
  motor2.step(-stepsPerRevolutionNema17);
  delay(500);
}

I also use these two codes of this website (as I said before, it is also drilled):
https://lastminuteengineers.com/a4988-stepper-motor-driver-arduino-tutorial/

My connection is the following:

NEMA 17
EN > 48
MS1 > NONE
MS2 > NONE
MS3 > NONE
RST > SLP
STEP > 46
DIR > 47

VMOT > + 24 V POWER SUPPLY (110 V AC to 24 V DC)
GND > - 24 V POWER SUPPLY (110 V AC to 24 V DC)

2B > 1st line coming out of the Stepper Motor
2A > 2nd line coming out of the Stepper Motor
1A > 3rd line coming out of the Stepper Motor
1B > 4th line coming out of the Stepper Motor

VDD > 5V Arduino
GND > GND Arduino

Curious fact: Before I misconnect the Stepper Motor outputs (1A, 1B, 2A, 2B) and I burn one of my A4988 drivers since connecting the Power Supply.

But, now I have them connected well, as it shows this image (Nothing has been burned, so it’s a good sign):

I do not know, but, I think the problem is the code.

Note: I change the Stepper Motor that I use when I burn the A4988 driver, just in case.

To test reduce the parameter:
const int stepsPerRevolution = 1600;
for smaller values.
const int stepsPerRevolution = 200; for example.

RV mineirin

1 Like

Already did. I test with 200, 400, 600, 800, 1600
I also changed the speeds.

Try change 2A with 2B,

1 Like

I did, at that time I was burn the driver. Well…

At that time I had it in this way:

2B connected in 2B
2A connected in 1B
1b connected in 2A
1A connected in 1A

I am afraid to change those cables, because all the images show it connected with the same order with which they come out.

Make sure that all power is off when You change connections to the stepper. Else You’ll burn stuff…
Use a DMM to find out which stepper wires go to the same coil. Swapping a coil 1 and a coil 2 cable is hopeless.

1 Like

Another thing, remember that the 1600 is Nema 23, that works. If you notice there is another call “StepsPerrevolutionNema17” that has a value of 200.

That’s right, I do not connect it being on, and if I do it first, I connect everything and at the end 5V and then GND.

I did not understand this, do you explain it better, please?

I think what @Railroader meant was simply reverse the wires to ONE coil. So, 2A to 2B, and 2B to 2A. Leave the other coil alone. Then try again.

Mixing the wires from 1 and 2 is not what you should try.

Turn off the stepper power, and the 5 volt when changing connections. Disconnecting grounds makes no sense, don’t do it.

I just did it and nothing happened. The Stepper Motor does not move.

Know that NEMA only tells about the mechanical interface to mount the stepper. NEMA this or that tells nothing about the capability of the motor, nothing about current, nothing about max speed, nothing about max acceleration.

It is a typical 3D printer stepper motor, NEMA 17, 1A, 24V. It is compatible with that driver. But, maybe my problem is the polarity of the motor cables, because the NEMA 23 that if it works, specifies the colors that I have to connect to the driver. Nema 17 cables are all black, even though I do it with order, like that of the image. So I do not know how to identify if the cable is correct or not.

As I said, I follow the order of this image, because the Stepper motor is of the same type and the cables are equal (only without colors in my case).

Note: From that previous image only look at the right part, as it does not have the connections on the left side.

There’s no standard for stepper cable colours or order of the cables.
Use the ohm function to identify the cables belonging to the same coil.
Running low amp steppers remember to adjust the driver current. Else the stepper will get overheated. Way too low current will still move the stepper around if there’s no load.

I change the position of all, that is, 1A and 1B changes it to 2A and 2B. I think it’s the same as, I do not know (tell me if you know, please). But. I am playing with the values, the engine moves, but bad, it is not fluent as it should be a normal engine, it seems that steps are skipped.

I test it with 1600, 1200, 800, 600, 400 and 200 steps with 60 RPM (the same thing happens, the engine seems to vibrate).

I think the problem is the driver. I put a DM542 and everything works well, with the same pins.

Note for the future: Never buy a A4988 driver (the cheap at the end is expensive).

But, the stepper motor became very hot, I do not know why. Any suggestion?

Did you select the correct current at your DM542 for your smaller stepper?
Steppers may become very hot, they can withstand much more heat than your fingers. But if the current is too high, they will overheat. If you do not need the full torque, it’s better to select a lower current.

Please give a link to the complete motor specification. Perhaps your motor is not as “typical” as you think.