Hi
I have 7 belt driven linear actuators ,connected to NEMA 17 stepper motors (1.8° - 1702HS133A - 44oz - 1.33A) driven by easydrivers, which are powered (in parallel) by a 24V 15A power supply and controlled by an arduino MEGA.
I am running the code below, what I am observing is that the running speeds of the individual motors seems to be inversely proportional to the number of motors running. This is having the effect that when all 7 are running its too slow for the intended purpose (it will be a horse racing type game)
I wondered if it was power supply related so I have connected one of the motors to a seperate power supply, however that motor still operates at the same speed as the others.
Any suggestions on how to speed these up?
Thanks
#include <AccelStepper.h>
AccelStepper stepper1(AccelStepper::DRIVER, 26, 27);// pin 26 = step, pin 27 = direction Stepper 1
AccelStepper stepper2(AccelStepper::DRIVER, 28, 29);// pin 28 = step, pin 29 = direction Stepper 2
AccelStepper stepper3(AccelStepper::DRIVER, 30, 31);// pin 30 = step, pin 31 = direction Stepper 3
AccelStepper stepper4(AccelStepper::DRIVER, 32, 33);// pin 32 = step, pin 33 = direction Stepper 4
AccelStepper stepper5(AccelStepper::DRIVER, 34, 35);// pin 34 = step, pin 35 = direction Stepper 5
AccelStepper stepper6(AccelStepper::DRIVER, 36, 37);// pin 36 = step, pin 37 = direction Stepper 6
AccelStepper stepper7(AccelStepper::DRIVER, 38, 39);// pin 38 = step, pin 39 = direction Stepper 7
// Define End and Start Switches
int ENDswtch1=15;int ENDswtch2=14;int ENDswtch3=2;int ENDswtch4=3;int ENDswtch5=4;int ENDswtch6=5;int ENDswtch7=6;
int STswtch1=7;int STswtch2=8;int STswtch3=9;int STswtch4=10;int STswtch5=11;int STswtch6=12;int STswtch7=13;
int StepperSleep=40; // Define Easydriver sleep pin
int StpprMAX=2000;
int StpprACC=9000;
void setup() {
// put your setup code here, to run once:
pinMode(ENDswtch1,INPUT); pinMode(ENDswtch2,INPUT); pinMode(ENDswtch3,INPUT); pinMode(ENDswtch4,INPUT); pinMode(ENDswtch5,INPUT); pinMode(ENDswtch6,INPUT); pinMode(ENDswtch7,INPUT);
pinMode(STswtch1,INPUT); pinMode(STswtch2,INPUT); pinMode(STswtch3,INPUT); pinMode(STswtch4,INPUT); pinMode(STswtch5,INPUT); pinMode(STswtch6,INPUT); pinMode(STswtch7,INPUT);
pinMode(StepperSleep, OUTPUT);
stepper1.setMaxSpeed(StpprMAX); stepper1.setAcceleration(StpprACC);stepper2.setMaxSpeed(StpprMAX); stepper2.setAcceleration(StpprACC);stepper3.setMaxSpeed(StpprMAX); stepper3.setAcceleration(StpprACC);stepper4.setMaxSpeed(StpprMAX); stepper4.setAcceleration(StpprACC);stepper5.setMaxSpeed(StpprMAX); stepper5.setAcceleration(StpprACC);stepper6.setMaxSpeed(StpprMAX); stepper6.setAcceleration(StpprACC);stepper7.setMaxSpeed(StpprMAX); stepper7.setAcceleration(StpprACC);
}
void loop() {
// put your main code here, to run repeatedly:
//digitalWrite(StepperSleep, LOW);
if (digitalRead(STswtch1)==LOW || digitalRead(STswtch2)==LOW || digitalRead(STswtch3)==LOW || digitalRead(STswtch4)==LOW || digitalRead(STswtch5)==LOW ||digitalRead(STswtch6)==LOW || digitalRead(STswtch7)==LOW) // Checks if any of the Swans Aren't Home
{digitalWrite(StepperSleep, HIGH);} // if these still a swan out there keep the drivers energised
if (digitalRead(STswtch1)==LOW) // Sends Swan 1 Home
{ stepper1.move(70000);stepper1.run();}
if (digitalRead(STswtch2)==LOW) // Sends Swan 2 Home
{ stepper2.move(70000);stepper2.run();}
if (digitalRead(STswtch3)==LOW) // Sends Swan 3 Home
{ stepper3.move(70000);stepper3.run();}
if (digitalRead(STswtch4)==LOW) // Sends Swan 4 Home
{ stepper4.move(70000);stepper4.run();}
if (digitalRead(STswtch5)==LOW) // Sends Swan 5 Home
{ stepper5.move(70000);stepper5.run();}
if (digitalRead(STswtch6)==LOW) // Sends Swan 6 Home
{ stepper6.move(70000);stepper6.run();}
if (digitalRead(STswtch7)==LOW) // Sends Swan 7 Home
{ stepper7.move(70000);stepper7.run();}
if (digitalRead(STswtch1)==HIGH && digitalRead(STswtch2)==HIGH && digitalRead(STswtch3)==HIGH && digitalRead(STswtch4)==HIGH && digitalRead(STswtch5)==HIGH &&digitalRead(STswtch6)==HIGH && digitalRead(STswtch7)==HIGH) // Checks if all the Swans Are Home
{digitalWrite(StepperSleep, LOW);} // if all swans are home set drivers to sleep
}