Update : The original version is outdated and removed.

Szia

Ok, let’s forget about microstepping for a second and just talk about stepper motor physics. Bear with me while I walk through the logic.

The reason they “step” is that they have a series of rotor and stator teeth inside, and when you energize a coil, the teeth want to line up a certain way. (The rotor turns to reduce the tooth airgap and thus minimize magnetic circuit reluctance, but for simple purposes we can just say the teeth are attracted to each other.)

When the teeth are aligned, the rotor is at equilibrium, and there’s no torque. Any disturbance of the rotor from its aligned-equilibrium position lengthens the airgap at the teeth and thus makes the magnetic field pull more in that direction, thus generating torque.

The torque produced by misalignment is a sine function of how far out of alignment the teeth are:

  • At one full step position error (teeth 1/4th of the way to the next equivalent aligned position), sin(90)=1 and you get maximum torque.
  • At two full steps of position error (teeth 1/2 of the way to the next aligned position), sin(180)=0 and the desired tooth alignment and NEXT equivalent tooth alignment exert equal pull, so there’s no torque.
  • At three full steps of position error, you get peak torque AWAY from the desired position.
  • At four full steps of position error, you’ve reached a new equilibrium position with teeth aligned, and you’ve officially lost position by skipping steps. (Two-phase steppers always skip in increments of four full steps at a time.)

This is the torque relationship for an ideal stepper:
rotor_torque=max_torque*sin(error)
Error is the rotor teeth alignment phase angle, where each full step is 90 degrees and each equivalent tooth alignment position is four full steps apart or 360 degrees.

Real motors have some non-ideality here (deviations from an exact sine function) due to detent torque and rotor/stator geometry details, but in practice for the kind of small steppers we use in 3d printers, the sine function is accurate enough that we don’t really need to worry about anything else.

That’s all for full-stepping, where only one coil is energized. Now let’s bring in microstepping.

If you energize two coils, the teeth are attracted two different ways, and the rotor’s equilibrium position is determined by the relative magnitude of the coil currents. Both coils energized = teeth halfway between two aligned positions.

Modern stepper drivers output coil currents according to A=sin(angle) and B=cos(angle) so that the torque is constant, heat production is constant, and the microstep angles are distributed properly.

For an ideal stepper (again, ignoring detent torque and such) once you energize the coils in that proper sin&cos ratio, FOR ALL PRACTICAL PURPOSES, you’ve changed the position of the stator teeth that attracts the rotor teeth. There is zero functional difference between a full-step position with the rotor and stator teeth physically aligned, and a half-step position with the rotor teeth aligned with the effective magnetic position of the field between the two sets of stator teeth.

Regardless of where the microstepping driver says the equilibrium position is – aligned with teeth, or halfway between teeth, or some intermediate value – the rotor ALWAYS chases the equilibrium position with torque=max_torque*sin(error).

As far as torque generation is concerned, the ONLY thing microstepping does is allow the motor’s equilibrium rotor position to be between physical stator teeth.

When the motor is stationary, it will try to reach its equilibrium position, just like a pendulum tries to point downward. Any friction or static load (such as gravity) will offset the motor from its equilibrium position. Any abrupt disturbance will cause it to oscillate around the equilibrium until damping settles the rotor to a stop. Any load while the motor is stopped will deflect the rotor position like it’s mounted on a torsion spring: more displacement (=error) means more torque pushing back.

When the motor is rotating at speed, the rotor CHASES the equilibrium position, with a lag error that corresponds to how much torque the rotor is exerting to overcome friction or load. If you’re coasting with no load, the rotor will be exactly where it’s commanded to be. If you have a friction load that requires the maximum motor torque to overcome, the rotor will always be 1 full step (90 degrees phase) behind its equilibrium position. Error = torque.

All of this torque behavior so far is 100% unrelated to microstepping. Microstepping just gives you more intermediate positions for the equilibrium.

But there’s a hitch here – when you step the motor, the target/equilibrium position doesn’t change smoothly. It changes in steps as the driver receives step pulses and quickly changes the coil energization. So the rotor – which has mass and inertia and can’t accelerate instantly – is chasing a target that keeps jumping ahead of it. However big the jump is determines the error and thus torque that launches the rotor into the chase towards the new equilibrium position.

When you do full-stepping, you’re taking giant jumps all the way to max motor torque every time you step the driver. That’s extremely violent, and you get crazy resonance as the rotor oscillates around the new equilibrium position.

When you do very fine microstepping, you’re adjusting the target position in a fast series of very small jumps. The rotor is smoothly chasing a target that never gets all that far ahead of it. So the error is smaller, and less torque builds up before the rotor accelerates and catches up with the new equilibrium.

So, microstepping DOES result in less motor torque being exerted during motion, but only because you’re simply not asking the motor to work as hard. That’s a GOOD thing. The motor’s intrinsic torque/error behavior hasn’t changed.

For a car analogy – full-stepping is like driving your car by alternating stomping the gas and stomping the brakes every ten feet of road. Fine microstepping is like giving the car the gas it needs to go the speed you want. There’s no difference in the engine’s torque capacity either way; you’re just not using all the torque when you drive smoother.

Getting back to printers. Your stepper’s torque/error relationship is constant regardless of microstepping level. If you have X newtons friction load for the motor to overcome, that will result in Y micrometers of position error. Period. Whether you tell the motor to stop on a full-step position or 1/16th step position doesn’t change the torque required to overcome friction, and thus it doesn’t change the magnitude of the positioning error.

Now let’s consider what happens when you try to make a small motion from a stop.

  • One full step: torque greatly exceeds friction immediately, so the motor violently accelerates to the new position, overshoots nearly a full step, then oscillates and eventually settles. The final position has an error proportional to the friction torque.
  • Sixteen 1/16th steps: the motor starts building torque as the first few 1/16th steps of error build up, then torque exceeds the static friction and the motor accelerates smoothly up to speed, reaches the target position with minimal overshoot, and stops. The final position has an error proportional to the friction torque.

The microstepped version is smoother, has less overshoot, and lets you stop in more places (higher resolution). There’s no downside at all.

Wow, thank you for this great explanation and all your patience with me :smiley:
I really have the impression that I can learn something about steppers from you and would like to take this opportunity!

I’ve read a lot of articles and papers about this topic. But seriously, either they are contradictory to other articles or they are just confusing for a not so well experienced person in this topic. Quite disappointing…

So far I can follow you in most of the points I think.
But even in your last example you are jumping from 1 full step to the next one. Just in 16 steps. Now let’s imagine you’ll just move from 3 of 1/16 to 10 of 1/16. That means just 7 microsteps of movement. With these 7 steps I have to overcome the friction in order to make the load move towards the target position at all.

And this is also what we do in 3d printers the whole time. If we just move between full steps we would never reach the accuracy we need. So even though it’s very unlikely that move the stepper just one single microstep it’s indeed very likely that we move it just (I. E.) 7 microsteps and then stop it again.
And that is basically why I ask all these stupid questions :smiley:

Right, now you’re seeing why we need really low friction in a 3d printer – the higher your friction, the less likely it is that a small commanded movement will build up enough position error and thus torque to overcome friction and move the desired amount.

I really need to finish the last two chapters of my 3d printing book so people have a good resource to learn about this stuff…

So what I basically do in my excel sheet is to calculate a motor which is able to overcome the friction even for a single microstep (in theory). Friction, by the way, is included in my equations.

What I might recommend instead is that you calculate a motor where the error due to friction (and acceleration too) is only, say, 0.01mm (or other “acceptable error” limit). That way, you don’t give people the idea that they need a stronger motor to use finer microstepping. You DO need a stronger motor to get better precision or accelerate faster.

@Ryan_Carlyle
OK, that means we can conclude that my calculation /interpretation is not completely wrong. It simply doesn’t make that much sense in real world applications to think this way.

I really like your idea and in fact I thought about something similar after your big useful and thorough explanation.

I’ll try to find an elegant way to calculate that.

I think I found another mistake. I’ve included the current limiter as percentage and I reduce the torque by this microstepping torque reduction thing. But why the hell do i reduce the torque to 71%? I think I have to remove that one too.

After I’ve worked a little bit with your speed/torque curve sheet I like it more and more.
I would really like to include this in as a slightly modified version into my sheet. But I’m not 100% sure if the MIT license is also valid for this sheet.

the 71% might be converting from the exaggerated “two coils on at rated current” torque rating that a lot of manufacturers use. That threw me for a long time – some motor ratings are single-coil-on, and some ratings are two-coils-on, and if you don’t know which one it is, everything is off by a factor of sqrt(2) or sqrt(2)/2.

MIT license applies, sure. (TBH, my choice of license here is more for the liability disclaimer than the sharing aspect.) Actually, you can feel free to post derivatives under whatever license you like, as long as you give attribution & link back to the Github.

I guess you’re right. But then I dont understand why I wrote “63% or 71%”. Anyway, I’ll just do it the same way like you did it in the Speed/Torque sheet. Much more elegant.

Of course I’ll give attribution & backlink. I had the plan to link to your StepperSim anyways.

If you are interested I’ll inform you as soon as I updated my sheet with all the modifications.

@Ryan_Carlyle
One last question :
Actually I have a lot of problems understanding the incremental torque curve equation.
Basically all sites refer to more or less the same equation.
http://www.micromo.com/media/wysiwyg/Technical-library/Stepper/6_Microstepping%20WP.pdf

But for some reason this equation doesn’t give any useful result. So maybe i’m a little bit stupid here or I misunderstand something.
How the hell do they get the percentage values from the results that this equation gives me?
I just get totally strange (even sometime s negative) torque value. And when I look on the equation it totally makes sense because of the SIN() function.

Any ideas?

Forget what I wrote. Excel is working with rad instead of degrees in the SIN() function. I didn’t know that. So I just have to use PI()/2 instead of 90° :smiley:

Oh yeah, that one gets me on a regular basis.