If you do not have a datasheet indicating which wire is positive or negative, you can use a simple method with an LED (Light Emitting Diode). An LED will only light up when current flows in the correct direction.
Materials Needed:
Procedure:
Some stepper motor drivers are able to auto-detect the proper coil polarity based on how the motor is wired to them. Simply wire the motor to the driver and run a test to see if the motor turns correctly in the desired direction. If the motor moves in the wrong direction, reverse one pair of wires (e.g., swap Black with Green) to reverse the direction of the current through one coil.
Another simple way to determine the polarization is to manually turn the motor shaft with one pair of coils shorted and observe resistance. When one coil is shorted (e.g., connect Black and Green together), and you turn the motor shaft manually, you’ll feel more resistance due to the electromagnetic braking effect. This won’t tell you exact polarity but will confirm correct pairs and that the motor is generating a magnetic field.