Not Reaching Full RPM's with Stepper Motor and Arduino Uno

From the following link:

I have the following components:

MOTOR 1
STP-MTRH-34127 (NEMA 34 Stepper Motor)
STP-DRV-80100 (Suitable Driver)
STP-PWR-7005 (Suitable Power Supply)

MOTOR 2
STP-MTR-23055 (NEMA 23 Stepper Motor)
STP-DRV-4850 (Suitable Driver)
STP-PWR-7005 (Suitable Power Supply)

I am running these components through an Arduino Uno with the following code:

int dirpin = 8;                         
int steppin = 9;
int dirpin1 = 6;
int steppin1 =7;
void setup() 
{
pinMode(dirpin, OUTPUT);
pinMode(steppin, OUTPUT);
pinMode(dirpin1, OUTPUT);
pinMode(steppin1, OUTPUT);
/////////////////////////// System starts by going to the right//////////////////////////////////////////////////
/////////////////////////// Top X-Directional Speed with current settings is 850 Microseconds delay///////////// 

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////   Section below controls X_RIGHT


}
void loop(){ 
  int j;
  int i;
  int c;
  int k;
  digitalWrite(dirpin, LOW);     // Set the direction. Shouldn't have to change.
  delay(500);

for (j = 0; j<10; j++)           //Controls amount of rotations forward
  for (i = 0; i<200; i++)        //Corresponds to how many steps it takes for for one revolution. 
                                 //Current setting is 200 steps/rev
                                 
  {
    digitalWrite(steppin, LOW);  // This LOW to HIGH change is what creates the
    digitalWrite(steppin, HIGH); // "Rising Edge" so the easydriver knows to when to step.
    delayMicroseconds(800);      // This delay time is close to top speed for the current settings. 
                                 // This delay basically controls the speed of the motor. Shorter delay==>faster speed.
  }                              

  digitalWrite(dirpin, HIGH);    // Change direction.
 //delay(1000);                  // Delay time to change direction. Not needed 
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////     Section below controls Y_UP
  digitalWrite(dirpin1, LOW);     // Set the direction. Shouldn't have to change 
  delay(500);

for (k = 0; k<10; k++)            //Controls amount of rotations forward
  for (i = 0; i<200; i++)         //Corresponds to how many steps it takes for for one revolution. 
                                  //Current setting is 200 steps/rev
                                  
  {
    digitalWrite(steppin1, LOW);  // This LOW to HIGH change is what creates the
    digitalWrite(steppin1, HIGH); // "Rising Edge" so the easydriver knows to when to step.
    delayMicroseconds(1000);      // This delay time is close to top speed for the current settings. 
  }                               // This delay basically controls the speed of the motor. Shorter delay==>faster speed.

  digitalWrite(dirpin, HIGH);    // Change direction.
  delay(500);                    // Delay time to change direction

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////    Section below controls X_LEFT

for (c = 0; c<10; c++)          //Controls amount of rotations in reverse
  for (i = 0; i<200; i++)       //Corresponds to how many steps it takes for for one revolution. 
                                //Current setting is 200 steps/rev.
                                
  {
    digitalWrite(steppin, LOW);  // This LOW to HIGH change is what creates the
    digitalWrite(steppin, HIGH); // "Rising Edge" so the easydriver knows to when to step.
    delayMicroseconds(800);      // This delay time is close to top speed for the current settings. 
                                 // This delay basically controls the speed of the motor. Shorter delay==>faster speed.
  }                             

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////   Section below controls Y_DOWN
 digitalWrite(dirpin1, LOW);     // Set the direction.
  delay(500);

for (k = 0; k<10; k++)            //Controls amount of rotations forward
  for (i = 0; i<200; i++)         //Corresponds to how many steps it takes for for one revolution. 
                                  //Current setting is 200 steps/rev.
  {
    digitalWrite(steppin1, LOW);  // This LOW to HIGH change is what creates the
    digitalWrite(steppin1, HIGH); // "Rising Edge" so the easydriver knows to when to step.
    delayMicroseconds(1000);      // This delay time is close to top speed for the current settings. 
  }                               // This delay basically controls the speed of the motor. Shorter delay==>faster speed.


  digitalWrite(dirpin, HIGH);    // Change direction.
  delay(500);


}

Right now, I have the setting of 200 steps per revolution. I can only get the MicrosecondDelay down to about 750 before the motor begins to grind. This is without any applied load so it is obviously capable of more since this is only around 400 RPM. The X-Directional motor is capable of close to 1200 RPM's.

Does anyone have any suggestions as to why I am peaking out with my output frequency at about 1333.33 steps per second? l

Appreciate any help. Thanks

Jordan

My guess is that the inertia of the motor doesn't allow it to instantly go from 0 RPM to that high a speed. Try ramping the speed up and down.

johnwasser's suggestion is easy to implement using the AccelStepper library.

So with the code I previously attached, how would I implement the following AccelStepper code:

// MultiStepper.pde
// -*- mode: C++ -*-
//
// Shows how to multiple simultaneous steppers
// Runs one stepper forwards and backwards, accelerating and decelerating
// at the limits. Runs other steppers at the same time
//
// Copyright (C) 2009 Mike McCauley
// $Id: MultiStepper.pde,v 1.1 2011/01/05 01:51:01 mikem Exp mikem $

#include <AccelStepper.h>

// Define some steppers and the pins the will use
AccelStepper stepper1; // Defaults to AccelStepper::FULL4WIRE (4 pins) on 2, 3, 4, 5
AccelStepper stepper2(AccelStepper::FULL4WIRE, 6, 7, 8, 9);
AccelStepper stepper3(AccelStepper::FULL2WIRE, 10, 11);

void setup()
{  
    stepper1.setMaxSpeed(200.0);
    stepper1.setAcceleration(100.0);
    stepper1.moveTo(24);
    
    stepper2.setMaxSpeed(300.0);
    stepper2.setAcceleration(100.0);
    stepper2.moveTo(1000000);
    
    stepper3.setMaxSpeed(300.0);
    stepper3.setAcceleration(100.0);
    stepper3.moveTo(1000000); 
}

void loop()
{
    // Change direction at the limits
    if (stepper1.distanceToGo() == 0)
	stepper1.moveTo(-stepper1.currentPosition());
    stepper1.run();
    stepper2.run();
    stepper3.run();
}

I want to maintain my motion from my previous code. This is:

  1. X Motor moves right
  2. X Motor stops
  3. Y Motor moves up
  4. Y Motor stops
  5. X Motor reverses direction
  6. X Motor Stops
  7. Y Motor moves up
  8. Y Motor Stops
  9. Repeat process

How do I maintain this motion while implementing the AccelStepper code? Basically, I would I write the code to get the acceleration in my previous code?

Look here AccelStepper: AccelStepper Class Reference for information on setting up the constructor for stepper driver boards with step and dir inputs.

void setup() 
{  
    stepper1.setMaxSpeed(200.0);
    stepper1.setAcceleration(100.0);
    stepper1.moveTo(24);
 }

So with this following code, setMaxSpeed is my steps/sec while the setAcceleration is my steps/s^2. What exactly is the moveTo function? The number of steps?

The AccelStepper class is well documented if you look....