DRV8825 and stepper not acting right

I've got the DRV8825 driver hooked up and a stepper motor. I've turned the board and feel I've found the sweet spot.

Using the example code attached below, the stepper will move as expected a few times. It will then move just one direction. Then it will move both directions but not to full rotation. Finally it will stop moving but I can hear that the coil is energized a pause energized then eventually it will start moving again.

/*
 * Simple demo, should work with any driver board
 *
 * Connect STEP, DIR as indicated
 *
 * Copyright (C)2015-2017 Laurentiu Badea
 *
 * This file may be redistributed under the terms of the MIT license.
 * A copy of this license has been included with this distribution in the file LICENSE.
 */
#include <Arduino.h>
#include "BasicStepperDriver.h"

// Motor steps per revolution. Most steppers are 200 steps or 1.8 degrees/step
#define MOTOR_STEPS 200
#define RPM 120

// Since microstepping is set externally, make sure this matches the selected mode
// If it doesn't, the motor will move at a different RPM than chosen
// 1=full step, 2=half step etc.
#define MICROSTEPS 1

// All the wires needed for full functionality
#define DIR 8
#define STEP 9
//Uncomment line to use enable/disable functionality
//#define ENABLE 13

// 2-wire basic config, microstepping is hardwired on the driver
BasicStepperDriver stepper(MOTOR_STEPS, DIR, STEP);

//Uncomment line to use enable/disable functionality
//BasicStepperDriver stepper(MOTOR_STEPS, DIR, STEP, ENABLE);

void setup() {
    stepper.begin(RPM, MICROSTEPS);
}

void loop() {
  
    // energize coils - the motor will hold position
    // stepper.enable();
  
    /*
     * Moving motor one full revolution using the degree notation
     */
    stepper.rotate(360);

    /*
     * Moving motor to original position using steps
     */
    //stepper.move(-MOTOR_STEPS*MICROSTEPS);
    stepper.rotate(-360);

    // pause and allow the motor to be moved by hand
    // stepper.disable();

    delay(5000);
}

Any suggestions?

Thanks

Any suggestions?

Post the details or link to data sheets for the motor and the motor power supply.

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

The data sheet is at: https://www.pololu.com/file/0J590/drv8825.pdf

The voltage the board is set to .340. This is suppose to be a 2 amp 86 oz stepper and that voltage just doesn't add up to what formulas say but it's where I can get it to move.

Thanks

Post the details or link to data sheets for the motor and the motor power supply.

The DRV8825 can handle only 1.5 A/phase without forced air cooling.

The DRV8825 can handle only 1.5 A/phase without forced air cooling.

I've got a heat sink on it and can easily add a fan. So you are thinking heat is the problem?

Isn't the .340 volt low - far less than the 2 amp I should be getting? (I do have trouble following some of the math formulas!!!)

Thanks

Are you measuring the .340 V from the ref pin?

Set it to 1.5A, don't bother trying for 2A, much less likely to cutout or worse.

What supply voltage?
Which motor?
Which DRV8825 module? The setting of the current value is a property of the module, not just
the IC, as the module has the current shunt resistor on it.

Powerdown and double check you have wired the motor windings correctly.

I'm measuring V from the pot.

I've double checked the wiring more than once.

It's a 12V power supply. Checked that and it is putting out 12v.

The motor I got here: https://www.amazon.com/Stepper-Bipolar-Connector-compatible-Printer/dp/B00PNEQKC0/ref=sr_1_1?ie=UTF8&qid=1543715219&sr=8-1&keywords=17hs19-2004s1

I got this driver: Pololu - DRV8825 Stepper Motor Driver Carrier, High Current

Is your logic ground connected to the motor ground?

If you did in fact buy that motor driver from Pololu, then you have not followed their directions to set the current limit properly. From the product page:

Another way to set the current limit is to measure the voltage on the “ref” pin and to calculate the resulting current limit (the current sense resistors are 0.100Ω). The ref pin voltage is accessible on a via that is circled on the bottom silkscreen of the circuit board. The current limit relates to the reference voltage as follows:

Current Limit = VREF × 2

So, for example, if you have a stepper motor rated for 1 A, you can set the current limit to 1 A by setting the reference voltage to 0.5 V.

Set the current limit to 1.5A (better, somewhat less) and let us know how it works.

Chris - The motor ground (12V) is going to the DRV8825 GRND right by the VMOT post.

I set it as per the instructions on the product page, but it just sorta hung so I tried the sweet spot method and then it started moving. Just went back and started over and am getting the same results.

I just found this on the manufacturers site:

Electrical Specification
Manufacturer Part Number: 17HS19-2004S1
Motor Type: Bipolar Stepper
Step Angle: 1.8 deg
Holding Torque: 59Ncm(84oz.in)
Rated Current/phase: 2.0A
Voltage: 2.8V ------------------------------------------ ONLY 2.8 V power in??????
Phase Resistance: 1.4ohms
Inductance: 3.0mH ± 20%(1KHz)

I'm powering this from a 12 V power supply!!!!!!!

The voltage rating of a stepper motor is largely irrelevant. Just ignore it.

OK I'll ignore it. Any idea's on what's going on?

The "rated voltage" is the maximum steady state voltage you can apply to the coils and not exceed the current rating, which is the important parameter.

Use Ohm's Law to calculate it.

RIGHT!!!

I looked up Ohms law and that might as well be in Greek!!!

I barely passed algebra 48 yrs ago so I kinda need a little help here. :frowning: :frowning: :frowning:

It's the season - help the handicapped please :slight_smile:

Thanks

V = IR = (2.0 Amperes)(1.4 Ohms) = 2.8 Volts

Ok, I get that now...

How do I apply that to my problem?

RayJorgensen:
Chris - The motor ground (12V) is going to the DRV8825 GRND right by the VMOT post.

I set it as per the instructions on the product page, but it just sorta hung so I tried the sweet spot method and then it started moving. Just went back and started over and am getting the same results.

Wire your driver board and motor like this:
EN - no connection
M0 - ground through a 10 K resistor
M1 - ground through a 10 K resistor
SLP - arduino Vcc
STEP - arduino output pin
DIR - arduino output pin

VMOT - external voltage supply of at least 8.2 volts.
Don't worry about Ohm's law, because the chip has
active current limiting. You will set the maximum
current with the tiny pot on the board.
GND - the negative terminal on the motor's power supply
AND the GND pin on your Arduino.

NOTE: put a 100uF capacitor between VMOT and GND, right next to the board.

B2 - green wire to motor
B1 - black wire to motor
A1 - red wire to motor
A2 - blue wire to motor

NOTE: the wire order can be reversed, but the motor will run backward.

FLT - no connection
GND - same as above

Don't use the 'sweet spot' method to set the limiting current. Too much current will eventually burn out your motor and/or your driver. Set the current exactly as shown by Pololu. The method is shown at 3:36 in their video.

If you have no heatsink or fan, set vref by this method to 0.75 volts.
If you have a heatsink on the chip, AND a fan, you can set it as high as 1.1 volts. Beware though, at the higher numbers it WILL get hot. I touched my DVR8834 just to see, and had to put ice on my finger!

Now load the sketch below onto the arduino, and attach 6 aaa cells (9 volts) to VMOT and ground. The motor should spin smoothly at about 150rpm.

const byte stepPin = 9;
const byte dirPin = 8;

void setup() {
  pinMode(stepPin, OUTPUT);
  pinMode(dirPin, OUTPUT);
  digitalWrite(dirPin, LOW);
  analogWrite(stepPin,1);
}

void loop() {
  }

6 aaa cells (9 volts)

AAA alkaline cells will not supply 3 Amperes without a severe voltage drop. Use a 2 to 3 Ampere, 12-24 V power supply instead.