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):
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.