Increase Stepper Motor Speed

I got the stepper motor working on the Arduino with the A4988 Pololu Motor Driver Controller with Voltage Regulator. The stepper motor that I bought is using from Jameco. The code is the example code provided with the Arduino complier except there are some modifications. I want to increase the speed, but I am having doing that. Can some help me to increase the speed?

Code:

/*
Stepper Motor Controller
language: Wiring/Arduino

This program drives a unipolar or bipolar stepper motor.
The motor is attached to digital pins 8 and 9 of the Arduino.

The motor moves 100 steps in one direction, then 100 in the other.

Created 11 Mar. 2007
Modified 7 Apr. 2007
by Tom Igoe

*/

// define the pins that the motor is attached to. You can use
// any digital I/O pins.

#include <Stepper.h>

#define motorSteps 400 // change this depending on the number of steps
// per revolution of your motor
#define motorPin1 22
#define motorPin2 23
#define ledPin 13

// initialize of the Stepper library:
Stepper myStepper(motorSteps, motorPin1,motorPin2);

void setup() {
// set the motor speed at 60 RPMS:
myStepper.setSpeed(120);

// Initialize the Serial port:
Serial.begin(9600);

// set up the LED pin:
pinMode(ledPin, OUTPUT);
// blink the LED:
blink(3);
}

void loop() {
// Step forward 100 steps:
for (int i=0; i<4; i++) {

Serial.println("Forward");
myStepper.step(1600);
delay(250);
}
// Step backward 100 steps:
for (int i=0; i<2; i++){
Serial.println("Backward");
myStepper.step(-1600);
delay(250);
}
}

// Blink the reset LED:
void blink(int howManyTimes) {
int i;
for (i=0; i< howManyTimes; i++) {
digitalWrite(ledPin, HIGH);
delay(400);
digitalWrite(ledPin, LOW);
delay(400);
}
}

The link for the Stepper motor from Jameco: http://www.jameco.com/webapp/wcs/stores/servlet/Product_10001_10001_1581231_-1

You change this line

myStepper.setSpeed(120);

However if you set it too fast it will not turn, then you will have to increase the voltage you drive your motor from.

// Step forward 100 steps:
for (int i=0; i<4; i++) {

Serial.println("Forward");
myStepper.step(1600);
delay(250);
}
// Step backward 100 steps:
for (int i=0; i<2; i++){
Serial.println("Backward");
myStepper.step(-1600);
delay(250);
}

I know where you might cut a second off here or there.

The Serial.prints will also slow things down.

The Serial.prints will also slow things down.

But it will only add to the delay before each motor movement it won't affect the motor speed.

Grumpy_Mike:
You change this line

myStepper.setSpeed(120);

However if you set it too fast it will not turn, then you will have to increase the voltage you drive your motor from.

Grumpy_Mike,

The highest voltage that I tried was up to 25V and the motor was still running as if it had 8V. The highest rpm I can get out of the motor is 60 rpm. Is there a way to adjust to increase the rpm? I understand that I will lose torque.

try moving the println ouside the loop

You should try increasing the current from your stepping driver, what current is it set for?
The print statement will not affect the motor speed with what you are trying to do.

Grumpy_Mike:
You should try increasing the current from your stepping driver, what current is it set for?
The print statement will not affect the motor speed with what you are trying to do.

The current per phase is 0.9A. It is a 4-phase unipolar motor, but I configured it as a bipolar motor connecting the motor driver.

I think you are using the wrong code. You don't need to use the stepper library with this motor controller because it already has the motor control sequence in the controller's logic. You just need to clock the step line, while holding the direction line at the appropriate level.

#define directionPin 22
#define stepPin 23
#define speedDelay 40 // change this to change the speed, the lower it is the faster it will go

void setup() {
  // Initialize the Serial port:
  Serial.begin(9600);

  // set up the driver pins:
  pinMode(stepPin, OUTPUT);
  pinMode(directionPin, OUTPUT);

}

void loop() {
  // Step forward 800 steps:
  Serial.println("Forward");
  digitalWrite(directionPin, HIGH);
  for (int i=0; i<800; i++) {
    digitalWrite(stepPin, HIGH);
    digitalWrite(stepPin, LOW);
    delay(speedDelay);
  }
  delay(500);
  // Step backward 800 steps:
  digitalWrite(directionPin, LOW);
  for (int i=0; i<800; i++) {
    digitalWrite(stepPin, HIGH);
    digitalWrite(stepPin, LOW);
    delay(speedDelay);
  }
}

Grumpy_Mike,

The stepper motor runs much faster than previously. The reason I need the stepper motor to run faster is because I have a crane screw design. I tried to put the pictures, but I do not know how to upload pictures to this forum. If you would like to see the pictures I can email them to you. The length of the screw that the crane travels on is 24 inches. The crane takes about 5 and half minutes to reach one end to the other, which is much better than previous code where it would take almost a half hour to reach from end to the crane to the other.

The (main) reason to start cranking the voltage up on steppers, is to start over stepping them. Of course you will have to ramp up, you can't just crank out from a dead stop. A higher voltage will not do a thing if you are still sending it the same step rate.

If you want to do that you will more than likely want to explore creating your own stepper drive circuit. Of course, I have no idea if there is a stepper driver with overstepping capabilities, since I have yet to purchase a stepper driver from a third party. If you have the extra IO, of course.

The (main) reason to start cranking the voltage up on steppers, is to start over stepping them.

Quite simply no. You don't "over step" a stepping motor there is no such thing, it sounds like over clocking which of course does exist. A motor will produce less torque the faster it goes. On an unloaded motor this gives a natural stall rate. That is a rate that causes the motor to stall or not indeed start.
Increasing the voltage increases the torque at a given rate thus allowing it to go faster, but this is by no means "over stepping".
It can go faster that this maximum rate if you ramp up to it. This is easy to do by simply decrementing the delay every n steps until it reaches another maximum. The speed of ramping up is again subject to the actual mechanical situation you have.

If you want to do that you will more than likely want to explore creating your own stepper drive circuit. I have no idea if there is a stepper driver with overstepping capabilities,

How on earth could such a thing exist?

could someone please tell me how to make that simple code move with a potentiometer

how to make that simple code move with a potentiometer

http://arduino.cc/it/Tutorial/MotorKnob

yeah i looked at that im not clever enough to swap out 8,9,10,11 pins with steppin and directionpin with out it saying stepper not ....whatever

So post the code as you have changed it, along with the error message and some one will tell you where you have gone wrong.
When posting code, select it and then hit the # icon in the reply box before posting.

ok thanks alot

#include <Stepper.h>

// change this to the number of steps on your motor
#define STEPS 200
#define directionPin 22
#define stepPin 24
// create an instance of the stepper class, specifying
// the number of steps of the motor and the pins it's
// attached to


// the previous reading from the analog input
int previous = 0;

void setup()
{
  // set the speed of the motor to 30 RPMs
  stepper.setSpeed(30);
}

void loop()
{
  // get the sensor value
  int val = analogRead(0);

  // move a number of steps equal to the change in the
  // sensor reading
  stepper.step(val - previous);

  // remember the previous value of the sensor
  previous = val;
}

there it is I told you I am simple the error code it gives me is stepper was not declared in this scope motorknob.cpp: in function void loop
etc. it gets very angry at me

You need this line:-

Stepper stepper(STEPS, 8, 9, 10, 11);

In order to tell the software what pins to use. Change the numbers to match the pins your hardware is using.

Without this line the software doesn't know what the word 'stepper' means and so it tells you it doesn't know with the error message "not declared in scope" which means "WTF no on told be about this word stepper, I don't know what to do with it.