Stepper Motor move too fast

Hi,
i have three stepper motors running at the same time, or lit looks like they running at the same time. Each one is connected to a driver, and all of the drivers are connected to a Arduino Mega 2560R3.

The Motor are:
1.) Nema34 with 12Nm
2.) Nema34 with 4.5Nm
3.) Nema23 with 2Nm

The big stepper motor and the small stepper motor are running in an intervall (but different ones) and the stepper motor with 4.5Nm of torque ist running continuous in one direction.

The Code below works very good for 800 Microsteps, but then the needed torque for the big stepper motor is too low. So i have to run these stepper motors without microstepping in 200 steps.
But in 200 steps, they are running too fast, but i cant lower the speed from 50. The lowest possible is 41, but then the stepper motors are running not very smooth and they start to make noises.

So could anyone help me to run these motors slower?

// STANDARD-PROGRAMM:
// Rahmen und Düse oszillieren mit Geschwindigkeit $ in einem Intervall $, Tisch verfährt mit Geschwindigkeit $
// Dauer des Programms kann entweder in Zeit oder Schleifenwiederholungen bestimmt werden
// Die Motoren verfahren nacheinander in so kurzen Abänden, dass es synchron wirkt


#include <Stepper.h>
#include <AccelStepper.h>

const int step_360 = 300;  // Anzahl der Schritte

unsigned long DuesenStartMillis;
unsigned long DuesenCurrentMillis;
const unsigned long DuesenPeriod = 1000;  //Schleifendauer DĂĽse

unsigned long RahmenStartMillis;
unsigned long RahmenCurrentMillis;
const unsigned long RahmenPeriod = 3000;  //Schleifendauer Rahmen

// initialize the stepper library on pins
Stepper StepperR(step_360, 4, 5, 6, 7);    //(leerer Pin, steps, Pul/Step, Dir, En)
Stepper StepperT(step_360, 11, 8, 9, 10);  //(leerer Pin, steps, Pul/Step, Dir, En)
Stepper StepperD(step_360, 11, 2, 3, 4);   //(leerer Pin, steps, Pul/Step, Dir, En)


void setup() {
  //Start Zeit Millis
  DuesenStartMillis = millis() - 1000;  //-1000 ist notendig, da der Motor ansonsten beim ersten Mal zu weit verfährt, bis die Differenz von CurrentMillis und StartMillis bei dem gewünschten Intervall ankommt
  RahmenStartMillis = millis() - 1000;  //-1000 ist notendig, da der Motor ansonsten beim ersten Mal zu weit verfährt, bis die Differenz von CurrentMillis und StartMillis bei dem gewünschten Intervall ankommt


  StepperR.setSpeed(50);  // Geschwindigkeit in Umdrehungen/Minute --> Min:41 --> Gibt in Verbindung mit der Schleifendauer die Fahrtstrecke an
  StepperT.setSpeed(50);  // Geschwindigkeit in Umdrehungen/Minute --> Min:41 --> Gibt in Verbindung mit der Schleifendauer die Fahrtstrecke an
  StepperD.setSpeed(50);  // Geschwindigkeit in Umdrehungen/Minute --> Min:41 --> Gibt in Verbindung mit der Schleifendauer die Fahrtstrecke an
}

//Steps der Motoren
int R = -1;  //-1 = Start nach oben
int T = 1;
int D = 1;
int i = 1;  //Schleifenzähler

void loop() {
  //while (millis() < 19000){           //Dauer des Programms --> Schleifendauer angegeben in Zeit
  while (i < 13) {  //Dauer des Programms --> Schleifendauer angegeben in Wiederholungen --> BEDINGUNGEN: Muss immer ein gemeinsames Vielfahes von DĂĽsen- und Rahmenintervall +1 sein, und immer ungerade, sonst Ist Endpunkt nicht der Startpunkt
    DuesenCurrentMillis = millis();
    RahmenCurrentMillis = millis();

    for (int s = 0; s < step_360; s++) {
      StepperR.step(R);
      StepperT.step(T);
      StepperD.step(D);
    }

    if (DuesenCurrentMillis - DuesenStartMillis >= DuesenPeriod) {  //Intervall DĂĽse
      DuesenStartMillis = DuesenCurrentMillis;
      D = -D;
    }

    if (RahmenCurrentMillis - RahmenStartMillis >= RahmenPeriod) {  //Intervall DĂĽse
      RahmenStartMillis = RahmenCurrentMillis;
      R = -R;
    }

    i = i + 1;
  }
}

Stepper StepperR(200, 4, 5, 6, 7);

StepperR.setSpeed(10);

What drivers are you using?

Please post data sheets for the stepper motors.

The Stepper library is not the best library for real use of steppers. AccelStepper is better, but I prefer the MobaTools library. MobaTools is, in my opinion, easier to learn and use than AccelStepper and you can conttol the 3 motors independently with non-blocking code (no long for or while loops).

This doesn´t work. The steppers don´t move with these settings.

does it move if you change StepperR.setSpeed(500); ?
does it move if you change only steps?

Hi,
Can you please post a copy of your circuit a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.

Thanks... Tom.. :grinning: :+1: :coffee: :australia:

For the small stepper i use this one:
STEPPERONLINE CL57T

An for the other two stepper motors, i use this for each one of them:
STEPPERONLINE CL86T

It moves with steps set to 200 and setSpeed set to 500, but not with setSpeed set to 50.

Have you considered an inline gear reducer? What maximum RPM do you need?



The power supply gets powered with 220V and gives 5V to the driver. The stepper motor is connected to the driver as described in the picture on the stepper motor. From the driver, i connected the 3 - with each other and put them to a ground pin on the arduino. And i put the pulse-cable, the diretion-cable and the enable-cable to the arduino.
The two circuits with the big stepper motors have a 480W power supply, the other circuit has a 360W power supply.

I built this circuit for every stepper motor.

Max. rpm about 5. It would be better, if it runs slower.

5 RPM max? 16 2/3 steps per second?

If you set the microsteps to 51200 and the steps per second to 3400 the motor should run close to 4 RPM. Try that. Which Arduino are you using?

this libs are not suitable for your project at all, funny why it rotate something at all

I think MobaTools might be able to do it but don't know if the 16 MHz Mega would have time to do much else.

I am trying it rhight now with the MobaTools library. It works kind of better

const uint8_t DriverPin[2] = {
  2, 3 //Pul/Step, Dir
};
const int steps = 200;
const int Delais = 60 / 2;

void setup() {
  for (uint8_t i = 0; i < sizeof(DriverPin); i++)pinMode(DriverPin[i], OUTPUT);
}

void loop() {
  for (int s = 0; s < steps; s++) {
    digitalWrite(DriverPin[0], HIGH);
    delay(Delais);
    digitalWrite(DriverPin[0], LOW);
    delay(Delais);
  }
  digitalWrite(DriverPin[1], !digitalRead(DriverPin[1]));
}

What does the new code do?

Please post your new code and we can probably help make it better.

What microstep setting are you using?

Have you set the coil current limits on each driver?

Thank you everyone for bringing up your ideas of using the MoTo-Library. I didn´t knew about this one before. Now, everything works perfectly fine.
:slight_smile:

If your question has been answered to your satisfaction, please mark the thread as solved so that other members that wish to help will not waste their time opening and reading the thread only to find that you no longer require assistance.