Update :
The original version is outdated and removed. I’m actually working on a new one with a lot of fixes, improvements and additional features. Stay tuned… 
---------------—----------------
Finally I have something to share with this great community :
During the last weeks I’ve spend a lot of time on finding the right stepper motor for my new printer. During this time I’ve learned quite a lot and I’ve also noticed that there are a lot of myth about stepper motors in the 3D printing area.
So I decided to put some of the things I’ve learned into a small excel sheet.
With this sheet you’re (theoretically) able to calculate the exact right motor for your printer.
Well, at least I hope so 
And this is the reason why I write this here :
I’m definitely not the big math expert.
The main math in this sheet is based on the equation you can find in this PDF :
http://www.leadshine.com/Pdf/Calculation.pdf
I’ve added a lot on top of that. And in addition there are some reference values for different weights of usually used components.
So it would be nice if someone could check this sheet and play with it a little bit. I would really like to get some feedback.
By the way, I don’t say that it’s finished. It’s probably also full of mistakes. But I’m getting blind on this sheet now 
I forgot to mention that the License is Creative Commons Attribution Share-alike
https://creativecommons.org/licenses/by-sa/4.0/
https://drive.google.com/file/d/0B_-h02LnrYqbUjFURGFmNUtCa1U/view?usp=sharing
Cool! Love stuff like this.
Some things:
- Your “distance until final velocity” calculation ignores the starting velocity provided by the jerk. (Unfortunately, the way your jerk setting turns into starting velocity varies by firmware, but you can ballpark it with vi = jerk.)
- Your R2x example has the motor specs way off. Here’s the datasheet for the R2x XYAB motors: https://groups.google.com/d/msg/3dprintertipstricksreviews/m-I-B84Zq-4/qFJ_i1VICQAJ
- Your R2x example has an 8mm rotating rod but it’s actually 5mm.
- The “total force during jerk” calculation is nonsensical. It’s quite complex to calculate the actual jerk force, because it’s effectively an elastic impact of a moving mass against a torsion spring. Basically the stronger the motor is, the stiffer the spring, and the higher the peak force is.
- Inertia-matching the load and rotor isn’t all that important with open-loop steppers. It more indicates a non-optimal drivetrain ratio than any particular performance problem. For example, in the R2x, you could use a smaller motor with a 2:1 reduction gear to get better acceleration performance. But the mechanical complexity and backlash added by the gearing isn’t merited by the small performance improvement. Unlike servo tuning, where inertia ratio affects stability, for us it’s just one of several factors that goes into a holistic drivetrain design.
I have to get to a meeting, I’ll try to spend some more timing going through the sheet later.
Have you seen this? It’s focused on the electrical side for now, but I’m planning on adding drivetrain calcs to it eventually. https://github.com/rcarlyle/StepperSim
- The way you’re interpreting microstepping torque is wrong. The motor doesn’t LOSE torque when you use microstepping. The same total torque is simply applied in smaller stairsteps so the motion is smoother. You can do one full step to get 100% torque, or sixteen 1/16 steps to get 100% torque, and it’s the exact same motor output – except the 1/16 stepping is smoother, quieter, and has less resonance. You don’t lose anything. What you’re calculating here is basically applying a ~5:1 safety factor for 1/8th microstepping and a ~10:1 safety factor for 1/16th microstepping and so on, which is not logical.
- Your “needed torque” calculation doesn’t take into account any sensible form of jerk torque. Most 3d printer motor torques goes to minimizing ringing caused by jerks. Most popular printer designs have something on the order of a 40:1 torque safety factor if you only look at acceleration, friction, and weight, and ignore jerk. (Jerk will basically use as much torque as you’re willing to give it. More torque = less ringing at corners due to jerk causing rotor position overshoot. Torque doesn’t help with rod flex though.)
- Your micrometer resolution calculation is off by a factor of 10.
I like the list of stepper specs!
@Ryan_Carlyle
Thank for reviewing the sheet. And thanks for the input. I have so many iterations of this sheet, I’m really getting blind on it. So I really appreciate your comments!
-
You are right. Initial velocity is missing there. I had it an earlier version. I really dont know why it’s not included here. I’ll correct that of course!
-
Thanks very much for the specs of the motor. Unfortunately there is no label on my Rep2X motors. And I could find the datasheet. But I had some steppers on my table with exactly the same size. So my data was an assumption from this datasheet. And in fact the most important value (rotor inertia) was correct. But to calculate the torque-cutoff speed I of course need the right current, resistance and inductance. I’ve corrected this!
-
I dont know why I’ve measured 8mm. But of course you are right, it’s 5mm 
-
I had the same impression about the JERK topic. And the idea was basically to give an impression about the needed force to overcome the sticking effect in the bushings i.e… Here you have to apply additional forces compared to the moment where evrything is already sliding. But maybe it just leads to too much confusion and should be removed.
But I’m not quite sure if I can agree on the point regarding the inertia matching. On the Rep2X, and a lot of other printers you’ll see the ringing effect generated by this. Well, of course, the whole topic is much more complex than the sheet is able to calculate. But the basic message is :
If you have a big mismatch, increase the torque even more or reduce the acceleration. And damping is also not considered in the sheet by the way 
I’ve tried this on the Rep2X with 2 steppers, 1 stepper and bowden. With the last variant I was able to drive the acceleration way higher without ringing artifacts.
-
Of course you won’t LOOSE torque. But the incremental torque is reduced. And therefore you have to increase the basic available torque in order to secure that you have enough torque available in each microstep. Simply because the printer will not rest on full steps only. In fact in most of the cases the printer needs to stop between the full steps.
http://machinedesign.com/archive/microstepping-myths
So yes and no. I’m applying a big safety factor but because the calculation expects the worst case. And of course the printer also needs to work in such a situation 
By the way, on my Rep2X I can also see that, as soon as I drive the Acc. higher than 1000, the printer really starts to print like mad.
-
You’re right. JERK is not included here. And this is still something I would like to include. But I still have no really realiable way how to do it. Maybe you have any ideas? In principle we could secure this by the already included safety factor value. But I would really like to include an impression of how much is really needed.
-
Of course you are right. There was a 0 missing 
Oh and before you start to say anything about the included “print time calculator”. It’s really just a small thing to give me an impression of the influence of parameters on the print speed. I would never use it as a real benchmark 
@Ryan_Carlyle
I had a short look on your sheet. Ok, thats obviously more or less only for the electrical side of the topic. But very very interesting indeed. My approach was more related to the kinematic side.
If I understand your sheet correct, than there is actually no load at all included. Even not the rotor inertia. Or do I miss something here?
By the way, maybe this is also interesting (even though I have the impression that you know these things already)
http://www.geckodrive.com/support/step-motor-basics/accuracy-and-resolution.html
It also shows the relation between resolution, accuracy and torque.
But for noise it’s of course a good idea to use more microsteps. But in most of the printers the most of the noise is not transmitted be the stepper itself. It mainly comes from the rest of the structure. So we basically have structure born noise in the first place and then air borne noise. By building a stiffer structure with some damping between the motor and the structure would lead to the same noise improvements. Or even more.
I guess the ideal (and much more complex) sheet would be a combination of both 
- The R2x Y motor is probably undersized, that’s true, but the X bridge rod bending is arguably a bigger source of ringing. The span is too long and the weight of two direct-drive extruders is too high for 8mm rods. You could have the biggest, beefiest motor in the world in there and you’d still get a lot of ringing.
Whether rotor overshoot or rod/frame flex is a bigger issue will really depend on the printer. In the few times I’ve done rigorous calculations, both effects have been around the same magnitude.
All the typical low-inductance steppers used in 3D printers have a pretty narrow range of torque-per-amp specs. In the specific case of the R2x, the stock stepper driver output is capped at 0.8A, so a larger motor with similar electrical specs is WORSE (same torque but with more rotor mass) unless you also swap out to higher-current stepper drivers. (I have some suggestions for how to do that if you’re interested, but I won’t get into it for the moment.)
- “And therefore you have to increase the basic available torque in order to secure that you have enough torque available in each microstep.”
This is a difficult subject. The magnitude of the incremental microstep torque only matters if you care about each and every individual microstep resulting in corresponding drivetrain motion. On face, sure, we care, because microsteps give us resolution. But the smaller the microsteps get, the less we care about each individual one being faithfully executed without error. If it takes two or three 1/1t6th-steps to get the printer moving from a dead stop, that’s fine. The motor has to have some rotor position undershoot/overshoot to produce torque anyway. The nozzle always lags slightly behind the desired position when accelerating and overcoming friction, simply because steppers generate zero torque when the rotor is at the commanded position.
A good way to look at it is that microstepping provides enhanced resolution and smoothness of motion until the incremental torque falls below the drivetrain friction, at which point progressively finer microstepping only decreases noise without any impact on motion fidelity. But the motor’s torque-vs-error response under load is 100% independent of microstepping level.
- The problem with jerk is that nobody else runs steppers the way GRBL-derived 3d printer firmwares do. There’s basically nothing in the academic literature for motion dynamics OR stepper mechanics about having positive speed through a sharp corner. (Because it’s a physical impossibility if you neglect the elasticity of the drivetrain.) The simplest method I’ve come up with (original research here) is to treat the stepper motor as a torsion spring (based on the nearly-linear torque/error region from 0 to 1/2 step of error) and convert the kinetic energy change involved in the “instant” velocity jump into potential spring energy stored in the torsion spring. The position of the torsion spring is the rotor overshoot produced by the “jerk” velocity jump.
I have a pretty lengthy write-up on this in my 3d printer engineering book… need to get off G+ and get it finished and published…
The sheet I have in github is purely electrical, no load behavior. You use it to pick drivers and find the motor’s top speed in a much more accurate way than the heuristics provided by Gecko and Leadshine etc.
I also have some unpublished sheets that I need to clean up and upload – charting dynamic load-following behavior during jerk+acceleration, another one to find the motor specs required to minimize ringing due to jerk, and a sheet that spits out a predicted torque/RPM curve based on motor specs. (Really proud of that one – it’s novel and pretty accurate as far as I can tell.)
@Ryan_Carlyle
Oh, the torque/RPM curve thing sounds very interesting. I’ve spend a lot of time finding useful information’s about the math behind it. But with my very limited knowledge about this particular electrical topic it’s almost impossible for me to build something useful in Excel.
In the end I’m just an mechanical engineer with some basic knowledge about electronics. 
Please let me know if you upload something new!
If I remember tonight, I’ll go ahead and share the torque/RPM curve sheet. It’s a relatively simple calculation… just took me about a year to put the pieces together on how to predict motor back-emf and factor the chopping driver behavior into the voltage/inductance/current calculation.
Again regarding point 5)
From my understanding we have to care about each and every single microstep on 3D printers. Especially because it’s an open loop system. As soon as we loose steps we’ll loose the position. And in fact we use every microstep to get more accuracy.
If you use an TMC2100 driver i.e. it probably doesnt matter. Here you could use i.e. 8 microsteps as input from the controller and interpolate them to 256 in the controller.
So the printer can only stop the gantry on 8 steps but in between them the controller will reduce the noise by using interpolated microsteps.
I just had a short look on my sheet again. At your first point you mentioned I could use JERk as Vi. I wrote that I thought that I’ve done that on earlier versions. Now I’ve checked the sheet again and it’s in fact the case that I’m still doing exactly this. It’s in the “Time for velocity change” calculation.
Is it not included in your copy of the sheet?
I don’t think I’ll have time today to fully explain the microstepping thing, and it really needs some illustrations to do right, so I’ll just drop that one for now. I’ll leave it with a statement that the way LOTS of people think about microstep torque is wrong, and you have to really understand the way the stepper’s torque relates to rotor position error to get it.
For the “distance until final velocity” calculation you’re missing a vit term. You have the d=1/2at^2 part (distance of travel due to constant acceleration for a particular time), and your t term is correct, but when you have an initial velocity, the distance equation is d = vit + 1/2at^2.
Got the torque curve predictor cleaned up and uploaded. Enjoy. https://github.com/rcarlyle/StepperSim
+1+1+1+1
C’mon, this is indeed pretty damn awesome.
That’s excatly what I try to calculate since weeks without success. I simply couldnt find reasonable resources to explain the math.
But obviously I found someone who already just did it 
Just a short question, are you also able to calculate the resonance frequency’s?
Of course they would be highly theoretical because you never know exactly the damping in the system i.e… But an approximation of these harmonics could be interesting.
@Ryan_Carlyle
Just a small question :
Are you sure that the unit in the “rated torque” field is Ncm and not Nm?
Finally I think I can follow you somehow on the microstepping torque topic. I’ll try to make some adjustments.
Good catch on the torque field, I didn’t set that up right. I corrected the issue and went ahead and added a dropdown to input your own units, just to make it easier for people. Thanks for the help!
Well that was really not a big thing. But you’re welcome!
On resonance, I’ve never bothered, but it’s possible with some simplifying assumptions. If you treat the stepper’s torque/error relationship as a torsion spring, and the entire drivetrain as a rigid mass attached to the rotor (using the appropriate reflected inertia calculation) AND you make up an assumed damping factor, then you can come up with a resonant frequency. But it won’t be very accurate.
What we typically have in printers is a two+ spring and two+ mass system. For a simple stage like X in the R2x, the rotor+pulley is one mass, then you have a slightly-viscoelastic belt coupling, then you have a carriage mass. There isn’t one resonant frequency in that system. If you wanted to get rigorous (which isn’t even remotely worth the effort, in my opinion) you would have to derive a transfer function to model up the mass impedances, and then make a Bode plot showing the excitation response vs input frequency.
In any case, fine-microstepping motors viscoelastically coupled to their load (ie with a belt) basically never have mechanical resonance. The magnitude of the excitation due to each microstep is so small that the damping effects and motion decoupling effects dominate. On the other hand, Z stages with rigidly-coupled screws (particularly low-friction ball screws) can be prone to resonance, but I’ve only ever heard of it happening in 3d printers using 1/4th or coarser microstepping.
@Ryan_Carlyle
Thanks. I also found some interesting papers about this topic. In principle they say the same like you said.
But I would like to talk again about this microstepping thing. You say, and I agree on this point, that the torque won’t be reduced when I start to use microstepping. But what will be the effective torque between each single microstep? The incremental torque. Isn’t it 9,8% in the case of 1/16?
Of course there will be some kind of positioning error. And in dynamic situations, especially on higher speeds, the microsteps are not that important anymore. But if we run slow and have to stop somewhere between the full steps, which is basically always the case, isn’t it the incremental torque that is important?
So the way how my calculation interpreted this is “secure that you have the same torque in every incremental step like you would have without microsteps” (more or less)