How to deccelerate?

225 views
Skip to first unread message

Zdenek Svezen

unread,
Jun 14, 2022, 8:44:43 AM6/14/22
to accelstepper
Hello,
I need to control the stepper motor with joystick/pontetiometer.

stepper.setMaxSpeed(100);
stepper.setAcceleration(10);    
stepper.move(50000);
stepper.run();

It accelerates from 0 to MaxSpeed. OK.

If I change MaxSpeed during code run to 50 I would expect deccelerating from 100 to 50.
But the speed just drops to 50. Not OK.

How can I enforce deceleration to lower speed?

Zdenek

Jim Larson

unread,
Jun 14, 2022, 3:05:57 PM6/14/22
to accelstepper
AccelStepper does not support decelerating to a new speed. At least, I haven't figured out a way to do that. You can accelerate just fine. I think the fix is fairly easy, but I haven't had time to implement and test.

Zdenek Svezen

unread,
Jun 14, 2022, 3:09:07 PM6/14/22
to accels...@googlegroups.com
What is your idea?

út 14. 6. 2022 v 21:06 odesílatel Jim Larson <jla...@pacifier.com> napsal:
--
You received this message because you are subscribed to a topic in the Google Groups "accelstepper" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/accelstepper/y5v5NqxS4S4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to accelstepper...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/accelstepper/75289bb3-4cc4-4958-b760-7c840a0e6d6fn%40googlegroups.com.

Jim Larson

unread,
Jun 14, 2022, 7:30:27 PM6/14/22
to accelstepper
Basically, I think the code that handles acceleration could be duplicated and modified to handle deceleration. Then a decision statement must be included to choose which to do. Doing adequate testing is the big challenge - and the most important requirement!

Other projects are in the queue ahead of it. Maybe someday.

              -jim

A. Craig West

unread,
Jun 15, 2022, 7:01:36 PM6/15/22
to accels...@googlegroups.com
I was looking at making a version of the code which would allow you to set a destination speed as well as position, which and the code would do its best to be at that speed when it gets to the position, at least within the limits of max speed and acceleration. I put it off until later, though, as I had more urgent issues. I don't think anybody has really looked at my PR on those yet, I should wake it up

You received this message because you are subscribed to the Google Groups "accelstepper" group.
To unsubscribe from this group and stop receiving emails from it, send an email to accelstepper...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/accelstepper/6a4c2266-dd8e-49e1-84b6-ce2c56f141can%40googlegroups.com.

Zdenek Svezen

unread,
Jun 16, 2022, 2:57:58 AM6/16/22
to accels...@googlegroups.com
I have tested FlexyStepper and it is there.
If you go at any speed and you slow down it decelerates.


čt 16. 6. 2022 v 1:01 odesílatel A. Craig West <acrai...@gmail.com> napsal:
Reply all
Reply to author
Forward
0 new messages