I’m building a camera slider using a wagon driven by a nema17 stepper and ‘big stepper’ driver.

What I want to achieve is/sounds pretty easy, but unfortunately I’m struggling with it for some time now and just can’t figure it out.

parameters:

acceleration distance to get to max speed

max speed

constant speed distance

decelartion distance to go back to zero speed

So: accelerate to a given speed in nnn steps (=distance), continue xxx steps at constant speed and next decelerate to zero speed in zzz steps.

As far as I could find all algorithms I found on the inet are based on David Austin’s algorithms describes in his article David Austin
This includes the Accelstepper library.

In this algorithm you don’t have any control of the amount of steps to accelerate to a given speed.
here the parameters are

the position to move to (or trajectory distance)

max speed

acceleration constant (/deceleration)

the max speed and acceleration are used to calculate the initial delay between the steps at the start and then proceed by changing the delay during each step until the desired speed is reached.

For me the amount of steps and max speed are known parameters so I’m able to calculated the acceleration. But this doesn’t seem to be much of help though. => when deceleration starts the speed is the one of the constant speed so from that point the deceleration should determ what needs to happen to let the speed = 0 after zzz steps.

Anyone who can help me in the correct direction to solve the problem…
Much appreciated!

The problem is: I need to have control over the number of steps needed to accelerate from 0 to a certain speed and/or decelerate to zero.

Accelstepper does not provide this and I think this is due to the algorithm used.

accelstepper parms:

speed

acceleration 'factor'

what accelstepper does:
it calculates the start delay between the first two steps using 'acceleration' and then will calculate the delay for each next step based on the prior delay. This is done until the final speed is reached. In the used algorithm that start delay is essential for the generated acceleration curve during next ?? steps.

Something similar for deceleration.

What I need in my project:

speed

number of steps (=distance) to accelerate to that speed
what it should do:
calculate the acceleration slope in such away the speed will be reached after the number of steps given.

As far I could find out this is not possible using accelstepper. I tried to get this done using accelstepper or other similar code I could find (or created myself) using that same algorithm but all without success. Yes, I could get a smooth acceleration/deceleration but never was able to get control over the amount of acceleration/deceleration steps needed to get to that speed.

When somebody can tell me how to do this using Accelstepper it would be great but IMHO I think I need another algorithm (..) to get this done though.

the max speed and acceleration are used to calculate the initial delay between the steps at the start and then proceed by changing the delay during each step until the desired speed is reached.
Quote
_cn = _cn - ((2.0 * _cn) / ((4.0 * _n) + 1)); // Equation 13
for deceleration this formula is used to calc the amount of steps needed to get back to zero.
Quote
stepsToStop = (long)((_speed * _speed) / (2.0 * _acceleration));
For me the amount of steps and max speed are known parameters so I'm able to calculated the acceleration. But this doesn't seem to be much of help though. => when deceleration starts the speed is the one of the constant speed so from that point the deceleration should determ what needs to happen to let the speed = 0 after zzz steps.