Driver Motor Programming Issue

Hello, I am a newbie on Arduino. I'm currently working on my project. I have Arduino Mega 2560 and want to drive 12 bipolair stepper motors ( L298 as driver).
I want to drive 12 stepper motors ( sure using a driver ULN2003 or L298).
my project is to drive 6 steppers motors CW (left) and the others 6 steppers motors on CCW (right) at the same time and the opposite too My questions are:

I prepare my program with 4 steppers motors ( 2 CCW and 2 CW and the opposite too) and I simulate it in Proteus using the arduino pins. it looked right to do one revolution but I need just a part of revolution (1/4 revolution or 1/2 revolution ) for each stepper motor.
when I used the "stepper library" it works for a part of revolution but there is a delay betwwen the motors they did not rotate on the same time; but when I used the digitalWrite the motors rotate on the same time(2 CCW and 2 CW) but I could not did the part of revolution.
'I am stuck at the use of the L298N Driver. the simulation does not work because the output 3 does not work.
but for unipolaire motor with ULN2003 worked well.
I'm using these components as follows:

  • Arduino Mega
  • bipolair stepper motor (with L298) or unipolair (with ULN2003)

Post a data sheet for your stepper motors. The L298 is a very bad stepper motor driver. They are ancient and inefficient technology and are all wrong for modern bipolar steppers. If we know what stepper motor that you are using we can recommend a better driver.

The Stepper library is not the best for multiple steppers.

This Arduino forum is not the place to get help with problems that you are having with a simulator. Is there a forum for the simulator? We are glad to help with problems with real hardware and the Arduino IDE.

Thank you I appreciate your advice.
I try with this program it works well with a full revolution but I want it with a part revolution (1/2 or 1/4 revolution). Some one help me

int switchPins[]= {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49};
int pinCount = 50;
void setup() {
  // 
for (int thisPin = 0; thisPin < pinCount; thisPin++){
  pinMode(switchPins[thisPin], OUTPUT);
}
void loop(){
motorG ();
}
void motorG()
{
// half step count clockwise (motors1-6) & half step clockwise (motors7-12)
digitalWrite( 5, HIGH);    //Motor1= -45°
digitalWrite( 9, HIGH);   
digitalWrite( 13, HIGH);   
digitalWrite( 17, HIGH);   
digitalWrite( 21, HIGH);   
digitalWrite(25, HIGH);   
digitalWrite( 26, HIGH);    //Motor7= +45°   
digitalWrite( 30, HIGH);   
digitalWrite(34, HIGH);  
digitalWrite(38, HIGH);    
digitalWrite( 42, HIGH);   
digitalWrite( 46, HIGH);   
delay(1000);
digitalWrite( 2, LOW);     //Motor1= -90°
digitalWrite( 6, LOW);     
digitalWrite( 10, LOW);     
digitalWrite( 14, LOW);  
digitalWrite( 18, LOW);     
digitalWrite( 22, LOW);     
digitalWrite( 29, LOW);     //Motor7= +90°   
digitalWrite( 33, LOW);     
digitalWrite( 37, LOW);   
digitalWrite( 41, LOW);     
digitalWrite( 45, LOW);     
digitalWrite( 49, LOW);    
delay(1000);
digitalWrite( 4, HIGH);    //Motor1= -135°
digitalWrite( 8, HIGH);  
digitalWrite( 12, HIGH);   
digitalWrite( 16, HIGH);  
digitalWrite( 20, HIGH);   
digitalWrite( 24, HIGH);   
digitalWrite( 27, HIGH);    //Motor7= +135°   
digitalWrite( 31, HIGH);   
digitalWrite( 35, HIGH);   
digitalWrite( 39, HIGH);  
digitalWrite( 43, HIGH);   
digitalWrite( 47, HIGH);   
delay(1000);
digitalWrite( 5, LOW);    //Motor1= -180°
digitalWrite( 9, LOW);   
digitalWrite( 13, LOW);   
digitalWrite( 17, LOW);   
digitalWrite( 21, LOW);   
digitalWrite( 25, LOW);  
digitalWrite( 26, LOW);    //Motor7= +180°   
digitalWrite( 30, LOW);   
digitalWrite( 34, LOW);  
digitalWrite( 38, LOW);   
digitalWrite( 42, LOW);    
digitalWrite( 46, LOW);   
delay(1000);
digitalWrite( 3, HIGH);   //Motor1= -225°
digitalWrite( 7, HIGH);  
digitalWrite( 11, HIGH); 
digitalWrite( 15, HIGH); 
digitalWrite( 19, HIGH);   
digitalWrite( 23, HIGH); 
digitalWrite( 28, HIGH);   //Motor7-12= +225°
digitalWrite( 32, HIGH);   
digitalWrite( 36, HIGH); 
digitalWrite( 40, HIGH); 
digitalWrite( 44, HIGH);   
digitalWrite( 48, HIGH);   
delay(1000);
digitalWrite( 4, LOW);    //Motor1-6= -270°
digitalWrite( 8, LOW);   
digitalWrite( 12, LOW);   
digitalWrite( 16, LOW);   
digitalWrite( 20, LOW); 
digitalWrite( 24, LOW);   
digitalWrite( 27, LOW);    //Motor7 -12= +270°
digitalWrite( 31, LOW);  
digitalWrite( 35, LOW);  
digitalWrite( 39, LOW);  
digitalWrite( 43, LOW);   
digitalWrite( 47, LOW);   
delay(1000);
digitalWrite( 2, HIGH);    //Motor1 - 6= -315°
digitalWrite( 6, HIGH);   
digitalWrite( 10, HIGH);   
digitalWrite( 14, HIGH);  
digitalWrite( 18, HIGH);   
digitalWrite( 22, HIGH);   
digitalWrite( 29, HIGH);    //Motor7-12= +315°   
digitalWrite( 33, HIGH);   
digitalWrite( 37, HIGH);  
digitalWrite( 41, HIGH);   
digitalWrite( 45, HIGH);  
digitalWrite( 49, HIGH);  
delay(1000);
digitalWrite( 3, LOW);     //Motor1-2= -360°
digitalWrite( 7, LOW);   
digitalWrite( 11, LOW);     
digitalWrite( 15, LOW);     
digitalWrite( 19, LOW);   
digitalWrite( 23, LOW);   
digitalWrite( 28, LOW);     //Motor7 - 12= +360°   
digitalWrite( 32, LOW);     
digitalWrite( 36, LOW);     
digitalWrite( 40, LOW);
digitalWrite( 44, LOW); 
digitalWrite( 48, LOW);           
delay(1000);
digitalWrite( 5, HIGH);    //Motor1- 6= -45°
digitalWrite( 9, HIGH);   
digitalWrite( 13, HIGH); 
digitalWrite( 17, HIGH);     
digitalWrite( 21, HIGH);  
digitalWrite(25, HIGH);  
digitalWrite( 26, HIGH);    //Motor7-12= +45°   
digitalWrite( 30, HIGH);  
digitalWrite(34, HIGH);       
digitalWrite( 38, HIGH);  
digitalWrite( 46, HIGH);   
delay(1000);
 // half step clockwise (motors1-6) & half step count clockwise (motors7-12)
digitalWrite( 2, HIGH);    //Motor1-6= +45°   
digitalWrite( 6, HIGH);   
digitalWrite( 10, HIGH);   
digitalWrite( 14, HIGH);   
digitalWrite( 18, HIGH);  
digitalWrite( 22, HIGH);  
digitalWrite( 29, HIGH);    //Motor7-12 = -45°
digitalWrite( 33, HIGH);   
digitalWrite( 37, HIGH);   
digitalWrite( 41, HIGH);   
digitalWrite( 45, HIGH);   
digitalWrite( 49, HIGH);   
delay(1000);
digitalWrite( 5, LOW);     //Motor1-6 = +90°   
digitalWrite( 9, LOW);     
digitalWrite( 13, LOW);   
digitalWrite( 17, LOW);     
digitalWrite( 21, LOW);     
digitalWrite( 25, LOW);    
digitalWrite( 26, LOW);     //Motor7-12 = -90°
digitalWrite( 30, LOW);     
digitalWrite( 34, LOW);   
digitalWrite( 38, LOW);   
digitalWrite( 42, LOW);     
digitalWrite( 46, LOW);    
delay(1000);
digitalWrite( 3, HIGH);    //Motor1= +135°   
digitalWrite( 7, HIGH);   
digitalWrite( 11, HIGH);   
digitalWrite( 15, HIGH);   
digitalWrite( 19, HIGH);   
digitalWrite( 23, HIGH);   
digitalWrite( 28, HIGH);    //Motor7= -135°
digitalWrite( 32, HIGH);   
digitalWrite( 36, HIGH);   
digitalWrite( 40, HIGH);   
digitalWrite( 44, HIGH);   
digitalWrite( 48, HIGH);  
delay(1000);
digitalWrite( 2, LOW);    //Motor1= +180°   
digitalWrite( 6, LOW);   
digitalWrite( 10, LOW);   
digitalWrite( 14, LOW);   
digitalWrite( 18, LOW);  
digitalWrite( 22, LOW);   
digitalWrite( 29, LOW);    //Motor7= -180°
digitalWrite( 33, LOW);   
digitalWrite( 37, LOW);   
digitalWrite( 41, LOW);   
digitalWrite( 45, LOW);   
digitalWrite( 49, LOW);   
delay(1000);
digitalWrite( 4, HIGH);   //Motor1= +225°   
digitalWrite( 8, HIGH);
digitalWrite( 12, HIGH); 
digitalWrite( 16, HIGH);   
digitalWrite( 20, HIGH);   
digitalWrite( 24, HIGH); 
digitalWrite( 27, HIGH);   //Motor7= -225°
digitalWrite( 31, HIGH); 
digitalWrite( 35, HIGH); 
digitalWrite( 39, HIGH); 
digitalWrite( 43, HIGH);   
digitalWrite( 47, HIGH);   
delay(1000);
digitalWrite( 3, LOW);    //Motor1= +270°   
digitalWrite( 7, LOW);  
digitalWrite( 11, LOW);   
digitalWrite( 15, LOW);   
digitalWrite( 19, LOW);   
digitalWrite( 23, LOW);   
digitalWrite( 28, LOW);    //Motor7= -270°
digitalWrite( 32, LOW);  
digitalWrite( 36, LOW);   
digitalWrite( 40, LOW);   
digitalWrite( 44, LOW);   
digitalWrite( 48, LOW);
delay(1000);
digitalWrite( 5, HIGH);    //Motor1= +315°   
digitalWrite( 9, HIGH);   
digitalWrite( 13, HIGH);   
digitalWrite( 17, HIGH);   
digitalWrite( 21, HIGH);   
digitalWrite( 25, HIGH);   
digitalWrite( 26, HIGH);    //Motor7= -315°
digitalWrite( 30, HIGH);   
digitalWrite( 34, HIGH);   
digitalWrite( 38, HIGH);   
digitalWrite( 42, HIGH); 
digitalWrite( 46, HIGH);   
delay(1000);
digitalWrite( 4, LOW);     //Motor1= +360°   
digitalWrite( 8, LOW);     
digitalWrite( 12, LOW);    
digitalWrite( 16, LOW);   
digitalWrite( 20, LOW);     
digitalWrite( 24, LOW);     
digitalWrite( 27, LOW);     //Motor7= -360°
digitalWrite( 31, LOW);     
digitalWrite( 35, LOW);  
digitalWrite( 39, LOW);   
digitalWrite( 43, LOW);    
digitalWrite( 47, LOW);   
delay(1000);
digitalWrite( 2, HIGH);    //Motor1= +45°   
digitalWrite( 6, HIGH);  
digitalWrite( 10, HIGH);  
digitalWrite( 14, HIGH);  
digitalWrite( 18, HIGH);   
digitalWrite( 22, HIGH);  
digitalWrite( 29, HIGH);    //Motor7= -45°
digitalWrite( 33, HIGH); 
digitalWrite( 37, HIGH);   
digitalWrite( 41, HIGH);   
digitalWrite( 45, HIGH);   
digitalWrite( 49, HIGH);   
delay(1000);
}

Hello
Sincerly It is my first tentative to do a project also I am a newbie on Arduino. I want to drive 12 mirors: (6 left and 6 right). I want to drive 6 mirors CW (left) and the others 6 mirors on CCW (right) at the same time and the opposite too.
I chek the internet, most people work with unipolar stepper motor 28BYJ-48 (ULN2003 as driver) or Nema17 (l298 or l293 as driver) for that I based on this stepper motors and these driver.
Could you help me to choose a better stepper motor and driver for my project?.
Could I use the 2-49 arduino pins directly to drive my stepper motors or it is better to use a chift register 74HC595 with this stepper motors?. if it is yes can I use 3 registers for the left steppers and 3 registers for the right steppers so totaly only 6 pins from arduino. or better to use directy 6 registers for all steppers so use only 3 pins from Arduino?
I apreciate your help.

These 28BYJ-48 motors should be able to run off a TPIC6B595 shift register (I'm in the process of building a board that can drive four of those motors on two shift registers, with I2C interface). This IC can sink suficient current to drive the motors without the old ULN2003 chips, and to the Arduino looks just like a regular shift register.

Depending on your stepping speed and whatever else the Arduino should do, I expect it will have no issues controlling all motors in one go.

If you go the NEMA17 route, get a real stepper driver. Not an ancient H-bridge that was back in the day a good choice for driving DC motors, but is now just ancient. It's never been particularly suited for driving steppers.

Thank you for your advice.
I want just to drive these mirors; So Ican use directly the 2-49 arduino pins.

Could you help me to choose a better stepper motor and driver for my project?.

I apreciate your help.

I prepare my program and I simulate it in Proteus using directly the arduino pins. It looked right to do one revolution but I need just a part of revolution (1/4 revolution or 1/2 revolution ) for each stepper motor.
when I used the "stepper library" it works for a part of revolution but there is a delay between the motors they did not rotate on the same time; but when I used the digitalWrite the motors rotate on the same time(6 CCW and 6 CW and the opposite too) but I could not did the part of revolution.

int switchPins[]= {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49};
int pinCount = 50;
void setup() {
  //
for (int thisPin = 0; thisPin < pinCount; thisPin++){
  pinMode(switchPins[thisPin], OUTPUT);
}
void loop(){
motorG ();
}
void motorG()
{
// half step count clockwise (motors1-6) & half step clockwise (motors7-12)
digitalWrite( 5, HIGH);    //Motor1= -45°
digitalWrite( 9, HIGH);  
digitalWrite( 13, HIGH);  
digitalWrite( 17, HIGH);  
digitalWrite( 21, HIGH);  
digitalWrite(25, HIGH);  
digitalWrite( 26, HIGH);    //Motor7= +45°  
digitalWrite( 30, HIGH);  
digitalWrite(34, HIGH);  
digitalWrite(38, HIGH);   
digitalWrite( 42, HIGH);  
digitalWrite( 46, HIGH);  
delay(1000);
digitalWrite( 2, LOW);     //Motor1= -90°
digitalWrite( 6, LOW);    
digitalWrite( 10, LOW);    
digitalWrite( 14, LOW);  
digitalWrite( 18, LOW);    
digitalWrite( 22, LOW);    
digitalWrite( 29, LOW);     //Motor7= +90°  
digitalWrite( 33, LOW);    
digitalWrite( 37, LOW);  
digitalWrite( 41, LOW);    
digitalWrite( 45, LOW);    
digitalWrite( 49, LOW);    
delay(1000);
digitalWrite( 4, HIGH);    //Motor1= -135°
digitalWrite( 8, HIGH);  
digitalWrite( 12, HIGH);  
digitalWrite( 16, HIGH);  
digitalWrite( 20, HIGH);  
digitalWrite( 24, HIGH);  
digitalWrite( 27, HIGH);    //Motor7= +135°  
digitalWrite( 31, HIGH);  
digitalWrite( 35, HIGH);  
digitalWrite( 39, HIGH);  
digitalWrite( 43, HIGH);  
digitalWrite( 47, HIGH);  
delay(1000);
digitalWrite( 5, LOW);    //Motor1= -180°
digitalWrite( 9, LOW);  
digitalWrite( 13, LOW);  
digitalWrite( 17, LOW);  
digitalWrite( 21, LOW);  
digitalWrite( 25, LOW);  
digitalWrite( 26, LOW);    //Motor7= +180°  
digitalWrite( 30, LOW);  
digitalWrite( 34, LOW);  
digitalWrite( 38, LOW);  
digitalWrite( 42, LOW);    
digitalWrite( 46, LOW);  
delay(1000);
digitalWrite( 3, HIGH);   //Motor1= -225°
digitalWrite( 7, HIGH);  
digitalWrite( 11, HIGH);
digitalWrite( 15, HIGH);
digitalWrite( 19, HIGH);  
digitalWrite( 23, HIGH);
digitalWrite( 28, HIGH);   //Motor7-12= +225°
digitalWrite( 32, HIGH);  
digitalWrite( 36, HIGH);
digitalWrite( 40, HIGH);
digitalWrite( 44, HIGH);  
digitalWrite( 48, HIGH);  
delay(1000);
digitalWrite( 4, LOW);    //Motor1-6= -270°
digitalWrite( 8, LOW);  
digitalWrite( 12, LOW);  
digitalWrite( 16, LOW);  
digitalWrite( 20, LOW);
digitalWrite( 24, LOW);   
digitalWrite( 27, LOW);    //Motor7 -12= +270°
digitalWrite( 31, LOW);  
digitalWrite( 35, LOW);  
digitalWrite( 39, LOW);  
digitalWrite( 43, LOW);  
digitalWrite( 47, LOW);  
delay(1000);
digitalWrite( 2, HIGH);    //Motor1 - 6= -315°
digitalWrite( 6, HIGH);  
digitalWrite( 10, HIGH);  
digitalWrite( 14, HIGH);  
digitalWrite( 18, HIGH);  
digitalWrite( 22, HIGH);  
digitalWrite( 29, HIGH);    //Motor7-12= +315°  
digitalWrite( 33, HIGH);  
digitalWrite( 37, HIGH);  
digitalWrite( 41, HIGH);  
digitalWrite( 45, HIGH);  
digitalWrite( 49, HIGH);  
delay(1000);
digitalWrite( 3, LOW);     //Motor1-2= -360°
digitalWrite( 7, LOW);  
digitalWrite( 11, LOW);    
digitalWrite( 15, LOW);    
digitalWrite( 19, LOW);  
digitalWrite( 23, LOW);  
digitalWrite( 28, LOW);     //Motor7 - 12= +360°  
digitalWrite( 32, LOW);    
digitalWrite( 36, LOW);    
digitalWrite( 40, LOW);
digitalWrite( 44, LOW);
digitalWrite( 48, LOW);           
delay(1000);
digitalWrite( 5, HIGH);    //Motor1- 6= -45°
digitalWrite( 9, HIGH);  
digitalWrite( 13, HIGH);
digitalWrite( 17, HIGH);    
digitalWrite( 21, HIGH);  
digitalWrite(25, HIGH);  
digitalWrite( 26, HIGH);    //Motor7-12= +45°  
digitalWrite( 30, HIGH);  
digitalWrite(34, HIGH);      
digitalWrite( 38, HIGH);  
digitalWrite( 46, HIGH);  
delay(1000);
 // half step clockwise (motors1-6) & half step count clockwise (motors7-12)
digitalWrite( 2, HIGH);    //Motor1-6= +45°  
digitalWrite( 6, HIGH);  
digitalWrite( 10, HIGH);  
digitalWrite( 14, HIGH);  
digitalWrite( 18, HIGH);  
digitalWrite( 22, HIGH);  
digitalWrite( 29, HIGH);    //Motor7-12 = -45°
digitalWrite( 33, HIGH);  
digitalWrite( 37, HIGH);  
digitalWrite( 41, HIGH);  
digitalWrite( 45, HIGH);  
digitalWrite( 49, HIGH);  
delay(1000);
digitalWrite( 5, LOW);     //Motor1-6 = +90°  
digitalWrite( 9, LOW);    
digitalWrite( 13, LOW);  
digitalWrite( 17, LOW);    
digitalWrite( 21, LOW);    
digitalWrite( 25, LOW);    
digitalWrite( 26, LOW);     //Motor7-12 = -90°
digitalWrite( 30, LOW);    
digitalWrite( 34, LOW);  
digitalWrite( 38, LOW);  
digitalWrite( 42, LOW);    
digitalWrite( 46, LOW);    
delay(1000);
digitalWrite( 3, HIGH);    //Motor1= +135°  
digitalWrite( 7, HIGH);  
digitalWrite( 11, HIGH);  
digitalWrite( 15, HIGH);  
digitalWrite( 19, HIGH);  
digitalWrite( 23, HIGH);  
digitalWrite( 28, HIGH);    //Motor7= -135°
digitalWrite( 32, HIGH);  
digitalWrite( 36, HIGH);  
digitalWrite( 40, HIGH);  
digitalWrite( 44, HIGH);  
digitalWrite( 48, HIGH);  
delay(1000);
digitalWrite( 2, LOW);    //Motor1= +180°  
digitalWrite( 6, LOW);  
digitalWrite( 10, LOW);  
digitalWrite( 14, LOW);  
digitalWrite( 18, LOW);  
digitalWrite( 22, LOW);  
digitalWrite( 29, LOW);    //Motor7= -180°
digitalWrite( 33, LOW);  
digitalWrite( 37, LOW);  
digitalWrite( 41, LOW);  
digitalWrite( 45, LOW);  
digitalWrite( 49, LOW);  
delay(1000);
digitalWrite( 4, HIGH);   //Motor1= +225°  
digitalWrite( 8, HIGH);
digitalWrite( 12, HIGH);
digitalWrite( 16, HIGH);  
digitalWrite( 20, HIGH);  
digitalWrite( 24, HIGH);
digitalWrite( 27, HIGH);   //Motor7= -225°
digitalWrite( 31, HIGH);
digitalWrite( 35, HIGH);
digitalWrite( 39, HIGH);
digitalWrite( 43, HIGH);  
digitalWrite( 47, HIGH);  
delay(1000);
digitalWrite( 3, LOW);    //Motor1= +270°  
digitalWrite( 7, LOW);  
digitalWrite( 11, LOW);  
digitalWrite( 15, LOW);  
digitalWrite( 19, LOW);  
digitalWrite( 23, LOW);  
digitalWrite( 28, LOW);    //Motor7= -270°
digitalWrite( 32, LOW);  
digitalWrite( 36, LOW);  
digitalWrite( 40, LOW);  
digitalWrite( 44, LOW);  
digitalWrite( 48, LOW);
delay(1000);
digitalWrite( 5, HIGH);    //Motor1= +315°  
digitalWrite( 9, HIGH);  
digitalWrite( 13, HIGH);  
digitalWrite( 17, HIGH);  
digitalWrite( 21, HIGH);  
digitalWrite( 25, HIGH);  
digitalWrite( 26, HIGH);    //Motor7= -315°
digitalWrite( 30, HIGH);  
digitalWrite( 34, HIGH);  
digitalWrite( 38, HIGH);  
digitalWrite( 42, HIGH);
digitalWrite( 46, HIGH);  
delay(1000);
digitalWrite( 4, LOW);     //Motor1= +360°  
digitalWrite( 8, LOW);    
digitalWrite( 12, LOW);    
digitalWrite( 16, LOW);  
digitalWrite( 20, LOW);    
digitalWrite( 24, LOW);    
digitalWrite( 27, LOW);     //Motor7= -360°
digitalWrite( 31, LOW);    
digitalWrite( 35, LOW);  
digitalWrite( 39, LOW);  
digitalWrite( 43, LOW);    
digitalWrite( 47, LOW);  
delay(1000);
digitalWrite( 2, HIGH);    //Motor1= +45°  
digitalWrite( 6, HIGH);  
digitalWrite( 10, HIGH);  
digitalWrite( 14, HIGH);  
digitalWrite( 18, HIGH);  
digitalWrite( 22, HIGH);  
digitalWrite( 29, HIGH);    //Motor7= -45°
digitalWrite( 33, HIGH);
digitalWrite( 37, HIGH);  
digitalWrite( 41, HIGH);  
digitalWrite( 45, HIGH);  
digitalWrite( 49, HIGH);  
delay(1000);
}

First: pick your stepper motor, based on your parameters (which of course include the torque and speed your project needs, but may also have other considerations like cost and available space).

Second: pick a driver that is suitable for the stepper you just picked.

In case of typical stepper drivers to run your motors always for the exact same number of steps at the exact same speed, pulse all the pulse inputs of the drivers at the same time.

thank you very much; I appreciate your advice

Your sketch will be much easier to write and understand if you group your pins by motor:

const int MotorCount = 12;
const int PinsPerMotor = 4;


const int MotorPins[MotorCount][PinsPerMotor] =
{
  {2, 3, 4, 5}, {6, 7, 8, 9}, {10, 11, 12, 13},
  {14, 15, 16, 17}, {18, 19, 20, 21}, {22, 23, 24, 25},
  {26, 27, 28, 29}, {30, 31, 32, 33}, {34, 35, 36, 37},
  {38, 39, 40, 41}, {42, 43, 44, 45}, {46, 47, 48, 49}
};


void setup()
{
  //
  for (int thisMotor = 0; thisMotor < MotorCount; thisMotor++)
    for (int thisPin = 0; thisPin < PinsPerMotor; thisPin++)
    {
      pinMode(MotorPins[thisMotor][thisPin], OUTPUT);
    }
}

Hi,
What is the application?
How fast do you want the mirrors to move?

Now is the time to get down and dirty your hands and build a sample of your project, just a couple of motors and mirrors.

Thanks.. Tom... :slight_smile:

OK, I too just have to ask. What do you mean by "drive 12 mirrors: (6 left and 6 right)"?

How fast do you want to move them? Because the 28BYJ-48 with gears is certainly not fast!

wvmarle suggested that a TPIC6B595 could drive two motors, controlled by three Arduino pins, so six of them could drive 12 steppers, still controlled by three Arduino pins and a Nano would be more practical than a Mega 2560. :sunglasses:

Probably even better to use a library to handle the stepper stepping:

#include <AccelStepper.h>


const int MotorCount = 12;


AccelStepper Motors[MotorCount] = 
{
  AccelStepper(AccelStepper::FULL4WIRE, 2, 3, 4, 5), 
  AccelStepper(AccelStepper::FULL4WIRE, 6, 7, 8, 9), 
  AccelStepper(AccelStepper::FULL4WIRE, 10, 11, 12, 13),
  AccelStepper(AccelStepper::FULL4WIRE, 14, 15, 16, 17), 
  AccelStepper(AccelStepper::FULL4WIRE, 18, 19, 20, 21), 
  AccelStepper(AccelStepper::FULL4WIRE, 22, 23, 24, 25),
  AccelStepper(AccelStepper::FULL4WIRE, 26, 27, 28, 29), 
  AccelStepper(AccelStepper::FULL4WIRE, 30, 31, 32, 33), 
  AccelStepper(AccelStepper::FULL4WIRE, 34, 35, 36, 37),
  AccelStepper(AccelStepper::FULL4WIRE, 38, 39, 40, 41), 
  AccelStepper(AccelStepper::FULL4WIRE, 42, 43, 44, 45), 
  AccelStepper(AccelStepper::FULL4WIRE, 46, 47, 48, 49)
};

Paul__B:
OK, I too just have to ask. What do you mean by "drive 12 mirrors: (6 left and 6 right)"?

How fast do you want to move them? Because the 28BYJ-48 with gears is certainly not fast!

wvmarle suggested that a TPIC6B595 could drive two motors, controlled by three Arduino pins, so six of them could drive 12 steppers, still controlled by three Arduino pins and a Nano would be more practical than a Mega 2560. :sunglasses:

Crossroads and Wawa discussed the use of these chips for scores of stepper for a kinetic art display

https://forum.arduino.cc/index.php?topic=700458.225
very long thread, shows boards built and videos of steppers.
one of the questions on this thread is "how fast"
since the sketch shows increments of 45 degrees we would assume we are looking at as much as a full rotation.
I would offer that the OP should run one stepper, with their current setup to 90, 135, 180, 225, 270... etc
so see how fast that stepper can be moved with nothing else.
if one stepper, driving as fast as possible in the sketch can achieve the desired results, then that stepper and driver combination may work for the project. If only one stepper is not fast enough, more will not be faster.

@rezahmed

TOPIC MERGED.
DO NOT duplicate

Could you take a few moments to Learn How To Use The Forum.
Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.