Please see all COVID-19 updates here as some shipments may be delayed due to CDC safety and staffing guidelines. If you have an order or shipping question please refer to our Customer Support page. For technical questions please check out our Forums. Thank you for your continued support.


Member Since: September 13, 2007

Country: United States

  • Thanks for the link. I setup the circuit per Dan's blog and wrote the program listed. I went back and rewrote some of it to get a better understanding of the motor mechanics. Here is the code:
    // title: Stepper Motor Tester
    // author: BigRedSparks
    // date: April 20, 2011
    // version: 1.0
    // notes:
    // This program is derived from the stepper motor program
    // written by Daniel Thompson
    // http://danthompsonsblog.blogspot.com/2010/05/easydriver-42-tutorial.html.
    // It also uses the same circuit described on Daniel's blog.
    // I rewrote portions of it mainly to develop a better understanding
    // of the stepper motor mechanics. Where Daniel's program sets the modes
    // and delays algorithmically, this program sets them explicitly to see how
    // it affects the motor behavior.
    // output pins
    int DIR = 3; // PIN 3 = DIR
    int STEP = 2; // PIN 2 = STEP
    int MS1 = 13; // PIN 13 = MS
    int MS2 = 9; // PIN 9 = MS2
    int SLEEP = 12; // PIN 12 = SLP
    // direction constants
    const int CW = LOW;
    const int CCW = HIGH;
    // number of steps per revolution
    // e.g. 1/8 deg per step = 200 steps per revolution
    int STEPS_PER_REV = 200;
    // enumerate motor step modes
    enum STEP_MODE {
    void setup() {
    pinMode(DIR, OUTPUT);
    pinMode(STEP, OUTPUT);
    pinMode(MS1, OUTPUT);
    pinMode(MS2, OUTPUT);
    pinMode(SLEEP, OUTPUT);
    void loop()
    // all tests rotate the motor fully in each direction.
    // the steps and timing for each have been adjusted so that
    // each test behaves the same
    // full step test
    turnStepperMotor(STEPS_PER_REV, CW, FULL, 1600);
    turnStepperMotor(STEPS_PER_REV, CCW, FULL, 1600);
    // half step test
    turnStepperMotor(STEPS_PER_REV * 2, CW, HALF, 800);
    turnStepperMotor(STEPS_PER_REV * 2, CCW, HALF, 800);
    // quarter step test
    turnStepperMotor(STEPS_PER_REV * 4, CW, QUARTER, 400);
    turnStepperMotor(STEPS_PER_REV * 4, CCW, QUARTER, 400);
    // eighth step test
    turnStepperMotor(STEPS_PER_REV * 8, CW, EIGHTH, 200);
    turnStepperMotor(STEPS_PER_REV * 8, CCW, EIGHTH, 200);
    // turnStepperMotor - sets the direction and step mode,
    // wakes the motor and sends the specified
    // number of steps to the motor using the specified delay between pulses
    // finally it puts motor to sleep
    // steps - number of steps
    // dir - direction CW | CCW
    // mode - step mode: FULL | HALF | QUARTER | EIGHTH
    // del - delay in microseconds between pulses
    void turnStepperMotor(int steps, int dir, int mode, int del)
    digitalWrite(DIR, dir);
    digitalWrite(SLEEP, HIGH);
    for (int i = 0; i < steps; i++) {
    digitalWrite(STEP, LOW);
    digitalWrite(STEP, HIGH);
    digitalWrite(SLEEP, LOW);
    // set step mode
    // MS1 MS2 Resolution
    // L L Full step (2 phase)
    // H L Half step
    // L H Quarter step
    // H H Eighth step
    void setStepMode(int mode) {
    switch (mode) {
    case FULL:
    digitalWrite(MS1, LOW);
    digitalWrite(MS2, LOW);
    case HALF:
    digitalWrite(MS1, HIGH);
    digitalWrite(MS2, LOW);
    case QUARTER:
    digitalWrite(MS1, LOW);
    digitalWrite(MS2, HIGH);
    case EIGHTH:
    digitalWrite(MS1, HIGH);
    digitalWrite(MS2, HIGH);

  • I found Pin 1 using this technique. The chip has 12 pins on each side and pins run parallel with the rows.
    I setup a test circuit with a 5V supply and 220 Ohm resistor.
    I oriented the chip so one row of pins runs along the bottom. Counting left to right, attach 5V and resistor to what could be the actual Pin 1 on the chip (call it "candidate" pin 1) and GND to "candidate" pin 3. This should turn on the red LED (see Note below) at row 5, col 5. If this is the case, then 5V is connected to the actual Pin 1 on the chip and GND is connected to actual Pin 3.
    If nothing lights then swap the connections so that GND is connected to "candidate" pin 1 and 5V is connected to "candidate" pin 3. This should turn on the red LED (see Note below) at row 5 col 5 based on the current orientation of the chip. If this is the case, then GND is connected to the actual Pin 13 on the chip and 5V is connected to Pin 15. This also means that you are actually lighting Row 4 Col 4 because the chip is upside down based on the schematic.
    Once I identified the pins, I wrote on the side to mark them.
    Note: As best as I can tell, the schematic on the data sheet is not correct. In my experience, red and green were reversed.

No public wish lists :(