Stepper Motor acceleration profiles for short runs

You always need a deceleration ramp, or you'll incur a jerk and/or overshoot the target. My company uses acceleration and deceleration times, as in the time it takes to get from 0% to 100%. This is equivalent to an acceleration of

$$ a = \frac{\Delta v}{\Delta t} \\ $$


$$ \Delta v = v_{\mbox{max}} \\ \Delta t = \mbox{time to accelerate from 0 to }v_{\mbox{max}} \\ $$

Whatever convention you use to define your acceleration and deceleration rates, you should convert to "proper" acceleration rates, length/time^2.

Inline Mathjax (LaTeX) isn't enabled on this site, which is kind of a pain, but I'll use acceleration as a sub-positive and deceleration as a sub-negative, as in:

$$ \mbox{Acceleration} = a_+ \\ \mbox{Deceleration} = a_- \\ $$

You can use acceleration and top speed to get the time to top speed as:

$$ \Delta t = \frac{v_{\mbox{max}}}{a} \\ $$

Double integrate acceleration to get displacement:

$$ dS = S_0 + v_0\Delta t + (0.5)a\Delta t^2 \\ $$

Assuming your starting position is zero and your starting speed is zero, that reduces to:

$$ dS = (0.5)a\Delta t^2 \\ $$

So you have two distances that you can travel, which aren't necessarily the same - the distance you traverse on acceleration, and then the distance you traverse on deceleration. If the accel/decel rates are the same then the distances are the same, but this seems to be the confounding point for you if they're not.

No worries! You have a time to accelerate to top speed:

$$ \Delta t_+ = \frac{v_{\mbox{max}}}{a_+} \\ $$

And you have a time to decelerate from top speed:

$$ \Delta t_- = \frac{v_{\mbox{max}}}{a_-} \\ $$

So you have a distance you traverse on acceleration and a distance you traverse on deceleration:

$$ dS_+ = (0.5)a_+\Delta t_+^2 \\ dS_- = (0.5)a_-\Delta t_-^2 \\ dS_{\mbox{total}} = dS_+ + dS_- \\ $$

This is your test condition. If your targetDistance is greater than dS (which is the combination of dS+ and dS-) then you will need some coast time at top speed. The coast time is:

$$ \mbox{distanceRemaining} = \mbox{targetDistance} - dS \\ \Delta t_{\mbox{coast}} = \frac{v_{\mbox{max}}{\mbox{distanceRemaining}} \\ $$

If your targetDistance is LESS than dS, then you need to crop your acceleration and deceleration ramps. This means solving for the new top speed. Working out the dS equation from earlier:

$$ dS_{\mbox{total}} = dS_+ + dS_- \\ dS_{\mbox{total}} = (0.5)a_+\Delta t_+^2 + (0.5)a_-\Delta t_-^2 \\ dS_{\mbox{total}} = (0.5)a_+\left(\frac{v_{\mbox{max}}}{a_+}\right)^2 + (0.5)a_-\left(\frac{v_{\mbox{max}}}{a_-}\right)^2 \\ $$

Pull out the vMax term:

$$ dS_{\mbox{total}} = \left((0.5)a_+\left(\frac{1}{a_+}\right)^2 + (0.5)a_-\left(\frac{1}{a_-}\right)^2\right)\left(v_{\mbox{max}}\right)^2 \\ $$

Acceleration terms cancel:

$$ dS_{\mbox{total}} = \left((0.5)\left(\frac{1}{a_+}\right) + (0.5)\left(\frac{1}{a_-}\right)\right)\left(v_{\mbox{max}}\right)^2 \\ $$

Pull out the 0.5, too:

$$ dS_{\mbox{total}} = (0.5)\left(\left(\frac{1}{a_+}\right) + \left(\frac{1}{a_-}\right)\right)\left(v_{\mbox{max}}\right)^2 \\ $$

Then clean it up and start solving for vMax:

$$ dS_{\mbox{total}} = (0.5)\left(\frac{1}{a_+} + \frac{1}{a_-}\right)\left(v_{\mbox{max}}\right)^2 \\ 2\left(dS_{\mbox{total}}\right) = \left(\frac{1}{a_+} + \frac{1}{a_-}\right)\left(v_{\mbox{max}}\right)^2 \\ 2\left(dS_{\mbox{total}}\right)\frac{1}{\left(\frac{1}{a_+} + \frac{1}{a_-}\right)} = \left(v_{\mbox{max}}\right)^2 \\ $$

The acceleration terms can be cleaned up by cleverly multiply by one in the form of a+/a+ or a-/a-:

$$ 2\left(dS_{\mbox{total}}\right)\frac{1}{\left(\frac{a_-}{a_-a_+} + \frac{a_+}{a_-a_+}\right)} = \left(v_{\mbox{max}}\right)^2 \\ $$

Now those fractions add:

$$ 2\left(dS_{\mbox{total}}\right)\frac{1}{\left(\frac{a_- + a_+}{a_-a_+}\right)} = \left(v_{\mbox{max}}\right)^2 \\ $$

So now they can be inverted:

$$ 2\left(dS_{\mbox{total}}\right)\left(\frac{a_-a_+}{a_- + a_+}\right) = \left(v_{\mbox{max}}\right)^2 \\ $$

Which finally leaves:

$$ v_{\mbox{max}} = \sqrt{2\left(dS_{\mbox{total}}\right)\left(\frac{a_-a_+}{a_- + a_+}\right)}\\ $$

Once you have this, you go back and re-calculate the acceleration and deceleration times (t+ and t-) and that gives you your new speed profile.

Final note/P.S. - Note that if a- is equal to a+ (drop the subscripts and just use 'a') that you get:

$$ v_{\mbox{max}} = \sqrt{2\left(dS_{\mbox{total}}\right)\left(\frac{aa}{a + a}\right)}\\ v_{\mbox{max}} = \sqrt{2\left(dS_{\mbox{total}}\right)\left(\frac{a^2}{2a}\right)}\\ v_{\mbox{max}} = \sqrt{2\left(dS_{\mbox{total}}\right)\left(\frac{a}{2}\right)}\\ v_{\mbox{max}} = \sqrt{\left(dS_{\mbox{total}}\right)a}\\ $$

I know from great experience that sometimes the hardest part of reading papers is that the authors all seem to believe the math is trivial for a particular step, so they skip sometimes crucial (to us) points in the derivation, or bad authors omit the derivation entirely. For that reason, I've tried to be explicit about every step I've taken, but if I've left something off or you're still confused just let me know.