Stepper Motor jams up when slight resistance is applied

Hello there, I am relatively new to stepper motors in general so I'm not sure what the issue is. I am using a NEMA 42 30nm stepper motor and its respective DM2282T driver to rotate an assembly for a sort of simulator I'm building. The motor is connected to a 1:60 ratio wormgear gearbox, I believe it's called a 090 size wormgear gearbox.

The issue I'm having is that when I apply a slight resistance to the gearbox output, the motor jams up until the driver stops the motor and restarts it. I'm using the AccelStepper library and doing a simple left & right rotation.

Wiring is simple, just 4 wires of the stepper going into stepper driver according to the stepper documentation, 1 ground wire to the arduino and two signal wires for pulse and direction to the driver.


Current limiting setting on the driver is set to max (8.2 amps)

Motor substepping is 400 pulses per rev

In the arduino, max motor speed is set to 4000 pulses per second

I have uploaded videos of the issue here:

This is the page for the motor and driver. These very ones have been purchased and used:

Please help!

I have attached the Arduino code below:

#include <AccelStepper.h>


//Defining pins
int Stepper1Pulse = 5;        // Pulse or step pin
int Stepper1Direction = 6;    // Direction pin
int InterruptPin = 10;         // Interupt button pin
int StepperEnPin = 2;



//defining terms
int speedmin = 0;       //pulses per second
int Speed = 4000;      //pulses per second      //calibrated for NEMA 42 30nm. RPM does not go higher by hardware design. Higher pulses per second also causes desync because of the slip ring assembly inefficiencies.
int speedmax = 4000;   //pulses per second      //calibrated for NEMA 42 30nm. RPM does not go higher by hardware design. Higher pulses per second also causes desync because of the slip ring assembly inefficiencies.
int StepperAcceleration = 5000;
long StepperDirection = 12000;  // this should be half of speed for 1 complete revolution on the 1:60 gearbox.
bool STOP = false;

AccelStepper step1(1, Stepper1Pulse, Stepper1Direction);



long DelayIteration = 0;
int Iterator = 1;


void setup() {               
   
  Serial.begin(2000000);

  pinMode(InterruptPin, INPUT_PULLUP);
  pinMode(Stepper1Pulse, OUTPUT);
  pinMode(Stepper1Direction, OUTPUT);

  pinMode(StepperEnPin, OUTPUT);
  digitalWrite(StepperEnPin, LOW);
  
  digitalWrite(Stepper1Pulse, LOW);
  digitalWrite(Stepper1Direction, LOW);



  step1.setMaxSpeed (speedmax);  
  step1.setSpeed(Speed);    
  step1.setAcceleration(StepperAcceleration); //speed up or slow down at this number of steps per second
  step1.moveTo(StepperDirection);        // some large number to keep it spinning




}

void loop() {


////////////////////////    INTERRUPT BUTTON START    //////////////////////
   
  if(digitalRead(InterruptPin) == LOW)
  {
//    step1.stop();             //requests stop. run() still needs to continue in order to decelerate

       if(STOP == false)
       {
            STOP = true;              //bool to be checked before moveTo() function asn moveTo() will override stop()
            digitalWrite(StepperEnPin, HIGH);   // Uses Stepper Enable Pin to disable Stepper Driver
            return;
       }
        
       if(STOP == true)
       {
            STOP = false;              //bool to be checked before moveTo() function asn moveTo() will override stop()
            digitalWrite(StepperEnPin, LOW);   // Uses Stepper Enable Pin to disable Stepper Driver
            return;
       }


   
  }



////////////////////////    INTERRUPT BUTTON END    //////////////////////



////////////////////////    AUTOMATED LOOP START    //////////////////////


//    Serial Print slows down the loop speed significantly. Use millis method to isolate looping code that may cause delays

/*
    if (millis() - lastPrintTime >= 100) 
    {  // Print every 100ms
        lastPrintTime = millis();
        Serial.println("Loop running...");
    }
*/


   if(step1.distanceToGo() == 0) 
   {
       if(STOP == false)
       {
          step1.moveTo(-step1.currentPosition());  // toggle direction
       }
   }
    
    
    step1.run();            //don't use runSpeed as it does not take acceleration into account.



////////////////////////    AUTOMATED LOOP END    //////////////////////
}

<CODE/>

Could be the power supply, the wiring, the current limit setting, the code, stepping too fast, etc.

Forum members would rather that all the relevant information is in your post, rather than having to watch a video.

Wiring is simple, just 4 wires of the stepper going into stepper driver according to the stepper documentation, 1 ground wire to the arduino and two signal wires for pulse and direction to the driver.

Current limiting setting on the driver is set to max (8.2 amps)

Motor substepping is 400 pulses per rev

In the arduino, max motor speed is set to 4000 pulses per second

I've appended the original question to include this info

Hmm, something is very wrong, but there still isn't enough information to guess what it might be.

Does the gearbox jam if the stepper takes 1 full step per second?

Does the motor produce the expected full-step torque when not connected to the gearbox?

No the gearbox works fine when rotating manually and when the stepper and gearbox are left to run without resistance

How can I check if the motor produces the required step torque?

Hang a weight from the edge of a disk or end of a rod connected to the shaft, and increase the weight until a single full step fails. Pololu - Force and torque

Got it, I'll perform the test tomorrow

Is your stepper motor driving the worm or driving the gear? If driving the worm, the only way to jam is if the thrust bearings of the worm are not properly adjusted.

Driving the worm. Do you know how I can check the thrust bearing? The seller I got the gearboxes from hardly knows anything about them, and it's my first time dealing with it too.

@jremington Do you have a rough idea of how long the rod should be?

I second the suggestion to very carefully check out the coupling between the motor and the gearbox input. Please post a closeup photo of the coupling and motor mounting arrangement (hint: the first photo in the first post is uninformative).

Edit: torque is determined by the product of the bar length and the weight. See the Pololu blog linked above.





This is the gearbox



The motor is mounted directly to the gearbox, I had a "key" machined to couple the stepper and the gearbox input shaft and the tolerance is very tight, there is no room for movement.

Side note, that hex nut on the gearbox, could it correspond to something?

Could be a fault with the gearbox too, I'll replace that one with one of the fresh pieces I got later to see if it makes a difference

Certainly, there should be ZERO movement of the worm, except turning!

No room for movement. But how do you know the alignment is perfect? Bet it is not perfect unless you have the equipment to measure that. You would have to have motor mounting adjustments to ensure the shaft alignments and I do not see that, no any way to access the shafts to ensure shafts are really aligned.

Good question. I had the key machined by a professional and gave him the motor and gearbox for testing. I'm going by his assurances at this point. Is there a way to test if the shafts are misaligned? The motor and gearbox turn with no binding or any kind of adverse noise when there is no load

Then that points to movement of something in the gear box that should not move. Can you feel and slack in the shafts, back and forth, in alignment with the gear and the worm shafts? There can be none, only rotation movement. Are the key slots cut parallel with the shaft? Use two straightedges, one on the key and one on the shaft. Does the space between the two straightedges look the same for their entire length?

I'll have a look tomorrow though now that you mention it, this gearbox spontaneously started leaking few days after I bought it. I hadn't even gotten the motors till then, I took it back to my guy and he said the Sean's broken, so he changed the seal. Before that, the input shaft was rotated quite freely, after he put in a new seal, it no longer rotated by hand and was quite restrictive. It still rotated without binding or grinding or anything if i used a tool to rotate it. I'm getting a strong vibe that it's the gearbox at fault here. I'll update tomorrow as soon as I get back and replace the gearbox with a "new" one. Nothing in pakistan is ever new, just refurbished from other countries :face_without_mouth:

Ah, but they are so clever in making stuff work, anyway!