Stepper Driver problem with 1205 motor

I have a stepper motor problem. I bought a 1205 https://www.pololu.com/catalog/product/1205 and a SparkFun EasyDriver controller and hooked them up to an Arduino. It works, but is a bit disappointing to say the least. It is very jerky and kind of slow. It seems different every time I turn it on and picking the stepper motor up stops it completely. Is this normal or do I need a different controller. Can someone advise me on how to get this working properly.

/*
  Stepper Test - Test a single Stepper Motor 
  http://www.instructables.com/id/How-to-wire-an-arduino-based-3-axis-CNC-machine/?ALLSTEPS
    
 */

// for duemilanove atmega328 arduino board + easydriver stepper controller
// dan@marginallyclever.com 2010-06-15

#define DIR1_PIN (11)
#define STEP1_PIN (11)
//#define DELAY (1600/10)
#define BAUD (9600)

void setup()
{
  Serial.begin(BAUD);
  pinMode(DIR1_PIN,OUTPUT);
  pinMode(STEP1_PIN,OUTPUT);
}


void loop()
{
  int i=0;

  digitalWrite(DIR1_PIN, LOW); // Set the direction.
  delayMicroseconds(100);
  Serial.println(">>");

  for (i = 0; i<=3400; i++) // Iterate for 4000 microsteps.
  {
    digitalWrite(STEP1_PIN, LOW); // This LOW to HIGH change is what creates the
    digitalWrite(STEP1_PIN, HIGH); // "Rising Edge" so the easydriver knows to when to step.
    delayMicroseconds(700); // This delay time is close to top speed for this
    //j+=1;
  } // particular motor. Any faster the motor stalls.

  
}

:question:

Hello.

How fast is “kind of slow”? Your problem likely has to do with your setup (e.g. wiring or power supply), control source (e.g. buggy code), or limitations of your stepper motor driver. Unfortunately, we cannot really provide much support for Sparkfun’s EasyDriver. Have you tried contacting them or asking for help on their forum? If you want a more capable driver, please consider our A4988 stepper motor driver carrier.

- Ben

Yea, I suspected such an answer and I am not surprised, just thought I would ask. I actually was looking at that controller, but they were out of stock at the time so I thought SparkFun would do just as well since there were some good reviews of it. So, maybe I should have waited. In any case I just ordered one to see if it works better. I don’t suppose you have some sample code that might actually work since though I am not a beginning programmer, I have never programmed steppers before and it would be nice to have something that worked so I know just exactly what I am doing. It is difficult to debug code when you don’t really know what is wrong. Thanks though for the suggestion. I hope this one works.

:confused:

I just noticed that for some reason your code uses the same pin (11) for both direction and step inputs. Why are you doing this? What Arduino pin are you actually connecting to your EasyDriver direction input?

Also, you should probably insert a delay of at least a few microseconds between these two lines:

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

The actual minimum required delay should be in your driver’s datasheet (e.g. it’s 1 us on the A4983/A4988). What probably saves you here is the inefficiency of the Arduino’s digital I/O functions, but I think it’s good not to rely on that.

And you never answered my question: what does “kind of slow” mean? I’d like to make sure you don’t have unrealistic expectations of how fast your stepper motor should be able to turn.

- Ben

Thanks, I missed that. Crap, I bought a new controller for nothing. Oh well, I will give it a try anyway. It works a lot better now. Much smoother and faster if I take the delay down.

Here is my new program:

/*
  Stepper Test - Test a single Stepper Motor 
  http://www.instructables.com/id/How-to-wire-an-arduino-based-3-axis-CNC-machine/?ALLSTEPS
    
 */

// for duemilanove atmega328 arduino board + easydriver stepper controller
// dan@marginallyclever.com 2010-06-15

#define DIR1_PIN (11)
#define STEP1_PIN (12)
//#define DELAY (1600/10)
#define BAUD (9600)

void setup()
{
  Serial.begin(BAUD);
  pinMode(DIR1_PIN,OUTPUT);
  pinMode(STEP1_PIN,OUTPUT);
}


void loop()
{
  int i=0;

  digitalWrite(DIR1_PIN, LOW); // Set the direction.
  delayMicroseconds(100);
  Serial.println(">>");

  for (i = 0; i<=3400; i++) // Iterate for 4000 microsteps.
  {
    digitalWrite(STEP1_PIN, LOW); // This LOW to HIGH change is what creates the
     delayMicroseconds(1); // This delay time is close to top speed for this
    digitalWrite(STEP1_PIN, HIGH); // "Rising Edge" so the easydriver knows to when to step.
    delayMicroseconds(110); // This delay time is close to top speed for this
    //j+=1;
  } // particular motor. Any faster the motor stalls.

  
}

This works much better though the controller chip gets quite hot.

What I really want to do is make a sliding platform similar to what you would see in a CNC machine though on a much smaller scale that moves at most 5", but it needs to be able to do this in a certain amount of time and now it looks like it might work. Now, if I could just figure out how to do the mechanical part. Most DIY slides are quite large. There may be a commercial one, but most are quite expensive.

Oh, thanks for the help. Now, I can do what I really want to do, write a C# or Java program to use the UBW (Universal Bit Whacker) to do what the Arduino is doing.

:smiley:

Sorry I didn’t notice your bug before you ordered a replacement, but now at least you have a backup, and our driver can deliver more current than Sparkfun’s EasyDriver, so it should run a little cooler for the same current. I’m glad to hear things are working well for you now and you can move on to the fun part of your project.

- Ben