Git Product home page Git Product logo

stepperdriver's Introduction

arduino-library-badge Actions Status Actions Status

StepperDriver

A4988, DRV8825, DRV8834, DRV8880 and generic two-pin stepper motor driver library. Features:

  • Constant speed mode (low rpms)
  • Linear (accelerated) speed mode, with separate acceleration and deceleration settings.
  • Non-blocking mode (yields back to caller after each pulse)
  • Early brake / increase runtime in non-blocking mode

Hardware currently supported:

  • DRV8834 Low-Voltage Stepper Motor Driver up to 1:32
  • A4988 Stepper Motor Driver up to 1:16
  • DRV8825 up to 1:32
  • DRV8880 up to 1:16, with current/torque control
  • any other 2-pin stepper via DIR and STEP pins, microstepping up to 1:128 externally set

Microstepping

The library can set microstepping and generate the signals for each of the support driver boards.

High RPM plus high microstep combinations may not work correctly on slower MCUs, there is a maximum speed achieveable for each board, especially with acceleration on multiple motors at the same time.

Motors

  • 4-wire bipolar stepper motor or
  • some 6-wire unipolar in 4-wire configuration (leaving centers out) or
  • 28BYJ-48 (commonly available) with a small modification (search for "convert 28byj-48 to 4-wire").

Connections

Minimal configuration from Pololu DRV8834 page:

Wiring

This is suggested wiring for running the examples unmodified. All the pins below can be changed.

  • Arduino to driver board:

    • DIR - D8
    • STEP - D9
    • GND - Arduino GND
    • GND - Motor power GND
    • VMOT - Motor power (check driver-specific voltage range)
    • A4988/DRV8825 microstep control
      • MS1/MODE0 - D10
      • MS2/MODE1 - D11
      • MS3/MODE2 - D12
    • DRV8834/DRV8880 microstep control
      • M0 - D10
      • M1 - D11
    • ~SLEEP (optional) D13
  • driver board to motor (this varies from motor to motor, check motor coils schematic).

  • 100uF capacitor between GND - VMOT

  • Make sure to set the max current on the driver board to the motor limit (see below).

  • Have a motor power supply that can deliver that current.

  • Make sure the motor power supply voltage is within the range supported by the driver board.

Set Max Current

The max current is set via the potentiometer on board. Turn it while measuring voltage at the passthrough next to it. The formula is V = I5R where I=max current, R=current sense resistor installed onboard

  • DRV8834 or DRV8825 Pololu boards, R=0.1 and V = 0.5 * max current(A). For example, for 1A you will set it to 0.5V.

For latest info, see the Pololu board information pages.

Code

See the BasicStepperDriver example for a generic driver that should work with any board supporting the DIR/STEP indexing mode.

The Microstepping example works with a DRV8834 board.

For example, to show what is possible, here is the ClockStepper example that moves a stepper motor like the seconds hand of a watch:

#include <Arduino.h>
#include "A4988.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
A4988 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(1, 1);
}

void loop() {
    // Tell motor to rotate 360 degrees. That's it.
    stepper.rotate(360);
}

Hardware

stepperdriver's People

Contributors

1sm1rk avatar chroja avatar darkhedie avatar hyperspacex2 avatar laurb9 avatar luksa avatar per1234 avatar richievos avatar vovagorodok avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stepperdriver's Issues

DRV8825 Micro-Stepping

Hi laurb9,

First, great job on making this library!

I may have spotted a tiny error I thought I'd bring to your attention regarding the DRV8825.

In the 'Microstepping' example code you comment that:

 * Microstepping mode: 1,2,4,8,16 or 32(DRV8834 only)

However, the DRV8825 also has the option for 32 micro-steps mode as the datasheet makes clear in the very first feature it lists on the front page (http://www.ti.com/lit/ds/symlink/drv8825.pdf).

All the best,
Nadav

A4988, SyncDriver, not turning CCW

Hi,

I am facing the issue that the stepmotor is not turning CCW, when using negative values in SyncDriver.controller.rotate/move. When measuring the DIR pin of the motor, the pin is not set to 0V.

#include <Arduino.h>
#include <Ethernet.h>
#include <ArtNode.h>
#include "SyncDriver.h"
#include "A4988.h"

#define VERSION_HI 0
#define VERSION_LO 1

#define MOTOR_STEPS 200
#define MICROSTEPS 16

#define ENABLE 8

// X motor
#define DIR_X 5
#define STEP_X 2
#define RPM_X 50
#define MOTOR_ACCEL_X 400
#define MOTOR_DECEL_X 400

// Y motor
#define DIR_Y 6
#define STEP_Y 3
#define RPM_Y 70
#define MOTOR_ACCEL_Y 300
#define MOTOR_DECEL_Y 300

#define MS1 10
#define MS2 11
#define MS3 12
A4988 stepperX(MOTOR_STEPS, DIR_X, STEP_X, ENABLE, MS1, MS2, MS3);
A4988 stepperY(MOTOR_STEPS, DIR_Y, STEP_Y, ENABLE, MS1, MS2, MS3);
SyncDriver controller(stepperX, stepperY);

void setup() {
    stepperX.begin(RPM_X, MICROSTEPS);
    stepperX.enable();

    stepperY.begin(RPM_Y, MICROSTEPS);
    stepperY.enable();

    stepperX.setSpeedProfile(stepperX.LINEAR_SPEED, MOTOR_ACCEL_X, MOTOR_DECEL_X);
    stepperY.setSpeedProfile(stepperY.LINEAR_SPEED, MOTOR_ACCEL_Y, MOTOR_DECEL_Y);
}

void loop() {
  controller.rotate(10, 30);
  delay(500);
  controller.rotate(-5, -15);
  delay(500);
}

Anyone who also faced the same issue?

Regards,

Sybren

enable / sleep / reset controls

Sometimes it is desirable to switch off the motor when there is no need to maintain a holding torque. This can be incorporated in the Basic setup as a single in control that go HIGH for enabling and LOW for disabling the stepper.

RPM Change

I cant seem to figure out how to change the RPM in the main code. I dont need to change it while its running, i just need to change it before it starts the movement. I tried changing the variable but it doesnt seem to do anything.

How do i change the RPM in the code instead of just having the RPM set in the setup?

Integeroverflow using syncdriver with large values

Two motors
Motor 1 - 200 Steps 16 microsteps 14 RPM
Motor 2- 200 Steps 16 microsteps 180 RPM

Motor 1 19530 steps to go.
Motor 2 26 * 3 * 200 * 16 steps to go

Motor 1 getTimeForMove = 25994007 (yes it's already as synced as possible).
Motor 2 getTimeForMove = 25958400

when I'm going now with a
controller.startMove( 25994007,25958400)
it calculates
Motor one RPM 14
Motor two RPM 11

maybe it would be better to calculate a float factor and apply it to the rpm value , instead of calculating with integers over the large value.

/*
 * Stretch timing for all others by adjusting rpm proportionally
 */
if (move_time){
    FOREACH_MOTOR(
        if (steps[i]){
            rpms[i] = motors[i]->getRPM();
            Serial.print(rpms[i]);Serial.print(";");Serial.print(timing[i]);Serial.print(";");Serial.println(move_time);
            **motors[i]->setRPM(round(rpms[i] * (float(timing[i]) / float(move_time))));**
        } else {
            rpms[i] = 0;
        }
    );
}

But after changing there is an other thing I cant understand at all, why is the first motor adjusted even if it needs the longest time.
The printed values are quite strange (careful downto loop):
180;26956800;26956800
3840;80640;26956800

Got it: when calling nextAction on syncdriver without having an action, it overwrites rpm with the values from the last move....

add motor types

See if it makes sense to combine stepper characteristics into a Motor class to be used by the driver.
Inductance, current, voltage, steps from the spec sheet give max rpm, for example: http://www.daycounter.com/Calculators/Stepper-Motor-Calculator.phtml

Or maybe having all that stuff in a class makes it more obvious which device the numbers refer to. We can replace the STEPS parameter with a Motor object.

Smooth transition to/from cruise speed

The changes from full acceleration to zero when reaching cruise speed cause a "jerk" in the system.

Implement a smooth acceleration transition with one of the methods described in the "Generating Stepper Motor Speed Profiles" doc.

nonblocking move/rotate

move() and rotate() are blocking, they will not return until the motor has reached its final position.

This prevents the caller from doing other stuff in-between steps, like updating a display or sending/receiving controls.

Implement non-blocking versions of these calls, that yield control to the main thread after each step.

Freeze after a number of cycles

Hi, I have an application where a stepper motor has to run every minute and always in th same direction. I am using an Arduino Uno, a PG15S-020 geared stepper motor and a Pololu D8834 driver. I have also added a relay that turns off the power to the driver/motor to save battery life and avoid motor heating. A2 pin is used as output for the relay since all other outputs are taken. Below is the simplest code I have tested:

#include <Arduino.h>
#include "BasicStepperDriver.h"

#define MOTOR_STEPS 1080
#define RPM 20
#define MICROSTEPS 1
#define DIR 1
#define STEP01 4
#define SECOND 1000L
#define MINUTE (60SECOND)
#define HOUR (60
MINUTE)
BasicStepperDriver stepper01(MOTOR_STEPS, DIR, STEP01);

void setup(void) {
stepper01.begin(RPM, MICROSTEPS);
pinMode(A2, OUTPUT); // Set pin A0 as output for relay
digitalWrite(A2, LOW); // De-energize relay
}

void loop(void) {
digitalWrite(A2, HIGH); // Energize motor power relay
delay(200); // Make sure relay is energized
stepper01.rotate(360); // Run stepper --> SKETCH HANGS RIGHT HERE
delay(750); // Wait until stepper is done
digitalWrite(A2, LOW); // De-energize relay
delay(MINUTE); // Wait for 1 minute
}

This code always hangs at loop #69 at the stepper01.rotate command. I am testing this code without connecting the driver and stepper, only with the Arduino and the relay. If I change the delay from 1 minute to 30 seconds, the code hangs at the same command at loop #129. I changed from delay() to millis() and the code hangs always at the same command at loop #72. Am I doing something wrong here?
Thanks for the support.

Use begin()

Move pin setup to begin() like other Arduino libs.

Some pins / controllers don't like initializing their pin modes before setup(), I am guessing maybe it conflicts with setting the pin layouts.

This might cause compatibility issues so the initialization should also happen in setRPM() and setMicrostep() automatically.

weird behavior with TB6600

Hello, complete noob, needs advise on his setup.
single motor, 57BYGH420-2 ( nema23, 2a per coil,

https://french.alibaba.com/product-detail/stepper-motor-57bygh420-2-125-oz-in-200-steps-rev-600mm-wire--60392070742.html

and the driver https://www.dfrobot.com/wiki/index.php/TB6600_Stepper_Motor_Driver_SKU:_DRI0043
my dip switches are ON-ON-OFF ( so the micro step are set to 1 and code is using 1 as well
#define MICROSTEPS 1 )
ON-OFF-OFF so it's setup to 2A as my motor spec.

wiring looks great since I;m able to run basic for loop and motor turn smoothly in both direction.
I' using the Enable pin (I'll need that later) but just trying to use the library for now..
BasicStepperDriver stepper(MOTOR_STEPS, DIR, STEP);

basic example will make the motor turn 1/8 turn and go back to original position...

sorry for asking before spending more hours on the thing but I just left the DRV8825 for this stronger controler and I hit different issues and I'm getting tired of this project lol

Use end-stop to set home(X+ & X-)

I'm looking for a way to get all the axes to the starting position, but I do not think it's possible using this library. is that it?

Gear Ratios

I was thinking to make the driver aware of gear ratios to simplify the calculation needed from outside.

They would be represented as two numbers such as 1:64, don't know what to call them yet.

These could help with fractional rpms, for example a "fake" 100:1 ratio would make rpm=110 be an actual 1.1rpm.

Possible issues could be an overflow in the math somewhere with really high or really low ratios.

functions

hi dears
maybe my question is not for this place.but please help me because i'm beginner.
how can i understand all of the functions of this lib and inputs arguments?
i try cpp files and .h files .

PWM

Can PWM be used ?
Can we use a combination of bit-banging and PWM ?

At cruise speed the step interval is the shortest and might not allow for room to do other tasks. But as we already know how many pulses and the frequency is fixed (until deceleration), could we offload to PWM ?

Pulse width

(my apologizes if my english isn't good)

Hi,

I have a problem moving my steppers motors using the version 1.1.3.

I measured the output signal of the arduino and i noticed that the pulse width is lower than the width in ver 1.1.0, and even lower than ver 1.0.6 (this version is the best for that motors right now). Also the frequency of the pulses is lower.
I changed step_high_min and i get wider pulses, but even with that the motors doesn't move.

This issue causes a serious problem. I have 2 types of motors, the bigger ones only emit a sharp sound in full step mode using ver 1.1.3 .

micros() wrap around

In PanoController-Firmware which uses StepperDriver, program hangs if asked to move after running for a while (one hour or so).

micros() wraps around at 71 minutes, so it may be the most likely cause.

esp8266 reset issue on this driver

hello, on including this driver, esp8266 will repeatedly reset, it seems to take long time on execution, is any one use in their yield(); or delay(); function in files where its stuck for a while to prevent further execution so it may not rest on watch dog

StepperDriver with limit switch

Hi,

I'd like to start with the StepperDriver lib for the Pololu DRV8834 Driver Carrier.
Can anyone give me a hint how to

  1. setup()
  • go backward as long as the limit switch is reached
  1. loop()
  • go xy steps forward or backward but never further than touching one of the 2 limit switches.

Thanks a lot in advance and many regards,
Brunnwart

MultiDriver bad timing in linear speed mode

MultiDriver does not work well, the movements take longer than they would separately. Could be just a timing overhead issue, but it happens at very slow rpm too.

example
board: Feather M0, rpm=10, microsteps=32
both axis: 30s
single axis: 15s (so the combined move should have been 15s)

change steps type from int to long

when doing large numbers of steps - especially the case with 1/32 micro stepping - the steps variable is unable to correctly store the number due to integer overflow. This results in the motor moving in the opposite direction.

Could the type of the variable steps be changed from int to long to give it a much larger range of steps that it can accept?

Limit RPM to driver fSTEP

Should limit RPM based on driver fSTEP and microstep.

  • DRV8880: 1MHz (470ns pulse)
  • DRV8834: 250KHz (min 1.9us pulse)
  • DRV8825: 250KHz (1.9us)
  • A4988: 500KHz (1us)

dual-motor driver

(investigate)

See if two motors can be moved to their respective targets at the same time, for a smooth two-axis rotation. Since motors have to draw current anyway even when not moving, power-wise this would not be a problem, but different rpms can make the timing interlacing difficult to implement.

Fix Magic Numbers

Hi again,

I'm working with a 0.9 deg (400 steps) stepper motor and I've noticed your code contains a fair amount of 'magic' numbers in this context. That is, you have the number 200 in various places (see, e.g. the Microstepping example), or sometimes 100 when looking to rotate half a revolution (180 deg).

Would be much cleaner and useful to employ the constant - which you've already defined at the beginning of the code (i.e. MOTOR_STEPS) - instead of those numbers. That way, users with 0.9 motors (or whatever) would only need to change a single value rather than going over the whole code and needing to calculate which value to enter at each point.

All the best,
Nadav

Cancelling the current move

Currently it does not look like there is a way of stopping a move once it has been started and "resetting" steps_remaining. Is there a nice way of doing this?

A scenario I am looking at is homing an axis, where I drive it slowly back onto the endstop and then disable the motor when that is hit. It would be nice to end the move there, rather than "waiting it out" for it to go through all the delays.

I may modify and raise a pull request if my solution ends up being at all neat.

Thanks

Non-blocking issue

Hello, I posted a comment on a closed issue and didn't see it appearing anywhere, so I'm copying it here and removing the comment in that issue. Anyway, I was also trying to understand the non-blocking sketch. I use the Blynk library for communication with a server and lots of timers so that nothing blocks the loop.

At the moment I solve the blocking problem by making the stepper part of the code run in a timer every 100 milliseconds, and rotating the exact degrees taking 100 milliseconds, then performing the rest of the code and then doing that all over again. It used to work, unfortunately the rest of the program got a bit more complicated and the time it takes to perform calculations in between has increased, so you will see some stuttering, which if unpreferable. Also, serial logging is a no go when using a stepper since it takes up quite a bit of time, which would make the stuttering even worse.

So now I'm trying to decide whether the non-blocking sketch would solve these problems. If I understand correctly you set like a target first (the startMove function), then perform a stop function when the other code needs running (for me that would be every 100-300 milliseconds, a timer would then run the stepper.stop() function). Then you calculate the time you have to perform calculations, if this time is smaller then or equal to zero it means the motor has reached its goal and you can perform all the calculations you want. If the time left is bigger than a pre defined value (in the example 100 milliseconds) you would also run your other code.

I don't know whether this is how it works, but if it works like, what happens in the time of the stepper.nextAction()? Does the stepper not do anything which would provide me with the stuttering I already have or does the stepper still move and requires new data after that period of time?

If the stuttering can be resolved, I would be really happy. Figuring out how to combine this with the rest of my code is a second thing (timers need to run in the loop, perhaps the if statement with the wait_time_micros > 100 in there before calling the run function of the timer) but I'm happy to work on that if this solves the issues I'm currently having.

Thanks in advance!

Need higher precision for motor RPM

Hi Laurentiu, I think you need to use something like floats for the motor RPM. I found some large errors where SyncDriver quantizes the value when it tries to adjust the motor speeds so all the steppers finish at the same time. I've seen cases where a move of around 40,000 steps can have one motor finish up .5 seconds after the other. If you like I can come up with a sample case that shows the error.

Drew

Update version on Arduino repos

First of all: great library! Thanks!

Right now, the version available through the Arduino.cc IDE is 1.1.2, which has some unpatched bugs (most notably #36 and #28). As of this writing, the current version is 1.1.3 and fixes all these issues.

Return steps left

It would be useful to return the steps_remaining value in the stop() and startBrake() functions.
It will not affect current usages because they simply won't be capturing the returned value, and it can be useful for detecting position of where the stepper was.
One of use cases:

  • I don't know the absolute position of the stepper.
  • So I call a move with 1000 steps knowing that is enough to hit an end-stop.
  • The motor hits an end-stop.
  • I call stop() and receive back that there were still 400 steps left.
  • Now I know that when I started moving it, it was 600 steps away.
  • I can move it back to that position and now I know it's absolute position(600 steps).

DRV8825 is using wrong ms_table[]

It is using ms_table[] that is defined in A4988.cpp.
It is using this table, because implementation of method setMicrostep() is in A4988.cpp and this table is static.
If I copy whole setMicrostep() method to DRV8825.cpp and that way overwrite A4988 method it start to work.
There is few method to resolve this issue like removing static and moving initialization of ms_table to constructor or overwriting setMicrostep() in DRV8825.

Additionally I found few smaller cosmetic issues :)

  1. In few places there is this kind of if statment
    if (!IS_CONNECTED(ms1_pin) || !IS_CONNECTED(ms1_pin) || !IS_CONNECTED(ms1_pin))
    I think it shouldn't have only ms1_pin there.
  2. Following members are not used in DRV8825.h:
    int mode0_pin = PIN_UNCONNECTED;
    int mode1_pin = PIN_UNCONNECTED;
    int mode2_pin = PIN_UNCONNECTED;

Missed step detection

This is not a bug report, but rather a support request. Posting it here, since I don't know where the proper place is. If it is the wrong place to ask the question, I apologize.

I would like to do missed step detection, as is done in the video on this page:

MISSED STEP DETECTION WITH MK2CLONE R2

Is this possible with this library? And is there a tutorial where I can learn how to set it up, both on the hardware and software side?

Ability to continue an accelerated move

When using non-blocking mode, it should be possible to change the target to extend or reduce the movement.

This is easy to do if we're not in the accel/decel zones yet, a little more tricky otherwise. A generic way would just recalculate everything starting from the current speed/position, to allow changing acceleration as well.

Get Time For Move ?

Using the function stepper.getTimeForMove(steps) always gives 75 .. Doesn't matter if it is going to move 500 or 20,000 steps.

Also, based on your example NonBlocking.ino you use

    // motor control loop - send pulse and return how long to wait until next pulse
    unsigned wait_time_micros = stepper.nextAction();

but doing it this way it gives zero for both motors. I am thinking this could be because i am moving them using SyncDriver controller object.

I am using SyncDriver.h to control two motors at the same time and both moves to their destination without problem.

this is not non-blocking

it blocks, and worse of all it doesn't handle steps correctly.
you can only step in full step despite the microsteps...

High RPM limit + acceleration results in super slow move

microsteps = 32, rpm = 450, LINEAR_SPEED mode, motor moves at an apparent constant speed of 1-2rpm.

With AccelTest sketch, I can see the dt remains at its step 0 value 1889 for all steps (so pulse_step is 3778).

There's probably an overflow somewhere. With lower microsteps, this does not happen until 900 rpm or so which isn't feasible.

Non blocking?

The readme mentions nonblocking mode. Can you explain how this works, perhaps provide an example?

Increasing microstep number also increases RPM and number of degrees

RPM value is correct at full step mode, but the number of degrees asked and the speed are multiplied by the microsteps value, hence directly going against the commented affirmation
" * The motor should rotate just as fast (set RPM)"

I directly implemented the MicroStepping example through a DRV8825.

am I doing something wrong? Where can I modify this?

'ISO C++ forbids initialization of member 'mode''

Hi Laurens,

I found your source code for the DRV8834 using Arduino: https://github.com/laurb9/StepperDriver

I am also running into the similar issue using Windows 7 and the Arduino 1.0.5-r2 IDE.

In file included from /A4988.h:13,
from A4988.cpp:10:
BasicStepperDriver.h:36: error: ISO C++ forbids initialization of member 'mode'
BasicStepperDriver.h:36: error: making 'mode' static
BasicStepperDriver.h:36: error: ISO C++ forbids in-class initialization of non-const static member 'mode'
BasicStepperDriver.h:37: error: ISO C++ forbids initialization of member 'accel'
BasicStepperDriver.h:37: error: making 'accel' static
BasicStepperDriver.h:37: error: ISO C++ forbids in-class initialization of non-const static member 'accel'
BasicStepperDriver.h:38: error: ISO C++ forbids initialization of member 'decel'
BasicStepperDriver.h:38: error: making 'decel' static
BasicStepperDriver.h:38: error: ISO C++ forbids in-class initialization of non-const static member 'decel'
BasicStepperDriver.h:56: error: ISO C++ forbids initialization of member 'last_action_end'
BasicStepperDriver.h:56: error: making 'last_action_end' static
BasicStepperDriver.h:56: error: ISO C++ forbids in-class initialization of non-const static member 'last_action_end'
BasicStepperDriver.h:57: error: ISO C++ forbids initialization of member 'next_action_interval'
BasicStepperDriver.h:57: error: making 'next_action_interval' static
BasicStepperDriver.h:57: error: ISO C++ forbids in-class initialization of non-const static member 'next_action_interval'
BasicStepperDriver.h:70: error: ISO C++ forbids initialization of member 'enable_pin'
BasicStepperDriver.h:70: error: making 'enable_pin' static
BasicStepperDriver.h:70: error: ISO C++ forbids in-class initialization of non-const static member 'enable_pin'
BasicStepperDriver.h:74: error: ISO C++ forbids initialization of member 'microsteps'
BasicStepperDriver.h:74: error: making 'microsteps' static
BasicStepperDriver.h:74: error: ISO C++ forbids in-class initialization of non-const static member 'microsteps'
BasicStepperDriver.h:82: error: ISO C++ forbids initialization of member 'rpm'
BasicStepperDriver.h:82: error: making 'rpm' static
BasicStepperDriver.h:82: error: ISO C++ forbids in-class initialization of non-const static member 'rpm'
/BasicStepperDriver.h: In static member function 'static void BasicStepperDriver::delayMicros(long unsigned int, long unsigned int)':
BasicStepperDriver.h:46: error: 'yield' was not declared in this scope
In file included from A4988.cpp:10:
/A4988.h: At global scope:
A4988.h:18: error: ISO C++ forbids initialization of member 'ms1_pin'
A4988.h:18: error: making 'ms1_pin' static
A4988.h:18: error: ISO C++ forbids in-class initialization of non-const static member 'ms1_pin'
A4988.h:19: error: ISO C++ forbids initialization of member 'ms2_pin'
A4988.h:19: error: making 'ms2_pin' static
A4988.h:19: error: ISO C++ forbids in-class initialization of non-const static member 'ms2_pin'
A4988.h:20: error: ISO C++ forbids initialization of member 'ms3_pin'
A4988.h:20: error: making 'ms3_pin' static
A4988.h:20: error: ISO C++ forbids in-class initialization of non-const static member 'ms3_pin'
A4988.h:34: error: expected ';' before 'override'
A4988.h:54: error: expected ';' before 'override'
A4988.cpp: In constructor 'A4988::A4988(short int, short int, short int, short int, short int, short int)':
A4988.cpp:36: error: 'short int A4988::ms1_pin' is a static data member; it can only be initialized at its definition
A4988.cpp:36: error: 'short int A4988::ms2_pin' is a static data member; it can only be initialized at its definition
A4988.cpp:36: error: 'short int A4988::ms3_pin' is a static data member; it can only be initialized at its definition
A4988.cpp: In constructor 'A4988::A4988(short int, short int, short int, short int, short int, short int, short int)':
A4988.cpp:41: error: 'short int A4988::ms1_pin' is a static data member; it can only be initialized at its definition
A4988.cpp:41: error: 'short int A4988::ms2_pin' is a static data member; it can only be initialized at its definition
A4988.cpp:41: error: 'short int A4988::ms3_pin' is a static data member; it can only be initialized at its definition
A4988.cpp: At global scope:
A4988.cpp:61: error: no 'short int A4988::setMicrostep(short int)' member function declared in class 'A4988'
A4988.cpp:93: error: no 'short int A4988::getMaxMicrostep()' member function declared in class 'A4988'

I am not sure if this is a Windows problem, or what?

Thanks!
Emilio

Nema 17 doesnt stay tough when it is idle

hi,
i want to control a nema 17 with an a4988 and i need that when the motor doesnt recieve any step, it has to stay tough/hard.
When i tried it, the motor turns off when it doesnt recieves any step from the driver.
This is a hardware or a software problem?? how can i solve it??

Interrupts ?

Use microsecond interrupts to drive the timing. This is architecture-dependent.

acceleration / deceleration

The stepper motor can skip steps at high load if we apply constant step frequency, but is able to go faster more reliably if gradually accelerated to target rpm. Similarly, slowly braking can help the motor stop on the target instead of missing it due to load inertia.

Change motor speed

Hi, I was wondering if it would be possible to change the speed of the motor.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.