# Calculate Total Time AccelStepper ?

Hi everyone!

I would like to know how i could calculate the parametes that most functions of AccelStepper need, such as maxSpeed and Acceleration, given the final position to reach and the total time it should take.

For example, imagine if I would like to go to position 20 000 steps from position 0, in 10 seconds.

How can I find the acceleration and maxSpeed values that meet these requirements?

Stepper Motor’s are designed for positional accuracy not speed. Using this: Stepper motor Speed Calculater shows that the fastest stepper that I have will top out at a little less than 10,000 steps per minute max.

I know they are designed for position accuracy, but what i want is to know the correct parameters that assure me an almost exact time of execution.

You can run the motor to 10k steps either using higher accelerations and speeds or lower ones, the time will be different.

So the library AccelStepper allows to achieve a precise position, but you can't control the total amount of time that spends.

thanks for your reply Kutkikz The maximum torque available from a stepper is affected by the driver, voltage and amps.
The torque needed in the respect of the load depends on the mechanical load.

Know the torque needed for the move and get a stepper than can provide that. Then buy driver and power source according to the needs. Light load allows for faster acceleration and quicker movement, higher speed. A heavy load calls for lower acceleration, brings lower top speed.

Steppers loose torque quickly when speed is increased.

Accelstepper has the Multistepper library:AccelStepper: MultiStepper Class Reference

Operate multiple AccelSteppers in a co-ordinated fashion.

This class can manage multiple AccelSteppers (up to MULTISTEPPER_MAX_STEPPERS = 10), and cause them all to move to selected positions at such a (constant) speed that they all arrive at their target position at the same time. This can be used to support devices with multiple steppers on say multiple axes to cause linear diagonal motion. Suitable for use with X-Y plotters, flatbeds, 3D printers etc to get linear straight line movement between arbitrary 2d (or 3d or ...) positions.

Since it specifies constant speed this is likely to only work at lower speeds. I would Imagine the calculations to include Acceleration would be significant.

Acceleration should be set to the maximum achievable with a specific setup. Then calculate the (max) speed depending on the time to take the required number of steps. Corrections are required only for few steps to take, where the maximum speed may never be reached.

20,000 steps over 10 seconds would require an average velocity of 2000 steps per second. If you could accelerate instantly from 0 to 2000 and decelerate instantly from 2000 to 0 then you are done: Max Speed=2000, Acceleration=infinite.

If you can't have infinite acceleration you will have to allow time to accelerate and decelerate.

The worst case is to accelerate all the way to the half-way point and decelerate the other half of the way. To get there in 10 seconds you need to average 2000 steps per second over each half of the trip. You can do that with an acceleration/deceleration of 800 steps per second per second. At the half-way point, you reach 4000 steps per second so your Max Speed has to be at least 4000.

Things get a lot more complicated if you pick an acceleration greater than 800 and a Max Speed between 2000 and 4000. That gives you a coasting period at max speed. The acceleration average velocity will be half the Max Speed. Same for the deceleration. The average velocity between the two is Max Speed.

Let's try a Max Speed of 3000. According to my calculations that will bring the acceleration+coast to 2000/3000 (2/3rds) the total time, leaving 1/3rd of the time for deceleration. Since acceleration and deceleration are equal, that means 1/3rd time for acceleration, leaving 1/3rd for coasting. To accelerate to 3000 steps per second in 10/3 (3.333...) seconds you need an acceleration of 900 (3000/3.3333).

For a Max Speed of 2500 the acceleration and coast would take 2000/2500 (0.8) of the time. That leaves 2 seconds for deceleration, and 6 seconds for coasting. To get up to 2500 steps per second in two seconds you need an acceleration of 1250 (2500/2).

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.