Stepper motors settings

Hello, This is my second weekend play with the arduino board, stepper motor from SparkFun and stepper driver. I tried to write a little program to determine how many steps the the motor will take at it’s fastest speed over the course of 1 second. The print the number of steps. It seems like the 3 variables that I can play with with a stepper motor are STEPS, SPEED and DIRECTION.

STEPS - I can just enter the number of steps it will move until a change.

SPEED - has me baffled a little. Am I correct in assuming that you set the speed of your stepper motor but setting the delay between the HIGH and LOW pulses?

The problem I am having is that I set the delay to fast between high/low the stepper just sits there and make a noise I am trying to find the fastest it will go without causing it to skip or stall.

How should I set the speed?

#define DIR_PIN 2
#define STEP_PIN 3
#define Top_Speed 1.0
#define MS1 5
#define MS2 6

 int steps = 2000;
 int stepDelay = (1200);
 int count = 0;
 int dir;
 unsigned long time;
 
void setup() {
  pinMode(DIR_PIN, OUTPUT);
  pinMode(STEP_PIN, OUTPUT);
  pinMode(MS1, OUTPUT);
  pinMode(MS2, OUTPUT);
  Serial.begin(9600);
} 
 
void loop(){
  time = millis();
  
  if (steps > 0){
    dir = LOW;
  }
  else {
    dir = HIGH;
  }
  
  digitalWrite(DIR_PIN,dir); 
  digitalWrite(MS1, LOW );
  digitalWrite(MS2, LOW);
  
    for(int i=0; i < steps; i++){
      digitalWrite(STEP_PIN, HIGH);
      delayMicroseconds(stepDelay); 

      digitalWrite(STEP_PIN, LOW);
      delayMicroseconds(stepDelay);
 
      count ++;
      if (time > 1000){
        Serial.print("Time: ");
        Serial.println(time);
        Serial.println("Count: ");
        Serial.println(count);
        delay(2000);
      }
  }
 delay(1000); 
}

Am I correct in assuming that you set the speed of your stepper motor but setting the delay between the HIGH and LOW pulses?

Yes.

The problem I am having is that I set the delay to fast between high/low the stepper just sits there and make a noise I am trying to find the fastest it will go without causing it to skip or stall.

What power supply are you using? What stepper motor? What driver? Stepper motors need a lot of current. Typically, they use fairly high voltages, too.

Speed is not the strong point for stepper motors. Being able to precisely position the thing being driven, such as CNC tool head, is what sets stepper motors apart.

What are you intending to do with the stepper motor that speed is so important?

Thanks for the response.

My power supply is plenty good http://www.amazon.com/Extech-382202-Ampere-Digital-Single/dp/B000EX260A
My over all goal is a CNC type of machine but for a camera. I am hoping to move the camera about 1 foot per second over a given axis

Both stepper motor and stepper driver I got at SparkFun.com
Stepper motor- http://www.sparkfun.com/products/9238
Stepper Driver- http://www.sparkfun.com/products/10267

A stepper was going to be the better choice because when it is not moving there is power going to it to hold it in place which is what I want.

In the code I wrote I had it count the number of steps and then after 1000 millis (1 second) tell me how many steps it went. 821 seemd to be the most setting a delay of delay(600). I also set MS1 and MS2 to HIGH so there would be no micro stepping.

So if my math is right and there are 200 steps per revolution (1.8 degrees) and it stepped 821 steps in 1 second that makes it just over 4 revolutions per second or 240 RPM?

My power supply is plenty good

Nice.

600 microseconds between steps seems pretty high. I would have expected you to be able to reduce that.

There is a stepper library. Have you tried that?

I am not using a stepper library. The code that I posted is the code that I am using to turn the stepper motor.

Is the stepper library going to be different then doing it this way, with my code?

600, yes. But here is where I get a little lost. The Stepper driver has an MS1 and MS2 for selecting the micro stepping from FULL / HALF 1/4 and 1/8. I believe when both are defaulted to HIGH it mico steps 1600 steps per revolution. When I set them to LOW it has 200 steps per rev. When they are set to HIGH I can set my delay at 75 MICROSECONDS between HIGH to LOW. But when I set the MS1 and MS2 to HIGH then the minimum MICROSECOND is 600.

My question now. It seems like my speed is almost constant. When set to 200 steps per rev I have to have 600 microseconds delay. When set to 1600 steps per rev I can set the delay to 75 microseconds. So it seems to spin at the same max speed for both setting.

Is that right?

Thanks again!

From the EasyDriver website:

Lower voltages produce a lot less heat (on the ED and the motor) but produce lower maximum speed and torque. Higher voltages (up to 30V) get you more torque at higher speeds, but your ED will get much hotter.

So, maybe you need to increase the voltage.

I don't see anything about microstepping on the EasyDriver page, except a note that says 1/8 stepping is hardwired in.

It is permanently set to use 8 step microstepping mode.

Is the stepper library going to be different then doing it this way, with my code?

Only one way to find out...

You were right. Thanks for looking at the motor. The most my power supply will dial up to is 18V. I turned it up to 18 and I was able to get the stepper from 600 down to 450 microseconds on the delay. I had set the delay to 617 and ran a counter so I knew that at 617 I was getting 800 steps per second, or 4 revolutions. (I used a while statement to exit when millis() was over 1000.) at 18 volts I am now able to get 1050 steps per second before it started to choke, at 450 delay.

I have a similar question related to microstepping; so there are options to set microstepping with easydriver 4.4? Or is 1/8 as stated on their web site and as PaulS noted below?
Thanks.