How To Identify Stepper Motor Lead Wires – The Fool Proof Way

A guide on identifying the lead wires of Unipolar Stepper Motors. Minimize screw ups and frustration especially for beginners and first-timers tinkering with stepper motors.

Stepper motor is an impressive piece of engineering. Instead of making full turns like a normal motor, stepper motor make steps, one small degree at a time. It is commonly used in photocopy machines, printers, CNC machines, robotics, etc where precision motion (steps) and controls are needed.

UPDATE 2015: How Stepper Motor, Stepper Driver and Stepper Controller Work - Unipolar and Bipolar Motor Examples

The Basics

Stepper motors fall into 3 main categories namely Unipolar, Bipolar, or Hybrid  (Unipolar + Bipolar).

A Unipolar stepper motor must be driven in Unipolar mode;
A Bipolar stepper motor must be driven in Bipolar mode;
A Hybrid stepper motor can be driven in Unipolar or Bipolar mode.

I’m going to focus on Unipolar. They normally have 5, 6, and (sometimes) 8 wires.

The stepper motor I have lying around. A 6-wire Unipolar Stepper Motor

For the 6-wire variant, it consists of 4 Coil End wires and 2 Center Tap wires; and for the for 5-wire variant, there are 4 Coil End wires and 1 Center Tap wire.

How Stepper Motor Works (Unipolar)

Although in reality there are several set of coils in a stepper motor forming what is known as a phase, for understanding purposes it is best to imagine the there are 4 coils in a stepper motor ( namely Coil 1, 2, 3 and 4). If any one of the coil is energized, the motor will make one step, then stays in that place (after 1 step is completed). The motor I have lying around as pictured above turns 1.8 degree per step.

In order for the motor to complete one full revolution, it needed to make multiple steps. The coils need to be energized in the proper sequence to achieve this. In all, 200 sequential steps (1.8 degree x 200 steps) are needed for the motor pictured above to make 360 degree turn (one full revolution). Read the specification of your motor carefully to find out the details.

The animation below on the other hand shows the steps and coil energizing sequence depicted in a simplified 90 degree per-step motor with 4 coils. Therefore it needed 4 steps to make one 360 degree turn. In principle, all stepper motor works in the same way.

how stepper motor works
The coils/wires need to be energized in the sequence of A-C-D-B for the motor to turn/step clockwise.

If you are interested in reading on further, there are tons of resources to dig online. Google is your friend.

Step One – Identify The Center Tap Wires

This is the part where we map out the wires. You will need a multimeter, and set it to measure resistance. You will have to go through series of elimination process to map out which colored wire corresponds to which Coil End / Center Tap.

By referring to the diagram above:

1) The resistance between Coil End A and Coil End B is DOUBLE the resistance between Coil End A to the Center Tap 1.

2) The resistance between Coil End B and Coil End A is DOUBLE the resistance between Coil End B to the Center Tap 1.

3) The resistance between Coil End C and Coil End D is DOUBLE the resistance between Coil End C to the Center Tap 2.

4) The resistance between Coil End D and Coil End C is DOUBLE the resistance between Coil End D to the Center Tap 2.

The resistance readout 4.8 ohm. That means either White or Blue is the Center Tap while the other is the Coil End. Repeat the same process with the other wires.

Well..somewhat double resistance, 8.3 ohm. That means both Blue and Red are the Coils End wires and therefore White is their Center Tap. Repeat the same process with other pairings to find the next Center Tap.

NOTE: For a 5-wire unipolar stepper motor. Center Tap 1 and Center Tap 2 are internally connected together with just one wire out, but the rules above still apply. The resistance between Coil End B and Coil End A as well as the resistance between Coil End C and Coil End D are DOUBLE the resistance between any of the Coil Ends A, B, C and D to the single Center Tap.

NOTE: For a 6-wire unipolar stepper motor such as mine, There is no internal connection between (Coil End A - Coil End B - Center Tap 1) and (Coil End C - Coil End D - Center Tap 2).  Therefore there is no current flow.

No current flow (Readout = 1). We therefore can establish that White, Red, Blue wires are isolated (no internal connection) from the Green, Black Yellow wires.

Step Two – Identify the Coil End

At this point, we’ve identified the 2 Center Tap wires. Join the two together (for 6-wire motor). In my case the Center Tap are the yellow and white wires. Attach (+) end of the batteries to the joined Center Taps (or in the case of 5-wire motor, the sole Center Tap).

Randomly choose any one of the Coil End and attach the (-) of the batteries. In the set-up below, I attach the (-) to the red wire, no special reason.

The set-up (click to enlarge)

Label the random wire you have chosen as Coil End A and with it you are energizing Coil 1. It doesn’t matter which wire you choose just assume it as Coil End A (Coil 1).

By touching the unattached end of the (black) alligator clip to the to the remaining 3 wires one by one, you will see the motor twitches (it makes half or no step). This is because there are now 2 coils that are being energized simultaneously (Coil 1 plus 1 other). The motor stator will move half way between the two energized coils (half step). No step when the two energized coils are adjacent to each other.

By closely looking at the direction of the half step, you can identify which wire and coil are being energize, as below.

how stepper motor works

On my motor, I have identified that Center Tap 1 is White, Center Tap 2 is Yellow, Coil End A is Red, Coil End B is Black, Coil End C is Green, Coil End D is Blue.

By energizing the coils/wire in repetitive sequence of Red-Green-Blue-Black, the motor will turn (step-by-step) clockwise.

Energize the coils/wires in repetitive sequence of Red-Black-Blue-Green will cause the motor will turn (step-by-step) counter-clockwise.

Simple (and dirty) Pulse Width Modulation (PWM) For Motor Speed Control

This is possibly the simplest PWM circuit design out there. Suitable for low power DC Motor speed control (fan speed control, light dimming and etc) and is based on the 555 timer. Also a good starting point for novices wanting to get their hands dirty with the 555 timer IC. Some would argue that this is not the most efficient approach, but hey (read the title), it's simple, and it works.

Some attribution is appreciated.

click image to enlarge

click image to enlarge


Those of you modders, tinkerers, makers at one point or another would have encounter the need to have a finer control of DC motor speed, be it for robotic projects, RC, case mods etc. The simplest, no-brainer approach to that is by adjusting the voltage supply to the motor using a potentiometer. The higher the voltage, the higher the speed and vice versa.
Might be a good option for some cases, but the potentiometer approach doesn't perform too well when a much more stable and refined control is needed.

Pulse Width Modulation (PWM)

Put simply PWM is the process of switching power ON and OFF to a device in pulses at a specific frequency. Same approach used in commercial light dimmers, DC motor speed controller, CPU fan speed controllers and etc.

The fundamentals. Imagine your everyday incandescent light bulb. When you turn the power ON, it doesn't lights up to it's full brightness instantly, instead it will take (approximately) a couple of seconds to do so. Similarly when you turn the power OFF, it will take a couple of seconds for the bulb to die off.

Now, imagine you're able to flick the power switch ON/OFF fast enough. If you can time your ON/OFF flicking just right (of course it's difficult), the light bulb will actually dim instead of flickers.

The ON/OFF cycle is known as the duty cycle. Below are the visual representation of 50%, 80% and 20% duty cycle.

The 555 Timer IC

The 555 timer is arguably one of the most popular IC ever made. There are thousands of resources online if you're interested to delve deeper into the subject. I'm just going to give the simple description directly relevant to the build.
You can get the 555 at any electronics supply store, just ask for 555 IC (or IC tiga lima in Malay) from the auntie and you're set. If you can't seems to find it, check out the Amazon link for 555 timer below.

PIN 1 - Ground
DC Ground

PIN 2 - Trigger
When LOW, it causes the Output pin to go HIGH. Activated when voltage fall
below 1/3 of +V.

PIN 3 - Output
Output is HIGH when Trigger pin is LOW. Output is LOW when Threshold pin is
HIGH. Output is LOW when reset pin is LOW.Output pin is able to source or sink

PIN 4 - Reset
Short to +V when not in use.

PIN 5 - Control Voltage
Grounded through a 0.01uF capacitor when not in use.

PIN 6 - Threshold
When voltage reaches 2/3 of +V, this pin will cause Output to be driven LOW.

PIN 7 - Discharge
Grounded when Output pin goes HIGH.

PIN 8 - +V
DC Power

How the circuit works

When the circuit is powered up, the C1 capacitor will initially be in a discharged state. Thus, the Trigger (pin 2) will be LOW, driving the Output (pin 3) to go HIGH. Discharge (pin 7) goes HIGH and shorts to ground. The cycle begins.

The HIGH Output will cause C1 capacitor to be charged through the R1 and D1 path. Upon C1 voltage reaching 2/3 of +V, the Threshold (pin 6) will be activated and drive the Output (pin 3) LOW. Discharge (pin 7) goes LOW. The time it takes for C1 to charge depends on the position of R1.

Since Output (pin 3) is now LOW, capacitor C1 will start to discharge through the D2 and R1 path. When the voltage of C1 drops below 1/3 of +V, Trigger (pin 2) will be LOW, driving Output (pin 3) to go HIGH, and Discharge (pin 7) to go HIGH and shorts to ground. The cycle repeats itself.

You've probably noticed by now that the circuit is using Discharge (pin 7) to drive the motor, simply by shorting to ground in each cycle. You can add some amount of protection if you're concerned about back EMF from the motor.

Pin 4 and 5 are not used, and pin 1 is simply tied to ground. The circuit can take between +3v to +18v. The Frequency is around 144Hz. Do note that, doubling the value of C1 will reduce frequency to half, tripling will will reduce frequency to 1/3, and so on.

NOTE: The circuit, as is, can safely pass current of up to 200mA (max) .

Parts list

1) 555 timer IC - 1
2) 100K variable resistor - 1
3) 1N4148 Diode - 2
4) 100nF capacitor - 2

Further readings

If all the above seems too much to take in and you feel the need to brush up on you basics in electronics, then I highly recommend the book by Forrest M. Mims below. Regarded by many as the quintessential easy read for electronics beginners. I started my foray in electronics (many year ago) guided by this book and it still proves useful till this very day.

And of course, other electronics read to get your hands dirty in electronics. Enjoy!


So that's it

Any input, comments, suggestions are welcomed.