Pages: [1] 2 3 ... 5   Go Down
Author Topic: Increase Stepper Motor Speed  (Read 8324 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 620
Posts: 34003
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You change this line
Code:
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.
Logged

Pittsburgh, PA, USA
Offline Offline
Faraday Member
**
Karma: 98
Posts: 4803
I learn a bit every time I visit the forum.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
  // 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.
Logged

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

Dubuque, Iowa, USA
Offline Offline
Faraday Member
**
Karma: 46
Posts: 2504
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The Serial.prints will also slow things down.
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 620
Posts: 34003
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You change this line
Code:
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.
Logged

Leighton Buzzard, UK
Offline Offline
Edison Member
*
Karma: 21
Posts: 1339
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

try moving the println ouside the loop
Logged

there are only 10 types of people
them that understands binary
and them that doesn't

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 620
Posts: 34003
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 620
Posts: 34003
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Code:
#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);
  }
}
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Frozen Midwest
Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset



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.
Logged

Frying boards one at a time. Sizzling components by the scores.

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 620
Posts: 34003
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.

Quote
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?
Logged

florida
Offline Offline
Newbie
*
Karma: 0
Posts: 42
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 620
Posts: 34003
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
how to make that simple code move with a potentiometer
http://arduino.cc/it/Tutorial/MotorKnob
Logged

Pages: [1] 2 3 ... 5   Go Up
Jump to: