Stepper motors running slow

Doing a project for my internship where I've got to control multiple steppers for some ceiling art project.

The more motors I run at the same time, the slower each motor runs.

When i run 1 motor, it moves up and down in 1s
when i move 1 row, it takes like 3s, and 2 rows take 5 sec.

Im using 42shdc3025-24b stepper motors with easydriver stepper drivers
rated at 3.96 V 0.9A
with a 12V 29A output power supply powering 31 stepper motors

Is the motor slowing down due to the lack of processing power in the arduino or lack of current/voltage

Video of the motors
1 motor

1 row

2 rows

Sounds to me like you don't have enough power (amps/current) to run multiple motors at the same time.

But hard to tell without knowing more about the system.

Could be an issue with the code but the code wasn’t posted so we’d never know.

Could be an issue with wiring but no schematic was posted so we’d never know.

OP, what do you want us to do? How can we tell you what’s wrong with it if you don’t let us see it? Think about that for a minute.

If you are using delay() for step timing, that explains the observation.

I'm betting on a code issue.

Steppers even if provided with less current will move at the same speed (until power is so limited they miss steps). Symptoms are not consistent with power shortage.

So…. Is Your code a military secret? If not, attach it.

Sorry, forgot to attach the code to the posts

#include <AccelStepper.h>

AccelStepper stepper17(AccelStepper::DRIVER, 23, 22);
AccelStepper stepper18(AccelStepper::DRIVER, 25, 24);
AccelStepper stepper19(AccelStepper::DRIVER, 27, 26);
AccelStepper stepper20(AccelStepper::DRIVER, 29, 28);
AccelStepper stepper21(AccelStepper::DRIVER, 31, 30);
AccelStepper stepper22(AccelStepper::DRIVER, 33, 32);
AccelStepper stepper23(AccelStepper::DRIVER, 35, 34);
AccelStepper stepper24(AccelStepper::DRIVER, 37, 36);
AccelStepper stepper25(AccelStepper::DRIVER, 39, 38);
AccelStepper stepper26(AccelStepper::DRIVER, 41, 40);
AccelStepper stepper27(AccelStepper::DRIVER, 43, 42);
AccelStepper stepper28(AccelStepper::DRIVER, 45, 44);
AccelStepper stepper29(AccelStepper::DRIVER, 47, 46);
AccelStepper stepper30(AccelStepper::DRIVER, 49, 48);
AccelStepper stepper31(AccelStepper::DRIVER, 51, 50);
//middle pin, odd number
//edge pin, even number

  int counter6 = 0;


void setup() {
  // put your setup code here, to run once:
 int accel =8000;
 int maxspeed=15000; 
 
  stepper17.setMaxSpeed(maxspeed);
  stepper18.setMaxSpeed(maxspeed);
  stepper19.setMaxSpeed(maxspeed);
  stepper20.setMaxSpeed(maxspeed);
  stepper21.setMaxSpeed(maxspeed);
  stepper22.setMaxSpeed(maxspeed);
  stepper23.setMaxSpeed(maxspeed);
  stepper24.setMaxSpeed(maxspeed);
  stepper25.setMaxSpeed(maxspeed);
  stepper26.setMaxSpeed(maxspeed);
  stepper27.setMaxSpeed(maxspeed);
  stepper28.setMaxSpeed(maxspeed);
  stepper29.setMaxSpeed(maxspeed);
  stepper30.setMaxSpeed(maxspeed);
  stepper31.setMaxSpeed(maxspeed);

  stepper17.setAcceleration(accel);
  stepper18.setAcceleration(accel);
  stepper19.setAcceleration(accel);
  stepper20.setAcceleration(accel);
  stepper21.setAcceleration(accel);
  stepper22.setAcceleration(accel);
  stepper23.setAcceleration(accel);
  stepper24.setAcceleration(accel);
  stepper25.setAcceleration(accel);
  stepper25.setAcceleration(accel);
  stepper26.setAcceleration(accel);
  stepper27.setAcceleration(accel);
  stepper28.setAcceleration(accel);
  stepper29.setAcceleration(accel);
  stepper30.setAcceleration(accel);
  stepper31.setAcceleration(accel);

  stepper17.setCurrentPosition(0);
  stepper18.setCurrentPosition(0);
  stepper19.setCurrentPosition(0);
  stepper20.setCurrentPosition(0);
  stepper21.setCurrentPosition(0);
  stepper22.setCurrentPosition(0);
  stepper23.setCurrentPosition(0);
  stepper24.setCurrentPosition(0);
  stepper25.setCurrentPosition(0);
  stepper26.setCurrentPosition(0);
  stepper27.setCurrentPosition(0);
  stepper28.setCurrentPosition(0);
  stepper29.setCurrentPosition(0);
  stepper30.setCurrentPosition(0);
  stepper31.setCurrentPosition(0);



}

void loop() {
  // put your main code here, to run repeatedly:


if(counter6 == 0)
{
  
      stepper17.moveTo(1000);
      stepper18.moveTo(500);

      stepper19.moveTo(1000);
      stepper20.moveTo(1000);
      stepper21.moveTo(1000);
      stepper22.moveTo(1000);
      
      stepper23.moveTo(500);
      stepper24.moveTo(1000);
      stepper25.moveTo(1000);
      stepper26.moveTo(1000);
      stepper27.moveTo(500);
      
      stepper28.moveTo(800);
      stepper29.moveTo(800);
      stepper30.moveTo(800);
      stepper31.moveTo(800);
      
   
      if((stepper17.distanceToGo() == 0))
      {counter6=1;}
}

if(counter6 == 1)
  {
    
      stepper17.moveTo(0);
      stepper18.moveTo(0);

      stepper19.moveTo(0);
      stepper20.moveTo(0);
      stepper21.moveTo(0);
      stepper22.moveTo(0);
      
      stepper23.moveTo(0);
      stepper24.moveTo(0);
      stepper25.moveTo(0);
      stepper26.moveTo(0);
      stepper27.moveTo(0);
      
      stepper28.moveTo(0);
      stepper29.moveTo(0);
      stepper30.moveTo(0);
      stepper31.moveTo(0);
      
     if((stepper17.distanceToGo() == 0))
      {counter6=0;}
  }


   stepper17.run();
   stepper18.run();
   stepper19.run();
   stepper20.run();
   stepper21.run();
   stepper22.run();
   stepper23.run();
   stepper24.run();
   stepper25.run();
   stepper26.run();
   stepper27.run();
   stepper28.run();
   stepper29.run();
   stepper30.run();
   stepper31.run();

}

the connections im using is the same as this, only with more motors and a mega2560 board

This may help
AccelStepper non-blocking

int maxspeed=15000;

You seem to have 15 motors each trying to do 15,000 steps per second - that's 225,000 steps per second.

According to the AccelStepper documentation "Speeds of more than 1000 steps per second are unreliable"

...R

Hi,
Welcome to the forum.
I have given you a karma, thank for reading the intro link and usinf code tags.

Have you got a DMM to measure the 12V stepper supply when you have this problem?

How have you got the power supply wiring to the stepper controllers configured, daisy chain or star?

Can you post a picture of your controllers, power supply and wiring please, so we can see your component layout?

Thanks.. Tom... :slight_smile:

So, he may be able to step them ‘in parallel’ using his own code.
I’ve had six steppers each running at >10KHz without much effort.

A canned library (I’ve never used AccelStepper) seems to have some internal limitations. Possibly each member is called ’sequentially’, which imposes obvious limitations.

What I did to get max step rate was ran all at fastest/tightest loop time possible (max step pulse frequency), then symmetrically skipped pulses to slow down each/all outputs as needed.

Robin2:

int maxspeed=15000;

You seem to have 15 motors each trying to do 15,000 steps per second - that's 225,000 steps per second.

According to the AccelStepper documentation "Speeds of more than 1000 steps per second are unreliable"

...R

It was set to 10,000 by the previous intern. And was told it runs fine, was increasing it to test if it was the bit that was limiting the code. :confused:

TomGeorge:
Hi,
Welcome to the forum.
I have given you a karma, thank for reading the intro link and usinf code tags.

Have you got a DMM to measure the 12V stepper supply when you have this problem?

How have you got the power supply wiring to the stepper controllers configured, daisy chain or star?

Can you post a picture of your controllers, power supply and wiring please, so we can see your component layout?

Thanks.. Tom... :slight_smile:

The project was built by the previous intern so I dont have much details on that.

The motors seems to be powered in parallel :confused:

There's 1 mega used as a master to take inputs, and 2 boards as slaves to control 15 & 16 motors each.

my job's to make it scalable to over 300 motors with 20+ boards :confused:

Many of the motors are doing the same thing. On my 3D printer, there are two steppers for the z-axis that are driven by the same driver board. It might be worth checking that capability of your boards to see if they can power multiple motors, thus reducing the number of step pulses your Arduino needs to emit.

I don't think it's a good idea to connect multiple steppers to one stepper controller, but you can definitely connect the Arduino signals to multiple stepper controllers. Same end result.

Well, as I said, my Ramps based 3D printer does exactly that for two steppers, so it's happening on an awful lot of installations. I'm not qualified to judge whether it's actually a good idea though.

Along the lines of WildBill's idea, I'm using 2 shift registers to run 3 (could do 4) stepper motors with just 3 pins from the Arduino. In theory, one could daisy chain as many as needed to control however many motors you wanted. In theory.

If you want scalability, that may be one way to do it.

The shift registers are a valid idea, but in this case it’s adding another later of bit manipulation...
OP is already unhappy with step rate speed - so it may be losing more time.

lastchancename:
The shift registers are a valid idea, but in this case it’s adding another later of bit manipulation...
OP is already unhappy with step rate speed - so it may be losing more time.

You pros would know more about that than me. He mentioned scalability and shift registers seem about as scaleable as it gets. Speed never occured to me. However, I just started tinkering with them and am only using 2.