I'm trying to create a stepper motor speed profile where the total time, number of steps and acceleration are known and max speed is be calculated. I believe I have got the formula correctly down to this.

$$ total steps = (total time * speed) - (\frac{3 * speed^2}{2 * acceleration}) $$

and now I am stuck, trying to rearrange so I have speed as a single term and can solve for it. I'm very rusty at rearranging equations so I was quite pleased I got this far, but I just can't seem to get speed on it's own. Can anyone help?


Write $$\begin{align} s&=total steps\\ t&=total time\\ a&=acceleration\\ x&=speed, \end{align}$$ so that the equation becomes $$ s=tx-{3x^2\over2a}$$ Multiply through by $2a$ and bring all terms over to the left-hand side:$$ 3x^2-2atx+2as=0$$ This is a quadratic equation with two solutions: $$ x= {2at\pm\sqrt{4a^2t^2-24as}\over6}={2at\pm 2\sqrt{a^2t^2-6as}\over6}= {at\pm \sqrt{a^2t^2-6as}\over3}$$

For the square root to make sense, we need $a^2t^2\geq6as,$ that is $at^2\geq6s.$ Note that the square root will be less than $at$ so that this formula gives two positive numbers as possible values of the the speed. If your original formula is correct, you'll have to use some other information to determine which value represents the actual speed.

You should post your derivation of the formula so we can see if you've somehow introduced an extraneous solution.

  • $\begingroup$ Thank you for taking the time to answer this. It helped a lot. It looks like I made a mistake in my derivation. I worked it back through and it should be 2x^2 not 3x^2. Putting that in and following your example worked perfectly. $\endgroup$ – microwavesafe Oct 26 '18 at 9:03
  • $\begingroup$ Glad to hear it. $\endgroup$ – saulspatz Oct 26 '18 at 13:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.