Nema 17 + DRV8825, makes sound, but doesn't turn

Bought a couple Nema 17 (17HS2408 and 42HD2037, 1.8deg step angel), DRV8825 driver boards, and extension board.

Tried two different codes. This library: GitHub - laurb9/StepperDriver: Arduino library for A4988, DRV8825, DRV8834, DRV8880 and generic two-pin (DIR/STEP) stepper motor drivers , and one with no libraries.

Same result with both motors and codes. They shake and buzz a bit, but don't turn, or turn just a degree or two forth and back.

Any idea what may cause this..?

#include <SPI.h>
#include <Wire.h>
#include <Arduino.h>
#include "DRV8825.h"

// using a 200-step motor (most common)
#define MOTOR_STEPS 200
// configure the pins connected
#define DIR 8
#define STEP 9
#define MS1 10
#define MS2 11
#define MS3 12
//                   200   , 8  , 9   , 10 , 11 , 12
DRV8825 stepper(MOTOR_STEPS, DIR, STEP);
//DRV8825 stepper(MOTOR_STEPS, DIR, STEP, MS1, MS2, MS3);

void setup() {
    // Set target motor RPM to 1RPM and microstepping to 1 (full step mode)
    stepper.begin(60, 2);  // (rpm, microsteps)
}

void loop() {
    // Tell motor to rotate 360 degrees. That's it.
    stepper.rotate(360);
    delay(3000); 
}
// testing a stepper motor with a Pololu A4988 driver board or equivalent
// on an Uno the onboard led will flash with each step
// this version uses delay() to manage timing

byte directionPin = 8;
byte stepPin = 9;
int numberOfSteps = 100;
byte ledPin = 13;
int pulseWidthMicros = 20;  // microseconds
int millisbetweenSteps = 250; // milliseconds - or try 1000 for slower steps


void setup() { 

  Serial.begin(9600);
  Serial.println("Starting StepperTest");
  digitalWrite(ledPin, LOW);
  
  delay(2000);

  pinMode(directionPin, OUTPUT);
  pinMode(stepPin, OUTPUT);
  pinMode(ledPin, OUTPUT);
  
 
  digitalWrite(directionPin, HIGH);
  for(int n = 0; n < numberOfSteps; n++) {
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(pulseWidthMicros); // this line is probably unnecessary
    digitalWrite(stepPin, LOW);
    
    delay(millisbetweenSteps);
    
    digitalWrite(ledPin, !digitalRead(ledPin));
  }
  
  delay(3000);
  

  digitalWrite(directionPin, LOW);
  for(int n = 0; n < numberOfSteps; n++) {
    digitalWrite(stepPin, HIGH);
    // delayMicroseconds(pulseWidthMicros); // probably not needed
    digitalWrite(stepPin, LOW);
    
    delay(millisbetweenSteps);
    
    digitalWrite(ledPin, !digitalRead(ledPin));
  }
}

void loop() { 
}

Post links to the data sheets for the stepper motors.

What is the voltage and current rating of the power supply are you using for the motors?

To what value did you set the all-important current limit on the driver?

The "power supply" is a mockup based on LM317T (1.5A), fed by 20V 3.5A laptop supply.

I've tried adjusting the current limiter all over its range, and it does cut off at the low end, but the behavior described is similar from about midway and up to the max setting.

42HD2037 datasheet

17HS2408 datasheet

The "power supply" is a mockup based on LM317T (1.5A), fed by 20V 3.5A laptop supply.

What on Earth does that mean? Just use the 20V laptop power supply.

It is absolutely essential that you understand how to properly set the current limit. For the DRV8825, it must be set to at most 1.5A per winding.

For their high quality drivers, the Pololu engineers have posted a video explaining the process.

It means this..

I knew that was a risk, and I will study that setting now. :slight_smile:

But since I tested the whole range, I don't think these "issues" should prevent the motor from running properly.

It means this..

That could certainly be part of the problem.

What is the purpose of the LM317?

These links may help
Stepper Motor Basics
Simple Stepper Code

The Pololu DRV8825 web page has lots of useful info including how to set the current limit.

...R

jremington:
That could certainly be part of the problem.

I get the same response running on either 12V or 20V. But on 20V the motor gets hotter than comfortable touch. So it seems sensible to run at 12V until I understand what's going on. It has stationary torque (resists turning), so I reckon it should have sufficient torque to turn also. It looks like it's trying to turn both ways at the same time, making it just shake and buzz in about stationary position.

Have set DRV8825 Vref=0.3V now (so Imax=0.6A as per 17HS2408 spec).

Robin2:
What is the purpose of the LM317?

To limit voltage. If it looks like something else I'm open for suggestions.

Motor power supply voltage is not the issue (as long as you obey the motor driver specs). The motor current is the issue, and the current rating is the maximum allowed. Motor torque is proportional to the current.

Stepper motors are designed to run safely when too hot to touch (typically 80 C for industrial motors).

jremington:
Motor power supply voltage is not the issue (as long as you obey the motor driver specs). The motor current is the issue, and the current rating is the maximum allowed. Motor torque is proportional to the current.

Stepper motors are designed to run safely when too hot to touch (typically 80 C for industrial motors).

Thanks!

Scoped the signals, and they didn't make any sense. Then found the motor sockets are not connected as per datasheet. Crossed the central wires and it works as expected.

Now I can make the checklist..


bretddog:
To limit voltage. If it looks like something else I'm open for suggestions.

I know it limits the voltage. But what are you powering with the limited voltage?

You should not be limiting the voltage for the stepper motors. They work best with a high voltage - just don't exceed the max for the DRV8825.

But you MUST correctly set the current limit on the DRV8825 to protect the motor.

...R

Robin2:
I know it limits the voltage. But what are you powering with the limited voltage?

You should not be limiting the voltage for the stepper motors. They work best with a high voltage - just don't exceed the max for the DRV8825.

But you MUST correctly set the current limit on the DRV8825 to protect the motor.

...R

Understood. Cheers!

Actually, it wasn't the datasheets that were off after all. Datasheet for 42HD2037 do specify pins, and they are correct. 17HS2408 doesn't specify pins, but they are crossed in comparison. And of two cables both had to be modified to hook up with this extension board.

Three ways, or more if to get correct CW/CCW direction.

x_ox_o 17HS2408
x_xo_o 42HD2037
x_oo_x
..

bretddog:
Same result with both motors and codes. They shake and buzz a bit, but don't turn, or turn just a degree or two forth and back.

Any idea what may cause this..?

Usually the cause is ourselves - not having done something properly. Not unusual at all.

bretddog:
Scoped the signals, and they didn't make any sense. Then found the motor sockets are not connected as per datasheet. Crossed the central wires and it works as expected.

Was the issue resolved by swapping over two wires? So the motor was connected, but the wires needed to be switched over/interchanged?

Southpark:
Was the issue resolved by swapping over two wires? So the motor was connected, but the wires needed to be switched over/interchanged?

yes.

bretddog:
I get the same response running on either 12V or 20V. But on 20V the motor gets hotter than comfortable touch. So it seems sensible to run at 12V until I understand what's going on.

The motor will get to the same temperature on 12V or 20V supply, the DRV8825 is a constant current
driver so the motor sees no difference. Supply voltage affects maximum speed and the speed/torque
curve.

Stepper motors get very hot, 80C or more at rated current, this is normal, they are not efficient and they
run at full power even when stationary.

The motor manufacturer expects you to have bolted the motor to something metal that acts
as a heatsink. If not, derate the nominal current somewhat.