Accelstepper stepping selection

342 views
Skip to first unread message

Artem Senkovskey

unread,
Apr 4, 2018, 4:13:13 AM4/4/18
to accelstepper
Hi everyone.
I need your support with Accelstepper lib, please.
Here's my setup: I use Arduino Uno, Chinese driver HYQD80-H8600 and bipolar stepper.
Trying to run tutorial from Accelstepper Constand speed, motor clics quite loud and can be stopped by fingers. Driver set to appropriate current and microstepping is 2 (doesnt have full step option).
Ony thing I've changed in example is declaration - AccelStepper stepper(1, 3, 2);. So to use Driver, Step pin 3, dir pin 2.
If I try another StepperDriver lib, everything work like a charm. But the problem is that I need to control 2 steppers with proportional control, which is supported by Accelstepper lib.
Can someone suggest what am I missing?

Here's the code that works (again, it's another library):
#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 2

// All the wires needed for full functionality
#define DIR 2
#define STEP 3
//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(7200);

    /*
     * Moving motor to original position using steps
     */
    stepper.move(-720);

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

    delay(3000);
}

And this one doesn't (as expected):
#include <AccelStepper.h>

AccelStepper stepper(1,3,2); // Defaults to AccelStepper::FULL4WIRE (4 pins) on 2, 3, 4, 5

void setup()
{  
   stepper.setMaxSpeed(1000);
   stepper.setSpeed(50);
}

void loop()
{  
   stepper.runSpeed();
}

Harrzack

unread,
Apr 10, 2018, 2:30:12 PM4/10/18
to accelstepper
I think the one that doesn't work is missing a command to tell driver WHERE to step to - moveTo() and similar functions.
Reply all
Reply to author
Forward
0 new messages