A stepper motor can come with assortment of wire configurations. The type of motor you’ve selected will determine the wire setup. Most commonly stepper motors come with four, five, six, or eight wires.
To begin, if your stepper motor only has four wires, this means it can only be used with a bipolar driver. You will notice each of the two phase windings has a pair of wires, use your meter to identify the wires.
Find the wires that have the continuity between them and connect these to the stepper motor.
Like the four wire motor, six wire stepper motors have a pair of wires for each winding. However, it also has a center-tap for each winding as well, this gives it the option to be wired as bipolar or unipolar.
With your meter, divide the wires into sets of three that have continuity to each other, next identify the center taps. If you are connecting to a unipolar driver use all six of the stepper motor wires.
A bipolar driver will require you use only one end wire and one center tap of each winding. With a five wire stepper motor the wire setup is very similar to the six wire driver, the main difference being the center taps are connected together internally, bringing it out as one wire. This will make the motor only function as a unipolar driver. Also, the windings will be impossible to identify without trial and error, the best you can do is try to identify the center tap wire since it has half the resistance.
Finally there is the eight wire stepper motor, which is much like the six wire. The difference being that the two phases are split into two separate windings. When this is done it allows for the stepper motor to be connected as a unipolar stepping motor, as well as three different bipolar combinations.