I recently bought 250 stepper motors (part number 21-02485-03) for a sculpture that I’m working on, for the low price of 40 cents a piece! Even if you don’t buy them in bulk, they are still really cheap.
There are several driver circuits available for this motor, which were very helpful in figuring out the strange wiring inside this motor. However, none of the above drivers played nicely with the Arduino Stepper Library, which uses Tom Igoe’s stepper driver circuit. It took an evening to figure out how to connect this stepper to Tom’s driver and the Arduino stepper library, so I thought I would post it here.
The first step is to cut the white wire, which turns the stepper from a weird hybrid into a normal bipolar stepper. The links above will explain this in more detail if you’re curious.
The next step is to correlate the four wires on the motor to Tom Igoe’s circuit and the Arduino stepper library. These use the numbers 1-4 to describe the wires coming out of the motor, and order does matter. With the 21-02485-03, the wires numbered 1-4 correlate to the Red, Blue, Yellow, and Black wires respectively.
With this knowledge we can easily hook up our stepper to Tom’s circuit and start using the Arduino Stepper Library immediately. Here’s a diagram of Tom Igoe’s 4-wire circuit, with the Arduino code after it. The IC chip used is a L293D H-Bridge and note that the notch in the IC faces to the right (a bit hard to tell).
/*
* Drives the 21-02485-03 Stepper Motor attached
* to Tom Igoe's four-wire driver circuit
*/
#include <stepper.h>
// Change these to the pin numbers of each color wire
#define YELLOW 8
#define RED 9
#define BLACK 10
#define BLUE 11
#define SPEED 200 // RPM
#define LED_PIN 13
// create an instance of the stepper class, specifying
// the number of steps of the motor and the pins it's
// attached to
//
// Order matters here when giving it the pins
Stepper stepper(20, RED, BLUE, YELLOW, BLACK);
void setup() {
stepper.setSpeed(SPEED);
}
void loop() {
stepper.step(100);
delay(300);
stepper.step(-100);
delay(300);
}