laurb9 / StepperDriver

Arduino library for A4988, DRV8825, DRV8834, DRV8880 and generic two-pin (DIR/STEP) stepper motor drivers
MIT License
556 stars 228 forks source link

Smooth transition between movements in LINEAR_SPEED Profile #112

Open vovagorodok opened 2 years ago

vovagorodok commented 2 years ago

There no posibility to make movemebts where starting/ending RPM is not zero. For example moves like: image Proposed in BasicStepperDriver to have method like:

void move(long steps, float startRPM, float endRPM);
or
void move(long steps, float endRPM); // end remember last/startRPM = endRPM

For more motors:

void move(long steps1, long steps2, float endRPM1, float endRPM2);

It will open possibility to make constructions/chains like:

void move(steps_to_x1, steps_to_y1, -1, 4);
void move(steps_to_x2, steps_to_y2, 4, 1);
void move(steps_to_x3, steps_to_y3, 0, 0);

Or there is another idea how to make that moves?

laurb9 commented 2 years ago

This is a limitation of this simple library. This library precalculates the expensive acceleration parameters before the move. To change speed on-the-fly it would have to do so between steps, it might take too long for slower chips.

You could try the AccelStepper library

laurb9 commented 2 years ago

If the movement is complex and the project can afford an additional 328, you could load GRBL (the CNC control language that 3D printers also use) and send G-code commands to it over serial from your main processor. It's designed for multi-axis control so you can easily drive even 3 or 4 motors with it.