Stepper motor basics explained

By Jeremy Cook

Stepper motors, at their most basic, work by energizing coils in a carefully controlled sequence to produce precise movements. The question of how a stepper motor works on a fundamental level, however, can be difficult to grasp. We’ll do a deep dive into the subject, explaining a simplified stepper operation and then taking apart a NEMA17 bipolar stepper motor to illustrate these concepts in practice.

How Does a Stepper Motor Work?: Simplified Motor Illustration

In the case of a simplified bipolar stepper motor, each of two sets of electromagnets are controlled by an H-bridge. This allows them to switch polarity on the fly to either repel or attract the rotor’s permanent magnet poles, as shown below:

Body Image 1 Stepper Motor Basics Explained

Another variation is a variable reluctance motor, which uses an unmagnetized core that aligns with the energized coils. Note that many steppers use more than four coils.

In this illustration, B and B1 are linked so that when B is energized it acts as a magnetic south pole, and B1 as the north, flipping the rotor position into place. Next, A1 is energized as south to attract the rotor’s north pole, and A is energized as north, attracting the magnet’s south. This continues as outlined in the pattern below. When this single coil pattern is graphed out, the pattern resembles a wave, and is often referred to as a “wave drive” sequence.

Clockwise Pattern (restart)

North: B1 A B A1 (A)
South:  B A1 B1 A (B)


With a step resolution of 90º, this is a very rough stepper motor indeed. Another way to accomplish this is to energize all four coils at the same time, with north and south poles aligned next to each other sequentially. The permanent magnetic rotor points to in between the active electromagnets, toward the center of their combined magnetic pull. This all-coil operation produces more torque than a single coil drive setup, but requires twice the power if fully energized.

The clockwise sequence is as follows:

Clockwise Pattern (restart)

North: A1-B1 B1-A A-B B-A1 (A1-B1)
South:  A-B B-A1 A1-B1 B1-A (A-B)

We’re still moving at full 90º steps, but having both options presents the possibility of interleaving the two for 8 steps instead of 4. This is known as half stepping, and is shown in the illustration below:

Body Imag 2 Stepper Motor Basics Explained

The lengthier sequence isn’t printed here but follows a similar progressive step movement. Notably, the patterns presented can also be reversed to step in a counterclockwise direction.

Finally, the multi-magnet setup can be taken even further with the help of micro stepping. In such a configuration, each pole is incrementally powered in an analog sinusoidal pattern, allowing these 8 individual steps to be further subdivided into 16, 32, and potentially even smaller increments.

NEMA 17: 200 Steps per revolution

Beyond the simple magnetic arrangement outlined above, a commonly available NEMA17 stepper motor features 200 individual full steps per revolution. This gives it a single-step resolution of 1.8º per step (360º/200). The typical NEMA17 stepper has 8 coils staggered around its circumference, but works with the same sort of A, A1; B, B1 pattern shown in the illustration above.

Inside the motor, a rotor magnet has its north and south pole aligned axially, with 50-toothed steel caps on each end that allow for a hybrid permanent magnet/variable reluctance operation. Each set of toothed steel cap teeth are staggered with its opposite polar rotor counterpart, which allows for 200 steps per revolution.

With the use of a half-stepping, a .9º resolution can be accomplished, while micro stepping can further multiply these divisions. Considering that stepper motors are often produced and sold for well under $100, they’re an amazing innovation.

NEMA 17 Stepper: Disassemble to Dive Deeper

NEMA17 steppers are easy enough to take apart: unscrew the bolts on the back face of the motor, then knock the shaft against a table or other hard surface. While there’s some risk of breakage, potentially sacrificing an inexpensive unit seemed well worth it for our purposes here. I went one step further and milled a hole in the top of the enclosure to see it in action.

In the first image below, you can see the main parts of the stepper. To the left is the bottom section that’s modified for viewing. The rotor is in the middle, with offset protrusions as discussed earlier, as well as bearings on the top and bottom for smooth operation. The main electromagnet section is on the right, with 8 coils, and vertical magnetic teeth protrusions that are used to attract/repel the rotor in sequence. A wave spring on the lower-right keeps the rotor tight, and a few screws that hold things together are partially obscured beyond that.

Body Image 3 Stepper Motor Basics Explained

The next two images show the rotor in more detail, with a small disk magnet flipped to indicate the polarity. After that is a closeup of the stator, with its coils and protrusions.

Body Image 4 Stepper Motor Basics Explained

Body Image 5 Stepper Motor Basics Explained


Body Image 6 Stepper Motor Basics Explained

Putting everything together (again), the next image shows a cutout view of the rotor and coils in alignment. An Arduino Uno and motor shield uses an L293D driver chip to activate the stepper in sequence. These chips are especially suitable for stepper use because they implement two H-bridge circuits that allow the coils to be energized in either direction.


Body Image 7 Stepper Motor Basics Explained


Body Image 8 Stepper Motor Basics Explained

The L293D motor shield is hooked up to this modified stepper, running a modified version of Adafruit’s motor shield test code (mush slower, and 200 steps per revolution instead of the default 48). LEDs were attached across the coil outputs, with red in one direction, and blue in the other. This allows the red to light up in one coil direction, blue in the opposite. As it goes through its four stepping patterns, it provides a good visualization of the current flow:


Body Image 9 Stepper Motor Basics Explained


Body Image 10 Stepper Motor Basics Explained

Bipolar Stepper Motors: Useful Motion Controls

At the end of the day, chances are you’ll never have to consider the internals of a stepper motor, as with the right driver and software they generally just work. At the same time, hopefully this article has given a bit more insight into just what is going on in these amazing devices. While there are some limitations to their use (e.g. no built-in feedback like a servo), steppers can often be a great choice for precise rotation control.

If you need feedback and adjustment based on speed instead of pure distance, check out our article on how to implement a PID control setup.


ArrowPerks-Loyalty-Program-Signup-banner-EN


Latest News

Sorry, your filter selection returned no results.

We've updated our privacy policy. Please take a moment to review these changes. By clicking I Agree to Arrow Electronics Terms Of Use  and have read and understand the Privacy Policy and Cookie Policy.

Our website places cookies on your device to improve your experience and to improve our site. Read more about the cookies we use and how to disable them here. Cookies and tracking technologies may be used for marketing purposes.
By clicking “Accept”, you are consenting to placement of cookies on your device and to our use of tracking technologies. Click “Read More” below for more information and instructions on how to disable cookies and tracking technologies. While acceptance of cookies and tracking technologies is voluntary, disabling them may result in the website not working properly, and certain advertisements may be less relevant to you.
We respect your privacy. Read our privacy policy here