only one motor is running the given number of steps,other motor is not moving?

#include <AccelStepper.h>
#include <MultiStepper.h>

AccelStepper stepperX(1, 3, 2);   // 1 = Easy Driver interface
                                  // UNO Pin 2 connected to STEP pin of Easy Driver
                                  // UNO Pin 3 connected to DIR pin of Easy Driver
                                  
AccelStepper stepperZ(1, 6, 7);   // 1 = Easy Driver interface
                                  // UNO Pin 5 connected to STEP pin of Easy Driver
                                  // UNO Pin 6 connected to DIR pin of Easy Driver

// Stepper Travel Variables
long TravelX;  // Used to store the X value entered in the Serial Monitor
long TravelZ;  // Used to store the Z value entered in the Serial Monitor

int move_finished=1;  // Used to check if move is completed
int reset = 4;

void setup() {
  pinMode(reset,OUTPUT);
  digitalWrite(reset,HIGH);
  Serial.begin(9600);  // Start the Serial monitor with speed of 9600 Bauds
  
// Print out Instructions on the Serial Monitor at Start
  Serial.println("Enter Travel distance seperated by a comma: X,Z ");
  Serial.print("Enter Move Values Now: ");

//  Set Max Speed and Acceleration of each Steppers
  stepperX.setMaxSpeed(500.0);      // Set Max Speed of X axis
  stepperX.setAcceleration(500.0);  // Acceleration of X axis

  stepperZ.setMaxSpeed(250.0);      // Set Max Speed of Y axis slower for rotation
  stepperZ.setAcceleration(250.0);  // Acceleration of Y axis

}


void loop() {

while (Serial.available()>0)  { // Check if values are available in the Serial Buffer

  move_finished=0;  // Set variable for checking move of the Steppers
  
  TravelX= Serial.parseInt();  // Put First numeric value from buffer in TravelX variable
  Serial.print(TravelX);
  Serial.print(" X Travel , ");
  
  TravelZ= Serial.parseInt();  // Put Second numeric value from buffer in TravelZ variable
  Serial.print(TravelZ);  
  Serial.println(" Y Travel ");
  
  stepperX.moveTo(TravelX);  // Set new move position for X Stepper
  stepperZ.moveTo(TravelZ);  // Set new move position for Z Stepper
  
  delay(1000);  // Wait 1 seconds before moving the Steppers
  Serial.print("Moving Steppers into position...");
  }

// Check if the Steppers have reached desired position
  if ((stepperX.distanceToGo() != 0) || (stepperZ.distanceToGo() !=0)) {
    
    stepperX.run();  // Move Stepper X into position
    stepperZ.run();  // Move Stepper Z into position
    
  }

// If move is completed display message on Serial Monitor
  if ((move_finished == 0) && (stepperX.distanceToGo() == 0) && (stepperZ.distanceToGo() == 0)) {
    Serial.println("COMPLETED!");
    Serial.println("");
    Serial.println("Enter Next Move Values (0,0 for reset): ");  // Get ready for new Serial monitor values
    move_finished=1;  // Reset move variable
  }
}

You need to provide more information. Especially, what values are being set for the motors to move to.

And which motor is moving?

Can you get the other to move with a different program?

I don't think this IF statement is needed, though it probably won't do any harm

  if ((stepperX.distanceToGo() != 0) || (stepperZ.distanceToGo() !=0)) {

...R

i give the motor the number of steps it has no move. i give the values like 30,50 or 40,60. its explained in the comments given in the code.

i want both the motors to move simultaneously,thats the purpose of this code no problem with,motors work properly.

stepperX only works properly,stepperZ doesnt move at all

barath1997: i give the values like 30,50 or 40,60.

That sounds like those are the values you are entering at the Serial Monitor. But are those values finding their way to the variables TravelX and TravelZ ?

The behaviour you describe gives the impression that TravelZ is set to 0

I suggest you comment out all the serial input code and just put in fixed values for those variables and see what happens.

...R

i did that both motors are vibrating a lot and moving one step together back and forth.

#include <AccelStepper.h>
#include <MultiStepper.h>

AccelStepper stepperX(1, 3, 2);   // 1 = Easy Driver interface
                                  // UNO Pin 2 connected to STEP pin of Easy Driver
                                  // UNO Pin 3 connected to DIR pin of Easy Driver
                                 
AccelStepper stepperZ(1, 6, 7);   // 1 = Easy Driver interface
                                  // UNO Pin 5 connected to STEP pin of Easy Driver
                                  // UNO Pin 6 connected to DIR pin of Easy Driver

// Stepper Travel Variables
long TravelX;  // Used to store the X value entered in the Serial Monitor
long TravelZ;  // Used to store the Z value entered in the Serial Monitor

int move_finished=1;  // Used to check if move is completed
int reset = 4;

void setup() {
  pinMode(reset,OUTPUT);
  digitalWrite(reset,HIGH);
  Serial.begin(9600);  // Start the Serial monitor with speed of 9600 Bauds
 
// Print out Instructions on the Serial Monitor at Start
 ;

//  Set Max Speed and Acceleration of each Steppers
  stepperX.setMaxSpeed(1000);    // Set Max Speed of X axis
    // Acceleration of X axis

  stepperZ.setMaxSpeed(1000);/ Set Max Speed of Y axis slower for rotation
 // Acceleration of Y axis

}


void loop() {

// Check if values are available in the Serial Buffer

  move_finished=0;  // Set variable for checking move of the Steppers
 
  TravelX= 1000;
  Serial.print(TravelX);
  Serial.print(" X Travel , ");
 
  TravelZ= 2000;
  Serial.print(TravelZ); 
  Serial.println(" Y Travel ");
 
  stepperX.moveTo(TravelX);  // Set new move position for X Stepper
  stepperZ.moveTo(TravelZ);  // Set new move position for Z Stepper
 
  delay(1000);  // Wait 1 seconds before moving the Steppers
  Serial.print("Moving Steppers into position...");
  

// Check if the Steppers have reached desired position
  if ((stepperX.distanceToGo() != 0) || (stepperZ.distanceToGo() !=0)) {
   
    stepperX.runSpeed();
    stepperZ.runSpeed();
  }

// If move is completed display message on Serial Monitor
  if ((move_finished == 0) && (stepperX.distanceToGo() == 0) && (stepperZ.distanceToGo() == 0)) {
    Serial.println("COMPLETED!");
    Serial.println("");
    Serial.println("Enter Next Move Values (0,0 for reset): ");  // Get ready for new Serial monitor values
    move_finished=1;  // Reset move variable
  }
}

barath1997: i did that both motors are vibrating a lot and moving one step together back and forth.

Try a much slower stepper speed - like 10 steps per second.

And you have not set the acceleration rates for the motors - I don't know what the default is.

...R

i gave acceleration and also reduced the speed,but its the same motor is vibratng a lot as previously

#include <AccelStepper.h>
#include <MultiStepper.h>

AccelStepper stepperX(1, 3, 2);   // 1 = Easy Driver interface
                                  // UNO Pin 2 connected to STEP pin of Easy Driver
                                  // UNO Pin 3 connected to DIR pin of Easy Driver
                                 
AccelStepper stepperZ(1, 6, 7);   // 1 = Easy Driver interface
                                  // UNO Pin 5 connected to STEP pin of Easy Driver
                                  // UNO Pin 6 connected to DIR pin of Easy Driver

// Stepper Travel Variables
long TravelX;  // Used to store the X value entered in the Serial Monitor
long TravelZ;  // Used to store the Z value entered in the Serial Monitor

int move_finished=1;  // Used to check if move is completed
int reset = 4;

void setup() {
  pinMode(reset,OUTPUT);
  digitalWrite(reset,HIGH);
  Serial.begin(9600);  // Start the Serial monitor with speed of 9600 Bauds
 
// Print out Instructions on the Serial Monitor at Start
 

//  Set Max Speed and Acceleration of each Steppers
  stepperX.setMaxSpeed(10);    // Set Max Speed of X axis
     stepperX.setAcceleration(10);// Acceleration of X axis

  stepperZ.setMaxSpeed(10);
 
  stepperZ.setAcceleration(10);// Acceleration of Y axis

}


void loop() {

// Check if values are available in the Serial Buffer

  move_finished=0;  // Set variable for checking move of the Steppers
 
  TravelX= 4;
  Serial.print(TravelX);
  Serial.print(" X Travel , ");
 
  TravelZ= 5;
  Serial.print(TravelZ); 
  Serial.println(" Y Travel ");
 
  stepperX.moveTo(TravelX);  // Set new move position for X Stepper
  stepperZ.moveTo(TravelZ);  // Set new move position for Z Stepper
 
  delay(1000);  // Wait 1 seconds before moving the Steppers
  Serial.print("Moving Steppers into position...");
  

// Check if the Steppers have reached desired position
  if ((stepperX.distanceToGo() != 0) || (stepperZ.distanceToGo() !=0)) {
   
    stepperX.runSpeed();
    stepperZ.runSpeed();
  }

// If move is completed display message on Serial Monitor
  if ((move_finished == 0) && (stepperX.distanceToGo() == 0) && (stepperZ.distanceToGo() == 0)) {
    Serial.println("COMPLETED!");
    Serial.println("");
    Serial.println("Enter Next Move Values (0,0 for reset): ");  // Get ready for new Serial monitor values
    move_finished=1;  // Reset move variable
  }
}

Vibrating steppers can be due to being wired wrongly. Remember to fully power down before disconnecting or connecting the stepper motor wires to the driver, otherwise you'll probably fry it completely. Connections between driver and stepper motor must be rock-solid.

Referring to the code in Reply #7 ....

TravelX= 4;

means that the motor will move 4 steps. That's hardly enough to notice. Why not get it to go a full revolution? Or at least a quarter revolution.

...R

i tried that also,i increased the number of steps to 100 to 400,still its the same

I don't have time to study this today. I have bookmarked the Thread in the hope that I remember to look at it tomorrow.

Have you checked the wiring as suggested in Reply #8 by someone who knows a great deal more about stepper motors than I.

...R

Sorry, I forgot about this until now.

Try this version. Note how I have moved a lot of code from loop() to setup() because it only needs to be run once.

#include <AccelStepper.h>

AccelStepper stepperX(1, 3, 2);   // 1 = Easy Driver interface
        // UNO Pin 2 connected to STEP pin of Easy Driver
        // UNO Pin 3 connected to DIR pin of Easy Driver
                                                                 
AccelStepper stepperZ(1, 6, 7);   // 1 = Easy Driver interface
        // UNO Pin 5 connected to STEP pin of Easy Driver
        // UNO Pin 6 connected to DIR pin of Easy Driver

// Stepper Travel Variables
long TravelX;  // Used to store the X value entered in the Serial Monitor
long TravelZ;  // Used to store the Z value entered in the Serial Monitor

int move_finished=1;  // Used to check if move is completed
int reset = 4;

void setup() {
    pinMode(reset,OUTPUT);
    digitalWrite(reset,HIGH);
    Serial.begin(9600);  // Start the Serial monitor with speed of 9600 Bauds
 
        // Print out Instructions on the Serial Monitor at Start
 

        //  Set Max Speed and Acceleration of each Steppers
    stepperX.setMaxSpeed(10);    // Set Max Speed of X axis
    stepperX.setAcceleration(10);// Acceleration of X axis

    stepperZ.setMaxSpeed(10);
    stepperZ.setAcceleration(10);// Acceleration of Y axis
    
    move_finished=0;  // Set variable for checking move of the Steppers
 
    TravelX= 200;
    Serial.print(TravelX);
    Serial.print(" X Travel , ");
 
    TravelZ= 200;
    Serial.print(TravelZ); 
    Serial.println(" Y Travel ");
 
    stepperX.moveTo(TravelX);  // Set new move position for X Stepper
    stepperZ.moveTo(TravelZ);  // Set new move position for Z Stepper
    
    delay(1000);  // Wait 1 seconds before moving the Steppers
    Serial.print("Moving Steppers into position...");
    
}


void loop() {
    
    stepperX.run(); // run() uses accleration, runSpeed() does not
    stepperZ.run();

        // If move is completed display message on Serial Monitor
    if ((move_finished == 0) && (stepperX.distanceToGo() == 0) && (stepperZ.distanceToGo() == 0)) {
        Serial.println("COMPLETED!");
        Serial.println("");
        Serial.println("Enter Next Move Values (0,0 for reset): ");  // Get ready for new Serial monitor values
        move_finished=1;  // Reset move variable
    }
}

…R