1

I'm trying to make a nema17 stepper motor work using ramps1.4 and A4988 driver.
But when I'm trying to rotate motor, it spins with almost no torque and constant shaking.

  • Motor 2-phase nema17 , Step Angle 1.8° .
  • Power supply 12v/60w.

Here is the sketch:
(I copied it from RepRap wiki , and removed everything except X Motor)

#define X_STEP_PIN         54
#define X_DIR_PIN          55
#define X_ENABLE_PIN       38

void setup() 
{
  pinMode(X_STEP_PIN       , OUTPUT);
  pinMode(X_DIR_PIN        , OUTPUT);
  pinMode(X_ENABLE_PIN     , OUTPUT);
  digitalWrite(X_ENABLE_PIN, LOW);
}

void loop () 
{    
  if (millis() % 10000 < 5000) 
  {
    digitalWrite(X_DIR_PIN    , HIGH);
  }
  else
  {
    digitalWrite(X_DIR_PIN    , LOW);
  }

  digitalWrite(X_STEP_PIN     , HIGH);
  delay(1);
  digitalWrite(X_STEP_PIN     , LOW);    
}

The wiring diagram:
(I have only X Motor plugged in)

enter image description here

and video: (Google Video link is dead @ 2017-02-09)

1
  • Does the stepper motor breakout have a potentiometer to set the maximum current?
    – Gerben
    Commented Dec 11, 2016 at 14:40

1 Answer 1

1

Add a second delay after:

digitalWrite(X_STEP_PIN , LOW);

Also try increasing the delay maybe you are pulsing the step pin too fast.

11
  • Nothing changed , it keeps doing the same , but slower . Commented Dec 11, 2016 at 14:43
  • Have you tried removing your if that control the dir pin? Commented Dec 11, 2016 at 14:47
  • You may also want to check your driver current: pololu.com/product/1182/faqs Commented Dec 11, 2016 at 14:50
  • If i remove if completely it is just shaking . If i remove if , but leave digitalWrite(X_DIR_PIN , HIGH); it keeps doing the same thing . Commented Dec 11, 2016 at 14:55
  • Yes , checked driver current limit , it is set to 700mA and motor has Rated current of 400mA . Commented Dec 11, 2016 at 15:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.