Arduion mega 2560 and some motorshields

I have to control 6 motors (3 stepper-motors; the other 3 only to control their rotating frequency). All 6 motors are to be controlled independantly.

  1. Is it correct that I need for each stepper-motor a motor shield, an 2 motor shields for controlling the frequency of the other 3 motors?
  2. Is it possible to stack these 5 shields on my arduino mega 2560, if they are stackable?
  3. Which pins on my arduino must I use, to control all 6 motors independantly (How to adress each of the 6 motors?)
  1. Is it correct that I need for each stepper-motor a motor shield

One specifically for steppers, yes. Like: Big Easy Driver - ROB-12859 - SparkFun Electronics

an 2 motor shields for controlling the frequency of the other 3 motors?

I don't know what you mean by frequency. Speed? If so, yes, you'll need two.

  1. Is it possible to stack these 5 shields on my arduino mega 2560, if they are stackable?

No.

  1. Which pins on my arduino must I use

Any three PWM pins to control the speed of the motors and any three pins to control the direction. Since you won't be using shields, you won't be constrained to some set of pins.

Any three step pins for the steppers, and any three direction pins. Since you won't be using shields, you won't be constrained to some set of pins.

sir i need program to interface stepper motor with the arduino board to move the robot left right and forward.

Detail-deficient post.
Budget?
Hardware?

working on an arduino board using arduino softwares. we want to move robot in a square loop using stepper motors.

will i have to change programming if i use stepper motor instead of servo motors?
#include <Servo.h> //include Servo library

const int RForward = 0;
const int RBackward = 180;
const int LForward = RBackward;
const int LBackward = RForward;
const int RNeutral = 90;
const int LNeutral = 90; //constants for motor speed
const int pingPin = 7;
const int irPin = 0; //Sharp infrared sensor pin
const int dangerThresh = 10; //threshold for obstacles (in cm)
int leftDistance, rightDistance; //distances on either side
Servo panMotor;
Servo leftMotor;
Servo rightMotor; //declare motors
long duration; //time it takes to recieve PING))) signal

void setup()
{
rightMotor.attach(11);
leftMotor.attach(10);
panMotor.attach(6); //attach motors to proper pins
panMotor.write(90); //set PING))) pan to center
}

void loop()
{
int distanceFwd = ping();
if (distanceFwd>dangerThresh) //if path is clear
{
leftMotor.write(LForward);
rightMotor.write(RForward); //move forward
}
else //if path is blocked
{
leftMotor.write(LNeutral);
rightMotor.write(RNeutral);
panMotor.write(0);
delay(500);
rightDistance = ping(); //scan to the right
delay(500);
panMotor.write(180);
delay(700);
leftDistance = ping(); //scan to the left
delay(500);
panMotor.write(90); //return to center
delay(100);
compareDistance();
}
}

void compareDistance()
{
if (leftDistance>rightDistance) //if left is less obstructed
{
leftMotor.write(LBackward);
rightMotor.write(RForward); //turn left
delay(500);
}
else if (rightDistance>leftDistance) //if right is less obstructed
{
leftMotor.write(LForward);
rightMotor.write(RBackward); //turn right
delay(500);
}
else //if they are equally obstructed
{
leftMotor.write(LForward);
rightMotor.write(RBackward); //turn 180 degrees
delay(1000);
}
}

long ping()
{
// Send out PING))) signal pulse
pinMode(pingPin, OUTPUT);
digitalWrite(pingPin, LOW);
delayMicroseconds(2);
digitalWrite(pingPin, HIGH);
delayMicroseconds(5);
digitalWrite(pingPin, LOW);

//Get duration it takes to receive echo
pinMode(pingPin, INPUT);
duration = pulseIn(pingPin, HIGH);

//Convert duration into distance
return duration / 29 / 2;
}

Still very detail-deficient.
Yes, you will have to rewrite if you use steppers instead of servos.
Please use code tags when posting code.

sir can you send me the link to various stepper motor programs. all the programs that i found works on servo motor and not on stepper motors.

Have you looked at any of the examples provided with the IDE?

sir i am using L293D to drive my stepper motors..! and a ping sensor/

Start so please.
Get one motor working, then the second.
Only then start integration with your Ping code.

I have two stepper motors and I want to run them simultaneously but the example code can only control one and then the other?

I have two stepper motors and I want to run them simultaneously but the example code can only control one and then the other?

Which example?

There is an AccelStepper library that allows simultaneous motion of stepper motors.

@PaulS (and community)

With your Help I now seem to have a solution for steering 3 DC-Motors und 3 stepper-motors with the Arduiono Mega 2560 (each DC-Motor < 600mA; stepper-motors each phase < 1A)
1.I use an adafruit Motor shield for the 3 DC-Motors
2. The 3 stepper-Motors are connected each with a BigEasyDriver as you suggested.
3. Because I don't use servos, the PWM-Pins 9 and 10 ( and 2 which is always unused; Mega2560!) of the adafruit motorshield can be used as PWM for the 3 stepper-motors. Each of them also uses another free digital-Pin for its direction control.
4. I want to use the AccelStepper-Library to control all motors.

Does anyone see any problems in this concept?

Does anyone see any problems in this concept?

Some, perhaps not intentional:

Because I don't use servos, the PWM-Pins 9 and 10 ( and 2 which is always unused; Mega2560!) of the adafruit motorshield can be used as PWM for the 3 stepper-motors. Each of them also uses another free digital-Pin for its direction control.

Stepper motors don't use PWM. Did you mean DC motors here?

Other than that, I don't see any problems.

Stepper motors don't use PWM. Did you mean DC motors here?

Either I didn't understand fundamental things or I was not precise enough:
I meant that the BigEasy-Drivers need PWM as input if stepper-motors are to be steered.I found an example http://bildr.org/2012/11/big-easy-driver-arduino/ where one PWM-Pin is connected to the BigEasyDriver inputs while the other input Pin is connected to a normal digital output (direction).

But if a steppermotor only needs two digital inputs, everything would be more easy because the Mega2560 has much simple digital pins.

Do BigEasyDriver need PWM-Outputs for steering stepper-Motors?

I meant that the BigEasy-Drivers need PWM as input if stepper-motors are to be steered.

No, they don't. They simply need to be told step, step, step, at the right time. PWM is NOT the way to do that. That the example you liked to used a PWM-capable pin does not mean that it is using PWM. The two pins could just as easily have been reversed, with only minor changes in the code and NO change in results.

Thanks,
now things seem much more clear to me.