RE: Controlling 12 steppers NEMA34 (Driver DM860)simultaneously

Hi I am newbie on stepper motors so I need a little of help…
I am trying to control 12 stepper motors (NEMA 34, DM860D as a driver) simultaneously. I used an Arduino Mega 2560 to control them all, but I am thinking that it's too much to handle.
at the first time I try to wrote my programm to controle only 2 motors (50 steps per revolution). but I found a difficulty to controle 12 motors; the Multistepper library has a 10 motor limit.
I want to control them all simultaneously.
some one help me?
which driver is better with NEMA34 (1.8°, 8.5 nm)

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

const int MotorCount = 12;

// Define 12 motor objects
AccelStepper Motors[MotorCount] =
{
  AccelStepper(AccelStepper::DRIVER, 2, 3),
  AccelStepper(AccelStepper::DRIVER, 4, 5),
  AccelStepper(AccelStepper::DRIVER, 6, 7),
  AccelStepper(AccelStepper::DRIVER, 8, 9),
  AccelStepper(AccelStepper::DRIVER, 10, 11),
  AccelStepper(AccelStepper::DRIVER, 12, 13),
  AccelStepper(AccelStepper::DRIVER, 14, 15),
  AccelStepper(AccelStepper::DRIVER, 16, 17),
  AccelStepper(AccelStepper::DRIVER, 18, 19),
  AccelStepper(AccelStepper::DRIVER, 20, 21),
  AccelStepper(AccelStepper::DRIVER, 22, 23),
  AccelStepper(AccelStepper::DRIVER, 24, 25)
};


MultiStepper both;

void setup()
{
  for (int i = 0; i < MotorCount; i++)
  {
    Motors[i].setMaxSpeed(150);    //Set the max motor speed
    Motors[i].setAcceleration(100);    //Set the acceleration

    both.addStepper(Motors[i]);
    
  long firstMove[] = { -50, -50};
  both.moveTo(firstMove);
  both.runSpeedToPosition();
  
  long secondMove[] = {0, 0};
  both.moveTo(secondMove);
  both.runSpeedToPosition();
  
  }
}

void loop()
{
  for (int i = 0; i < MotorCount; i++)
  {
    Motors[i].moveTo(50);  // Tell it to go to 50
    Motors[i].run();
    Motors[i].stop(); // Set Target to the closest spot you can safely stop
    Motors[i].runToPosition(); // Go to new target
  }

  // NOW GO BACKWARDS
  for (int i = MotorCount - 1; i >= 0; i++)
  {
    Motors[i].moveTo(-50);
    Motors[i].run();
    Motors[i].stop(); // Set Target to the closest spot you can safely stop
    Motors[i].runToPosition(); // Go to new target
  }
}

Poke around in the library and see if you can change the limit of ten to twelve - it's probably just an arbitrary limit to give an array a size.

What sort of performance are you wanting from the motors? Step speeds and number of motor running simultaneously? Are you wanting precisely coordinate movements.

Or more simply what are you wanting to do with the motors?

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