Introduction: Intro to Stepper Motors

If you've ever had the pleasure of dismantling an older printer to salvage electronic parts (I highly recommend this weekend activity if you haven't before!) you may have come across a slew of cylindrical mystery motors with 4 or more wires jutting out the side. Perhaps you've heard the characteristic buzz and whine of a desktop 3D printer or a glitchy electro-mechanical symphony of disk drives playing classic songs? If so, then you've encountered a stepper motor!

Stepper motors make the electro-mechanical world go round (and with higher torque!), but unlike their regular DC motor counterparts, controlling a stepper takes a bit more than a current across a mere two wires. In this Instructable, Ill break down some of the theory behind stepper motor design and operation. Once we've covered the basics, I'll show you how to build a simple circuits for controlling stepper motors and then we'll move on to using dedicated driver chips. Once we've unlocked the mysteries of these magical motors with the Intel Edison, I'll discuss applications for putting them to use!

Step 1: What Makes a Motor a Stepper?

Who could need more than two wires and an H-bridge? Why? Well, unlike common brushedDC motors built for maximum RPM (or kV for the RC folk), stepper motors are brushless motors designed for high torque (subsequently lower speed) and higher precision rotational movement. Whereas a typical DC motor is great for spinning a propeller at high speed for maximum thrust, a stepper is better suited to rolling a sheet of paper in sync with an inkjet mechanism inside of a printer, or carefully spinning the shaft of a linear rail in a CNC mill.

Internally, stepper motors are more complex than a simple DC motor, having multiple coils around a permanent magnet core, but with this added complexity comes greater control. Through a careful arrangement of coils built into the stator, the rotor of a stepper motor can be made to rotate a set step by varying the polarity across the coils and switching their polarity in a set firing pattern. Steppers aren't all made alike, and the internal designs require unique (yet basic) circuitry to run them properly. We'll discuss the most common types of stepper motors on the following step.

Step 2: Types of Stepper Motors

There are a handful of different stepper motor designs; these include unipolar, bipolar, universal, and variable reluctance. We'll be discussing the design and operation of bipolar and unipolar motors, as these are the most common motor type sold, and the kinds you're most likely to find if you're salvaging motors from other electronics.

Unipolar Motors

Unipolar motors typically have five, six, or eight wire leads extending from the base and one coil per phase. In the case of a five wire motor, the fifth wire is the joined center taps of the coil pairs. In a six wire motor, the coil pairs each have their own center tap. In a motor with eight wires, each coil pair is completely separated from the others, allowing it to be wired in different configurations. These extra wires allow unipolar motors to be driven directly by an external controller with simple transistors to drive each coil individually. The firing pattern in which each coil is driven determines which direction the shaft of the motor will rotate. Unfortunately, given that only one coil is energized at a time, the holding torque of a unipolar motor will always be less than that of a bipolar motor of the same size. Bypassing the center taps of a unipolar motor, it can now be driven as a bipolar motor, but will require a more complicated control scheme. We'll actually drive a unipolar motor on step four of this instructable, which should clarify some of the concepts introduced above.

Bipolar Motors

Bipolar motors usually have four wires and are stronger than a comparably sized unipolar motor, but since we only have one coil per phase, we'll need to reverse the current through the coils in order to step. Our need to reverse the current means we'll no longer be able to directly drive the coils with a single transistor, but instead with a full h-bridge circuit. Building a proper h-bridge is tedious (let alone two!), which is why we'll be using a dedicated bipolar motor driver (see step 5).

Step 3: Understanding Stepper Motor Specifications

Let's talk about how to determine the specifications of a motor. If you've come across a square-ish motor with a definite three piece assembly (see picture three), chances are this is a NEMA motor. The National Electrical Manufacturers Association has a defined standard for motor specifications using a simple letter-based code for defining a motor's faceplate diameter, mount type, length, phase current, operating temperature, phase voltage, steps per revolution, and wiring. The RepRap organization has a full breakdown if you'd like to read more about the NEMA standard.

Reading a Motor Data Sheet

For the next step, I'll be using this unipolar motor. I've attached the datasheet above, and although it is brief, it provides us with everything we'll need to drive it properly. Let's breakdown what is listed:

Phase: This a four phase unipolar motor. Internally, the motor may have any number of actual coils, but in this case they are grouped into four phases which can be independently driven.

Step Angle: With an approximate of resolution of 1.8° per step, we'll get 200 steps per revolution. Although this is the mechanical resolution, with microstepping we can squeeze more resolution without any modification to the motor (more on this in step 5).

Voltage: The rated voltage of this motor is 3 volts. This is a function of the current and resistance ratings of the motor (Ohms Law V=IR thus 3V = 2A * 1.5Ω)

Current: How much juice does this motor want? Two amps per phase! This figure will be important when selecting our power transistors for the basic driver circuit.

Resistance: 1.5 ohms per phase will limit how much current we can apply to each phase.

Inductance: 2.5 millihenries. The inductive nature of the motor coils will place a limit on how quickly we can charge the coils,

Holding Torque: This will be how much actual force we can create when the stepper is energized.

Detent Torque: This is how much holding torque we can expect from the motor when it is not energized.

Insulation Class: Class B is part of the NEMA standard and gives us a rating of 266 °F. Steppers are not terribly efficient, and drawing maximum current all of the time means they'll get quite hot during normal operation.

Lead Style: 22 American wire gauge standard.

Determining Coil Pairs

Although the resistance of the coil windings can vary from motor to motor, if you've got a multimeter, you can measure the resistance across any two wires, if the resistance is <10 ohms, you've likely found a pair! This is mostly a process of trial an error, but should work for most motors when you don't have a part number/data sheet.

Step 4: Directly Driving Stepper Motors

Due to the arrangement of wires within a unipolar motor, we can energize the coils in sequence using only simple power MOSFETs. The illustration above shows a simple MOSFET driven circuit. This arrangement allows simple logic level control with an external microcontroller. In this case I'm using the Intel Edison board with an Arduino-style breakout board to give me easy access to the GPIO (any micro with four GPIO will do however). For this circuit I'm using the IRF510 N-channel power MOSFET. With the ability to sink up to 5.6 amps, the IRF510 will have plenty of current head space to meet the motor's 2 amp needs. The LEDs aren't necessary, but will give you a nice visual confirmation of the firing sequence. It's important to note that the IRF510 must be driven with a logic level of at least 5 volts in order for it to be able to sink enough current for the motor. The power to the motor in this circuit will be 3V.

Firing Sequence

Controlling the unipolar motor at full steps with this setup is dead easy. In order to rotate the motor, we'll have to engage the phases in a set firing pattern in order for it to spin properly. In order to rotate the motor clockwise, we'll drive the phases as follows: A1, B1, A2, B2. That's it! In order to spin counter clockwise, we'll just reverse the direction of the sequence to B2, A2, B1, A1. This is fine for basic control, but what if you want more precision and less work? Let's talk about using a dedicated driver to make things much easier!

Step 5: Stepper Motor Driver Boards

If you'd like to get down to controlling bipolar motors (or unipolar motors in a bipolar configuration), you'll want to grab a dedicated driver breakout board. Pictured above are the Big Easy Driver and the A4988 Stepper Motor Driver Carrier board. Both of these boards are breakout PCBs for the Allegro A4988 microstepping bipolar stepper motor driver, which is by far one of the most common chips for driving smaller stepper motors. Aside from having the requisite dual h-bridges for driving a bipolar motor, these boards pack a lot of punch for a tiny low-cost package. You can read a solid breakdown of features on the Pololu webpage, but we'll talk about the most important features here.


These all-in-one boards have a wondrously low hookup connection. You can begin driving a motor with only three connections (only two GPIO) to your main controller: common ground, step, and direction. The step and direction pins are left floating, so you'll need to tie them to a reference voltage with a pull-up resistor. A pulse sent to the STEP pin will move the motor one step at a resolution according to the microstep reference pins.The logic level of the DIR pin determines whether the motor will spin clockwise or counterclockwise.


Depending on how the the M1, M2, and M3 pins are set, you can achieve increased motor resolution through microstepping. Microstepping involves sending varied pulses to pull the motor in between the electromagnetic resolution of the physical magnets in the rotor allowing for very precise control. The A4988 can go from full-step down to sixteenth step resolution. With our 1.8° motor, this would provide up to 3200 steps per revolution. Talk about fine detail!

Code / Libraries

Connecting the motors might be a breeze, but what about controlling them? Check out these ready-made code libraries for driving stepper motors:

Stepper- A classic that comes built in to the Arduino IDE, allows for basic stepping and RPM control.

AccelStepper- A much more fully feature library that allows for better control of multiple motors and proper motor acceleration and deceleration.

Intel C++ MRAA Stepper - A lower level library for those who want to venture into raw C++ control of a stepper motor using the Intel Edison.

Step 6: Stepper Motor Applications

I hope you've found this instructable both informative and enjoyable. This should be enough to get your feet wet in the electro-mechanical world of working with stepper motors, but this is only the beginning. Now that you've got a foothold, where should you go from here? Check out these great projects for stepper-centric inspiration:

Subtractively manufacture your dreams with your own CNC Mill or precisely harness the power of lasers to do your bidding with your own engraver/cutter. If you prefer more constructive means of fabrication, why not build your own3D printer? You can start from open source plans, or build it from scratch! If you're a bigger fan of fewer dimensions, check out these 2D plotter projects for producing pleasant portraits (or anything really). Perhaps you'd like none of these things, and simply wish to observe and harness the raw energy of the sun to power your DIY projects.


Boxing_devil (author)2017-03-14

I've got a couple of stepper motors that I'm trying to sell, if anyone's interested please contact

ephtermulo (author)2016-07-28

nice, keep it up

SaraM113 (author)2016-06-08

How do we select the ratings of a stepper motor for a PV panel?

Samiraawong (author)2016-04-01

Nice project

Reubenscott (author)2015-11-25


HamzehB (author)2015-08-14

make it free!..

Bonolo10 (author)2015-05-04

Is it possible to just programmer the Intel board so that it is the controller and it drives the circuit?

Bonolo10 (author)Bonolo102015-05-04

I meant it drives the motor not the ciruit

rmacewen1 (author)Bonolo102015-05-05

The motor needs current pulses. I logic processor doesn't supply current, only waves. The driver chip, if I'm understanding correctly, takes the signal form the processor, and power from a power supply, and switches the power on and off to the sets of coils in the stepper motor. Perhaps it could drive a very tiny stepper motor.

blakhachib (author)2015-04-16

thank you a lot , i m about to buy motors

dollarseed (author)2015-04-13

Perfect timing. I've just finished the final assembly of my CNC router monster, and am ready to begin testing the 4 different motors I am using. Too bad someone doesn't have the definitive guide to color coded wires used. I went through a miserable time making sure that the coils were labeled correctly, and now have my fingers crossed. Next is to get the full versions of Mach 3, VCarve, and the rest. I tried LinuxCNC, but prefer the Mach 3 GUI. Thanks for all of the great information.

BeachsideHank (author)dollarseed2015-04-13

You may find this Instructable useful for determining lead configuration:

I wrote it for basic testing the operational status of steppers, but no reason why it can't be used to determine functionality of various lead hookups.

skrubol (author)2015-04-13

2 Things you should probably mention.

The voltage on the motor label is probably not the voltage you should supply to your stepper driver. A value of 5-10x the labeled voltage is generally best to get the most high-speed torque and not generate too much waste heat (limited by the rating on your driver, this value you should never go over.) The nameplate voltage will give the appropriate current when the motor is not turning, once you start turning (alternating the voltages rapidly,) the inductance takes over and squashes your current it you aren't using enough voltage. The driver will take care of limiting the current.

Microstepping only gives more precision to a point. Beyond half-stepping, the accuracy of the micro-steps declines. The most precision you can hope to get without feedback is in the 8-10 microstep range. More microsteps will only help with reducing vibration/noise.

Bosun Rick (author)2015-04-12

Clarification Needed in Step 4:

"For this circuit I'm using the IRF510 N-channel power MOSFET. With the ability to sink up to 5.6 amps, the IRF510 will (?????) plenty of current head space to meet the motor's 2 amp needs.

It seems there is/are a word(s) missing here.

I admit I am a dinosaur, but would you please define the acronyms you've used in this I'ble? MOSFET, GPIO, STEP for example. We are all here to learn, but sometimes it feels like how the first computers were described: GIGO (garbage in- garbage Out)

pfred2 (author)Bosun Rick2015-04-12

Forget about step 4. It is a completely academic discussion today. If you want to run a stepper motor then get a stepper motor drive. Without current feedback control you can't get very good performance out of a stepper motor. Stepper motor drives are cheap, and readily available today.

pluisi (author)Bosun Rick2015-04-12

hi... i can guess the missing word is "have"
regarding the unknown words:
GPIO = General Purpose Input Output
MOSFET = Metal Oxyde Semiconductor Field Effect Transistor
step = just the minimum step (angle) by which the stepper motor. can advance without tweaking the drivers.

anyway... I understand that even explaining what is meant by the acronyms, the real meaning can be obscure. but to understand what t a MOSFET is I've studied lots of books and probably five exams in the university, so... start with Wikipedia and then go on if you are interested in the topic

BeachsideHank (author)2015-04-09

"Determining Coil Pairs"

Resist the urge to open the motor up, do your pairing externally, some units are precisely magnetized and disturbing the arrangement may be detrimental to it's operation.

pfred2 (author)BeachsideHank2015-04-10

From what I hear there's no "may be" about it. If you open a stepper motor up they lose most of their torque then. The way it was explained to me is the rotor poles are magnetic keepers for the stator, and if you pull that stator out like you say, the magnetism gets ruined. Then the whole motor is ruined too.

BeachsideHank (author)pfred22015-04-12

My "maybe" is a qualified one Fred, I made the mistake of opening a used take- off Minebea stepper from a lot of same that I purchased for my CNC build. It was only after that I found the warning, but when I put it back together it ran just as well as the others I compared it to, so that caveat may be for a certain category, but nevertheless it is good practice anyway.

pfred2 (author)BeachsideHank2015-04-12

Well then I stand corrected. You're the first person I've ever heard of that didn't ruin a stepper motor by opening it. Congratulations.

Aleator777 (author)BeachsideHank2015-04-12

Good to know! Thank you

woofman (author)2015-04-12

This is an important instructable, but the opening video sure felt like an intel commercial. Is there a relationship between these two companies? If so, isn't it illegal to not disclaim? ...just sayin....

Aleator777 (author)woofman2015-04-12

This project is sponsored by Intel :)

par64guy (author)2015-04-12

Great introductory lesson on steppers! You are right about there being a lot to know about them. Perhaps you could do a follow-up that includes info on resonance points, torque-speed curves, and the many other tidbits that could be gotchas for someone trying to create an application using steppers.

Aleator777 (author)par64guy2015-04-12

Thank you! Yes, it would be quite helpful to cover those topics as well. It's a particularly deep subject (like anything EE related) so I tried to keep it simplified while still useful.

tails doll black (author)2015-04-12

im in need of trying to find one of these motors cause im nearly complete with a d c motor and steam powered electrical grid and i need stronger current i did have one already but the wires making the current necessary broke on me plz help

deba168 (author)2015-04-10

Great Instructables :)
Detailed information on stepper motor.Thanks for sharing.

ernstp (author)2015-04-10

Very helpfull! It would be interesting to see how the A4988 Stepper Motor Driver Carrier can ben used with an Arduino or Raspberry Pi.

padbravo (author)2015-04-09

(But, you could improve it by adding some tips: how to determine what kind of motor is one with the help of a multimeter, and how to determine the wiring configuration of a unknow motor)

padbravo (author)2015-04-09

Great instructable, well explained... makes a great intro into the subject...

Seymour Heine (author)2015-04-09

How would this compare to a brushless motor from a hard disk drive? Could that be used as a stepper?

gada888 (author)2015-04-09

Thanks for your ible.

About This Instructable




Bio: My name is DJ and I previously made electronic whatsits, 3D-printed thingamabobs, and laser-cut kajiggers for the Instructables Design Studio; now I build and repair ... More »
More by Aleator777:MiniSub ROVBasics of Thermal ImagingMiniature Autonomous Blimp
Add instructable to: