Powering the Pulolu Stepper motor with the Easydriver

hello all!

I should begin by mentioning I am a complete newbie when it comes to electronics. Extremely ignorant, so please pardon my stupid questions - I’m trying to learn as much as I can!
The plan was to figure out how to make my own electronic remote follow focus system for filmmaking with DSLR video cameras. After a few days of reading, I decided to purchase the Arduino Uno, Easydriver v4.4, Pololu 12v power supply, and the Pololu 4v 1200mA Stepper Motor https://www.pololu.com/catalog/product/1200.

I wired it up exactly like a schematic I found online http://danthompsonsblog.blogspot.com/2010/05/easydriver-42-tutorial.html but ran into trouble figuring out how to power my specific stepper motor. I assumed a 12v power supply would be sufficient to power the 4v motor but things got a little confusing understanding the mA ratings per coil, etc. Also, the color coded wiring was different than the example in the tutorial. The Pololu stepper motor page shows which wires to isolate for bipolar drivers but I’m lost as to which pairs connect to the A, B coil outputs on the easydriver. I fired up the aurduino and easydriver, code from the tutorial ran fine, but motor didn’t move at all. I tried switching coil pairs but no difference… only small noises coming from the motor.

I’m sure I’m missing something obvious here… if someone might be able to help out a newbie I’d really appreciate it!

///////////////////////////////////////////////////////////
// Stepper Motor skecth for use with the EasyDriver v4.2 //
///////////////////////////////////////////////////////////

// Dan Thompson 2010
//
// Use this code at your own risk.
//
// For all the product details visit http://www.schmalzhaus.com/EasyDriver/
// For the full tutorial visit http://danthompsonsblog.blogspot.com/


////// ED_v4  Step Mode Chart //////
//                                //
//   MS1 MS2 Resolution           //
//   L   L   Full step (2 phase)  //
//   H   L   Half step            //
//   L   H   Quarter step         //
//   H   H   Eighth step          //
//                                //
////////////////////////////////////

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


void setup() {
  Serial.begin(9600);     // open the serial connection at 9600bps
  pinMode(DIR, OUTPUT);   // set pin 3 to output
  pinMode(STEP, OUTPUT);  // set pin 2 to output
  pinMode(MS1, OUTPUT);   // set pin 13 to output
  pinMode(MS2, OUTPUT);   // set pin 9 to output
  pinMode(SLEEP, OUTPUT); // set pin 12 to output
}



void loop()
{
  int modeType = 1;                         // This number increases by multiple of 2 each through the while loop..
                                            // ..to identify our step mode type.                                            
  while (modeType<=8){                      // loops the following block of code 4 times before repeating .
    digitalWrite(DIR, LOW);                 // Set the direction change LOW to HIGH to go in opposite direction
    digitalWrite(MS1, MS1_MODE(modeType));  // Set state of MS1 based on the returned value from the MS1_MODE() switch statement.
    digitalWrite(MS2, MS2_MODE(modeType));  // Set state of MS2 based on the returned value from the MS2_MODE() switch statement.
    digitalWrite(SLEEP, HIGH);              // Set the Sleep mode to AWAKE.
    
    int i = 0;                              // Set the counter variable.     
    while(i<(modeType*200))                 // Iterate for 200, then 400, then 800, then 1600 steps. 
                                            // Then reset to 200 and start again.
    {
      digitalWrite(STEP, LOW);              // This LOW to HIGH change is what creates the..
      digitalWrite(STEP, HIGH);             // .."Rising Edge" so the easydriver knows to when to step.
      delayMicroseconds(1600/modeType);     // This delay time determines the speed of the stepper motor. 
                                            // Delay shortens from 1600 to 800 to 400 to 200 then resets  
                                                 
      i++;                      
    }                              
    modeType = modeType * 2;                // Multiply the current modeType value by 2 and make the result the new value for modeType.
                                            // This will make the modeType variable count 1,2,4,8 each time we pass though the while loop.
   
    delay(500);
  }
  digitalWrite(SLEEP, LOW);                 // switch off the power to stepper
  Serial.print("SLEEPING..");
  delay(1000);
  Serial.print("z");
  delay(1000);
  Serial.print("z");
  delay(1000);
  Serial.print("z");
  delay(1000);
  Serial.println("");
  digitalWrite(SLEEP, HIGH);
  Serial.println("AWAKE!!!");                // Switch on the power to stepper
  delay(1000);
}



int MS1_MODE(int MS1_StepMode){              // A function that returns a High or Low state number for MS1 pin
  switch(MS1_StepMode){                      // Switch statement for changing the MS1 pin state
                                             // Different input states allowed are 1,2,4 or 8
  case 1:
    MS1_StepMode = 0;
    Serial.println("Step Mode is Full...");
    break;
  case 2:
    MS1_StepMode = 1;
    Serial.println("Step Mode is Half...");
    break;
  case 4:
    MS1_StepMode = 0;
    Serial.println("Step Mode is Quarter...");
    break;
  case 8:
    MS1_StepMode = 1;
    Serial.println("Step Mode is Eighth...");
    break;
  }
  return MS1_StepMode;
}



int MS2_MODE(int MS2_StepMode){              // A function that returns a High or Low state number for MS2 pin
  switch(MS2_StepMode){                      // Switch statement for changing the MS2 pin state
                                             // Different input states allowed are 1,2,4 or 8
  case 1:
    MS2_StepMode = 0;
    break;
  case 2:
    MS2_StepMode = 0;
    break;
  case 4:
    MS2_StepMode = 1;
    break;
  case 8:
    MS2_StepMode = 1;
    break;
  }
  return MS2_StepMode;
}

Hello.

Connect BLACK to the square-pad then connect the wires in this order going away from that pin: GREEN, RED, BLUE.

- Ryan

Hello.

You might be able to get something working, but I think the easydriver and your power supply are underpowered for the stepper motor you have chosen, and that could be a big part of your problem. Your stepper motor is rated for 1.2 A per phase while the easydriver can only deliver a maximum of 750 mA per phase and your power supply is only capable of delivering a total of 1 A (assuming this is the power supply you are using). I suggest you upgrade your power supply and either use a more powerful motor driver (though you will need to add a heat sink if you want to get more than an amp per phase out of it) or go with a lower-power stepper motor.

I would also consider trying a much simpler program for testing your stepper motor, and start out trying to step your motor at a very low speed. I don’t know how well the program you posted works, but it looks like it might not be generating the proper step pulses. The A3967 datasheet says that the minimum step low time is 1 us, yet there is no explicit delay between the lines:

digitalWrite(STEP, LOW); // This LOW to HIGH change is what creates the.. digitalWrite(STEP, HIGH); // .."Rising Edge" so the easydriver knows to when to step.

I’m not sure how long a digitalWrite() call takes on the Arduino, but I know the AVR on the Arduino can change the output state of an I/O line in a single instruction, and that is much faster than 1 us.

- Ben

Ryan and Ben, thank you so much! I wired it up as directed and the power indicator on the easy driver doesn’t illuminate anymore. I guess I shorted it out? Thankfully it wasn’t too expensive… I’ll buy another one with a lower power draw since the one I bought was a little too big anyway.

after a little health related delay, i finally got back to my project.

I purchased a smaller motor (pololu.com/catalog/product/1205) to run with the easydriver. After wiring everything up, i find the motor holds tension when my code powers it up, but doesn’t actually move. I’m stumped again. Any thoughts?

If it holds its position when you torque it, then the coils are probably energized. It sounds like there’s either a problem with your EasyDriver, with your Arduino code, or with your connections. Do you here a sound from your stepper motor? If you are trying to step the motor and failing, you will usually here a hum at the same frequency as your stepping frequency.

We don’t have any experience with the EasyDriver, so you might try contacting Sparkfun directly or posting on their forum for help with their driver (or you could try our stepper motor driver, which is more powerful and supports more microstepping resolutions).

- Ben