## What is a Microstep?

xenoputtss
Posts: 47
Joined: Mon Oct 22, 2012 3:17 pm

### What is a Microstep?

just curious. I don't understand how a stepper motor can have "200 step per revolution" and how microsteps works into that? I mean, if you can take a microstep...isn't that a step?

PAPPP
Posts: 52
Joined: Wed Sep 26, 2012 2:17 am
Contact:

### Re: What is a Microstep?

Minimal-Math answer, everything in the ideal case with a bit of over-simplification:
Stepper motors have some number of fixed electromagnetically polarizable coils, which are relatively out of phase with the low-relucatance paths through the rotor, so energizing them in sequence will pull the rotor in one direction or the other by pulling the nearest low-reluctance path in line with the coil (if you've ever played with magnets and bits of ferrous metal this part is physically apparent, even if the math behind it isn't much fun).

Your typical four-wire bipolar stepper has two coils (A and B), with both ends exposed so each can be driven in either direction, and 200 step/rev means there are 200 physical teeth on the rotor that define the low-reluctance paths (they operate in opposed pairs, but there are two coils, so 100 paths in either of two positions). This may make more sense with some pictures. This is why the motor will be labelled with a specific number of steps per revolution.

Energizing a two-phase stepper in the sequence A,B,A,B.. (aka full stepping) will pull the rotor one phase position per pulse, and hold it in the new position with the maximum force of one magnetic coil, because the rotor lines the low-reluctance path up perfectly with the energized coil. This is oversimplified slightly, if you are the visual sort there are reasonably good diagrams for the various drive methods here.

When you half-step, instead of energizing A,B,A,B, you energize A, AB, B, AB, A, AB... and pull the rotor one half position per change, assuming the two coils are perfectly matched and none of the electrical or magnetic portions of the circuit saturate (power supply current exceeded, maximum flux through the rotor, whatever - none of these are great assumptions, but we often get close), and hold the rotor at the intermediate position with the sum of the two forces, each weakened by the flux-carrying path being further from the coils - this is ideally about 1.4x either phase on it's own, because the curves are roughly sinusoidal, but when half-stepping the force is spread out, so you get something like 70% of a full step's torque per half step (which is applied cumulatively, and thus actually more torque per full step or rotation, it just might not move every time you expect it to, which causes a loss of accuracy). Half-stepping is usually OK.

Higher microstepping is basically the practice of splitting current (controlled amounts of current) among multiple phases to scoot the rotor to arbitrary positions between the coils based on the split. This requires fancy electronics (furnished to varying degrees by the different stepper driver chips) to dole out appropriate amounts of current at the appropriate times, and increasingly brings out the non-ideal properties of the motor and controller, which start to eat your accuracy and instantaneous torque as the number of microsteps goes up. By about 1/16 micro-stepping the linked source suggests the torque at each microstep will be a bit less than 10% of the torque generated by a full step, which will result in missing micro-steps and jerking about unpredictably.

Note that a simple AC motor is basically "infinite micro-stepping," and works fine because the torque applied to the rotor is cumulative (up to a point), and unlike in a stepper motor we don't care where the rotor is, just that it keeps moving in the appointed direction. Lots of torque, but no positional control without feedback (which is where servos and the really brutal controls math come in to play).

A decent some-math version of all that can be found here, in part 2 of 5 in a slightly updated version of a tutorial older than the web but younger than the internet. The full-math version is available at your nearest university with an electrical engineering program, as part of a class usually titled something like "EE5xx: Electromagnetic Drives, Pain, and Suffering" (The parts of the one I took that I haven't repressed were pretty fun). Beyond that we are talking about Physics.

dointhangs
Posts: 179
Joined: Tue Jun 05, 2012 7:31 pm

### Re: What is a Microstep?

Pappp fantastic post! Wow I didnt know it was like 10% torque at 16x. I knew it was less but thats something. I think I have seen posts saying that there really isnt an appreciable difference in the work from a 1/8th and 1/16th x/y axis setting for a shapeoko anyways? cheers to you for taking the time for us on this, Love the pics of the inside of the motor and great explanation!
Shapeoko #298, dual drive upgrade, acme z axis, open bed endplates and a slightly larger ("expanded desktop") work area!

cvoinescu
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK
Contact:

### Re: What is a Microstep?

Great explanation, PAPPP. Two things I would like to clarify, one of which is an essential difference between full steps and microsteps.

I need to explain the other one first, so bear with me. The motors we use are called "hybrid" stepper motors, because they have a magnetized rotor. They rely both on the attraction of opposite magnetic poles and repulsion of same poles (DC motors rely on this exclusively) and on the fact that a magnetic circuit creates forces in its components that push to minimize the magnetic reluctance (intuitively, the magnetic field wants to have a short and thick path through iron: so if the poles of the rotor are not aligned with those of the energized coil, it will pull on the rotor in the direction that gets it aligned; non-hybrid steppers use only this effect). Because of the magnetization, the full-step cycle of a hybrid stepper motor is actually coil A, coil B, coil A in reverse, coil B in reverse, then repeat; in short, +A, +B, -A, -B. Half-step is +A, +A+B, +B, -A+B, -A, -A-B, -B, +A-B, and repeat.

The other point relates to how a stepper generates torque. If the rotor of the stepper motor is aligned with the energized coil, it generates no torque at all. If external forces turn the rotor so that it's slightly out of alignment, it generates some torque to restore it to the ideal position. The torque increases as the deviation becomes larger; it reaches the maximum at one full step off. If the deviation increases more, the torque decreases and reaches zero again at exactly two full steps off. That is not a stable position; if the rotor is disturbed just a tad more, it'll generate torque the other way and pull toward the position four full steps away from the desired one. That's how you skip steps: in multiples of four. Because of the nature of the typical load on a stepper, once it got a little more than a full step off from the commanded position, it'll snap back and lose four steps.

So the "holding torque" from the datasheet is the torque exerted when the motor is stationary and forcefully held at one full step deviation, either direction, from the commanded position. (Dynamic torque is less, for several reasons I won't get into.)

With microstepping, you energize both coils in different proportions, and the rotor is pulled toward an intermediate position. At 1/16 microstepping, if you force the motor one microstep away from the commanded position, the restoring torque is, indeed, 10% of the full step holding torque. However, if you keep turning it, the torque will continue to increase up to one full step away from the commanded position (that's 16 microsteps), reaching the rated holding torque. Then it will decrease and the motor will snap to the position four full steps away (thus losing 64 microsteps).

So, a microstepping motor can be commanded to a position with a finer resolution (e.g. 3200 positions instead of 200, or 0.1125 degrees), but its torque is still maximum when it is one full step away from the commanded position (e.g. 1.8 degrees). It's misleading to say that a 1/16 microstepping motor has only 10% of the torque of a full-step motor; that is true only if you accept a deviation of only one microstep. A 200-step motor with 1/16 microstepping is not nearly as good as a 3200-step motor of the same rated holding torque (although the latter would be bigger and much more expensive). However, compared to the same 200-step motor with full stepping, it has better positioning accuracy at low load, and the same torque and (absolute) positioning accuracy at high load.

In short, you don't lose anything when microstepping (especially not torque), and you gain more accurate positioning at low load. The only downsides are the more complex circuitry (not a problem these days, it's all in the IC) and the larger number of step pulses needed (so the controller needs to work more).
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk

cvoinescu
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK
Contact:

### Re: What is a Microstep?

Looking at PAPPP's second link, I realized that what I described as the full step sequence is actually a variant called wave stepping. The correct full stepping is +A+B, -A+B, -A-B, +A-B, then repeat.
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk

xenoputtss
Posts: 47
Joined: Mon Oct 22, 2012 3:17 pm

### Re: What is a Microstep?

Thanks PAPPP and cvoinescu. This explains a lot. It also explains why when I had my board doing 1/1 microstepping I was getting a lot of vibration and noise, but when I went to 1/8 microstepping it got a lot quieter.

since you mentioned the +A +B -A -B for poles, it made me realize that perhaps the way i have the wires arranged when connected to the board may be wrong (even though my machine is working).

So, aside from getting the wire pairs setup correctly, should I figure out which wire is (in the pair) is + or - (I know it has to do with the direction the current is flowing)?

PAPPP
Posts: 52
Joined: Wed Sep 26, 2012 2:17 am
Contact:

### Re: What is a Microstep?

I was trying to avoid the discussion of wave stepping and polarity, since it makes the mental model more complicated, but yeah, you (cvoinescu) are correct, and since I bothered to introduce polarity in describing the motor I should have just gone with it. As you point out, the second link with the nice waveforms makes that clear. In a related matter, it's always good to note that most datasheets actually quote the 1.4x holding torque, not the single phase, both because it is bigger and looks better, and because pretty much everyone steps in one of the patterns that produces it if they aren't microstepping, so it is a more relevant number.

The issue with saying you don't lose any torque when you microstep is that you don't lose any torque over a full step's worth of motion, as I was talking about with the cumulative effects in the half-stepping part. You do get 10% torque on each microstep, which will result in weird smearing and mistimed motions as the motor jumps through various inconsistent fractions of a step when the resistance on the shaft is overcome, rather than the exact pattern the controller is sending. The rule of thumb I've always seen is that until your torque per microstep drops below your load torque, microstepping will give you smoother motion, but little else.

xenoputtss: The motor polarity is determined by the connection pattern, not any sort of property inherent to the motor, the coils really are just coils of wire (likely more than one) around a core with a lead sticking out from either end. Swapping the pairs around can change the direction of motion for a given sequence of pulses, but otherwise the working configurations are all equivalent.

cvoinescu
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK
Contact:

### Re: What is a Microstep?

I think the usage of letters or numbers to identify the coils is not consistent. Some motors and drivers label the terminals of one coil A and A-bar (or A+ and A-), and the other coil is B and B-bar (or B+ and B-); then it makes sense to call the coils A and B. Others label the terminals 1A, 1B for one coil, and 2A, 2B for the other coil; in this case we have coils 1 and 2, and the letters merely identify the ends. If your driver has the latter notation, forgive me for using letters for the two coils, because it can cause confusion.

Edit: PAPPP, you are completely right.
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk

PAPPP
Posts: 52
Joined: Wed Sep 26, 2012 2:17 am
Contact:

### Re: What is a Microstep?

You've got to pick a notation to talk about this stuff, and I've always found the [A, Ā, B, B̄] (hm, Chromium is being squirrely about the unicode overbar on the B. The second in each pair has an overbar if it isn't rendering correctly for you) to be the most reasonable, particularly because the [A, -A, B, -B] notation is compatible (and handled in the same way as common notation for both digital logic and power supplies) and expresses well in ASCII.

It is wise to note that certain parts will be labelled [1A, 1B, 2A, 2B] to express the same ordered list of connections, but as far as I'm concerned that's like doing calculus with Newton's notation - perfectly valid, but not as good.