Stepper motor Nema 17 stuck when power is supplied

Hi,
I have a problem with my Nema 17, it just gets stuck when I supply power to it.
It was working perfectly well for a while a L298N driver, but after a point, the driver always overheated and the motor didn't work efficiently, cycles were incomplete, so I decided to go for the A4988 after hearing that L298 is not meant for steppers.
But then the problem occurred when I started using the A4988 driver, it would just get stuck whenever I supplied power, no movement at all.
Thinking it might be due to a less current rating, I had got a TB6560, and the same thing happens at 2.2A.
I have not tried to go any higher, cause I don't want to damage both.
Or is it possible that the motor is already damaged?

What do I do about this? I'm sticking with the TB6560, but how do I go about this issue? How do I make the motor work?

Thank you so much for your help.

That just defines the size of the mount, it tells nothing about the motor itself.

When coils are energised the motor will stick, that is what it is designed to do. It is only when you pulse the motor coils will it move.

To do this you have to wire the motor as a two phase motor and get the coils correct the correct way round.

This is how these motors work
http://www.thebox.myzen.co.uk/Workshop/Motors_4.html

So we need to know how you have wired up this motor and what your software is doing. So post a schematic and your code.

Did you Ohm out the stepper coils to make sure that they are connected to the driver properly?

Post a schematic of your wiring.

Post photos showing the wiring.

Post photos showing the switch settings on the driver.

Post your test code. Read the forum guidelines to see how to properly post code and information on how to get the most from this forum.
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.
Post a schematic. How to make a schematic to post.

I used this basic schematic to try it out, I even tried wiring up the EN pins, it still did the same thing,
also, I didn't use an Arduino, I had wired it to my ESP32 as I'll be using that for my project.

The code I used, again, it was just basic to get some movement in it.

// defines pins numbers

const int dirPin  = 34;

const int stepPin = 35;

const int enPin   = 32;



void setup() {

 

  // Sets the two pins as Outputs

  pinMode(stepPin,OUTPUT);

  pinMode(dirPin,OUTPUT);



  pinMode(enPin,OUTPUT);

  digitalWrite(enPin,LOW);

 

}

void loop() {

 

  digitalWrite(dirPin,HIGH); // Enables the motor to move in a particular direction

  // Makes 200 pulses for making one full cycle rotation

  for(int x = 0; x < 1600; x++) {

    digitalWrite(stepPin,HIGH);

    delayMicroseconds(500);

    digitalWrite(stepPin,LOW);

    delayMicroseconds(500);

  }

  delay(1000); // One second delay



  digitalWrite(dirPin,LOW); //Changes the rotations direction

  // Makes 400 pulses for making two full cycle rotation

  for(int x = 0; x < 1600; x++) {

    digitalWrite(stepPin,HIGH);

    delayMicroseconds(1000);

    digitalWrite(stepPin,LOW);

    delayMicroseconds(1000);

  }

  delay(1000);

 

}

First disconnect everything and rotate the motor shaft and after connecting the driver and Arduino try rising the shaft if it is hard to rotate the your driver is working, but if the shaft is same as before then you destroyed the driver (before this try the tutorial and still it didn't work then the driver is destroyed (a4988))

WARNING :warning: if you disconnect/connect the motor driver when it is powered on the driver will be destroyed not the motor

This is a tutorial with a4988 driver, even try to adjust the potentiometer as in the tutorial

I have tried this, the A4988 is most likely destroyed. It was also not giving the rated current as it was not an original.
I will mostly be using the TB6560.

Swap the B- and the B+ signals to the motor and try again.

To what?
Try EN- to ground and EN+ to Arduino 5V.

Alright, I shall try that and update you.

Hi, I switched B+ and B-, also connected the EN+ and - , but with the EN pins, it did not spin, however, it started working well with the B+ and B- wires being swapped.
It now also works well with the ESP32, it did not do anything when connected to pins 34 and 35, however it did spin when connected to 23 and 26.

So, thank you so much. It works finally, and I set the current rating at 2.2 A.

Thank you everyone for your suggestions. :smiley:

Could you help me out with my code?
So I'm trying to incorporate this in a lift mechanism, and when a button is pressed once, I want the mechanism to lift and when pressed twice I want it to come down.
I can work out this code basically, but my doubt lies with when I press the button once it lifts, supposedly after say 1 minute, I press the button once, again, it would possibly damage my mechanism and perform the same cycle of rotating clockwise or anti-clockwise again.
How do I incorporate a fail-safe into my code?
Any ideas?

Thank you so much. Or should I type out a new thread?

Change the delayMicroseconds(500) to delay(100). Then you won't have issues with trying to break the laws of physics (the motor cannot accelerate to high speed instantly, if you try this it will stall or oscillate or make a horrible noise, or go backwards or many possibilities none of which are good).

Okay, thank you, Mark, shall try it out.
Thanks a lot again.

No Mark, this is just producing a pulse on the step pin of a stepping motor driver, it is not controlling the speed of the pulses.

So how do I go about it? should I use some sort of sensor , like an ultrasonic sensor to do so?

You need to make sure the motor can't be driven past the end by counting the total number of steps your motor has made since it was driven to a calibrated position.

To make doubly sure you also need to have a detector at the end of each travel distance to detect when it over steps.

So for the detector, can an ultrasonic sensor do the job?
I have an idea how to code it out, is it accurate enough to do the job?
Because I think its better than an infrared sensor, cause after using one, I felt the duration of it receiving a signal back is tad bit slower.

No.
You need some sort of micro switch or an opto interrupter switch.

I have no clue what that is, please educate me.

Oh wait, is it a photoelectric encoder?