Nema 17 4.2 Kg-cm not working

hi,
I was working according to the tutorial in this YouTube video link

i am using a Arduino Uno, cnc shield ,a4988 driver, nema 17 (ks42sth40-120A).

i used this code:

#define EN 8

//Direction pin
#define X_DIR 5

//Step pin
#define X_STP 2

//A498
int delayTime = 30;
int stps=6400;

void step(boolean dir, byte dirPin, byte stepperPin, int steps)
{
  digitalWrite(dirPin, dir);
  delay(100);
  for (int i = 0; i< steps; i++)
  {
    digitalWrite(stepperPin, HIGH);
    delayMicroseconds(delayTime);
    digitalWrite(stepperPin, LOW);
    delayMicroseconds(delayTime);
  }
}

void setup()
{
  pinMode(X_DIR, OUTPUT); pinMode(X_STP,OUTPUT);
  pinMode(EN, OUTPUT);
  digitalWrite(EN,LOW);
}
void loop()
{
  step(false, X_DIR, X_STP, stps);
  delay(1000);
  step(true, X_DIR, X_STP, stps);
  delay(1000);
}

i powered the board with using 24 V 5A power supply

PROBLEM:
the problem is my nema motor is not rotating...

can you help me figure out what is wrong....i am new to arduino .....

thanks for your time.

Are you sure you’ve wired it correctly - the stepper motor especially ? Plugged into the same board position ?

Do you have a wiring diagram ?

Does the code upload without errors ?

Yes the code uploads without any error!!!

And I did everything thing as was said in the video...

That is a step every 60us or 16K steps/second. I doubt that any stepper can go from 0 to 16K steps per second instantaneously. Try a much longer delay.

Robin2's simple stepper program may be of interest.

Also his stepper basics tutorial.

Did you properly set the coil current limit on the driver?

What is your microstepping set to?

For higher speeds you will need acceleration like with the AccelStepper library or the MobaTools stepper library.

If it is not working try increasing the delayTime to maybe 1000. Also the shield is very sensitive. If you have powered it on without connecting the stepper motors first it will destroy the drivers and make sure that you have grounded the enable pin to enable it.

That too. You'll need a multimeter( or voltmeter) for that. Have the negative lead on the bottom right pin of the driver you're setting and the positive lead of the multimeter to the trimmer potentiometer. Then just turn the potentiometer and set the multimeter to read 20 Volts DC and adjust the potentiometer so that the multimeter reads .75 Amperes. (You say you're new to arduino so I don't know how much is going over your head, if you need clarification just ask :+1: ).

It looks like you didn't ground the enable pin. To do that just have a female to female jumper wire connected between the top 2 pins on the row of pins to the left of the driver you connected.

@8675300, The above sets the driver enable pin LOW and enables the stepper.

i increased the delayTime to 1000...but its still not moving

i did this too....but its still the same.....

you are right ....i have damaged my a4988 driver somehow....i got a replacement and now its running smooth....thanks for your time and support

Good luck with your project!

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