Heya, Thanks for visiting!
edited

Here is a simple guide to get your stepper motors spinning. The video below demos what I made. You can see how everything is set up below that:

Watch on YouTube

Parts:

  • Teensy 3.0 or 3.1: Substitute your own Arduino/microcontroller
  • Stepper Motors: 1.7A NEMA 17 4-wire
  • Motor Controllers: I used a 3.5A controller with the TB6560 chips
  • Power Supply: 24V 10A (I used a Sopudar SPD-240-24)

Wiring Diagram / Schematic:

Teensy 3.0 Stepper Motor Setup Diagram

Code (.ino, arduino code):

const int stepperX_pul = 0;
const int stepperX_dir = 1;

const int stepperY_pul = 2;
const int stepperY_dir = 3;

int microstep_count = 0;

void setup()
{
    // Set up the x axis
    pinMode(stepperX_pul, OUTPUT);
    pinMode(stepperX_dir, OUTPUT);

    // Set up the y axis
    pinMode(stepperY_pul, OUTPUT);
    pinMode(stepperY_dir, OUTPUT);

    // initialize the pulse pins
    digitalWrite(stepperX_pul, HIGH);
    digitalWrite(stepperY_pul, HIGH);

    // initialize the direction pins
    digitalWrite(stepperX_dir, HIGH);
    digitalWrite(stepperY_dir, HIGH);
}

void loop()
{
    digitalWrite(stepperX_pul, HIGH);
    digitalWrite(stepperY_pul, HIGH);

    delayMicroseconds(100);

    digitalWrite(stepperY_pul, LOW);
    digitalWrite(stepperX_pul, LOW);

    delayMicroseconds(100);

    // Once we make a full revolution, 
    // make the motor spin the other directon
    if(microstep_count >= 3200)
    {
        digitalWrite(stepperX_dir, !digitalRead(stepperX_dir)); // Change direction.
        digitalWrite(stepperY_dir, !digitalRead(stepperY_dir)); // Change direction.
        delay(100);

        microstep_count = 0;
    }
    else
        microstep_count++;
}