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