Go Down

Topic: Questions about "Holding" a motor in one position (Read 667 times) previous topic - next topic

tomb18

Hi,
I have the Sparkfun Big stepper motor controller and I am using their Nema 17 motor.  I can get it to work well with microstepping etc using their code.  However, as soon as I stop moving the motor, then I can turn the shaft easily.  Now this is a problem because what I am turning is weighted off center.  During movement it holds fine, but the minute it stops it slips.
So how does one "Hold" the motor in place?  What do you do when the power is off?
I am thinking that having a non-geared motor is not the best here.  My other question is if I have a geared motor, what gear ratio would give the motor sufficient holding power when the motor is off?  We are talking about a 3 pound weight around 6" off center.
Thanks for any insights here.

runaway_pancake

"Who is like unto the beast? who is able to make war with him?"
When all else fails, check your wiring!

tomb18

I guess that's an option but then the mechanical aspects of this become considerably more complex.

zoomkat

Quote
So how does one "Hold" the motor in place?  What do you do when the power is off?
You might apply a "holding current" to the appropriate coils in the motor.
Google forum search: Use Google Search box in upper right side of this page.
Why I like my 2005 Rio Yellow Honda S2000  https://www.youtube.com/watch?v=pWjMvrkUqX0

Robin2

However, as soon as I stop moving the motor, then I can turn the shaft easily.
That sounds like you are not controlling the motor properly. Post your code and a diagram showing how everything is connected.

Stepper motors should hold position between steps.

Of course they won't hold position if you turn the power off. If you need to hold position when the power is off you need some form of external brake.

...R
Stepper Motor Basics
Simple Stepper Code
Two or three hours spent thinking and reading documentation solves most programming problems.

tomb18

Well, I don't know what I did but I tried different code and now it holds just fine.  Thanks for the help everyone.

beninsler

#6
Jul 20, 2018, 07:58 pm Last Edit: Jul 20, 2018, 08:04 pm by beninsler
I was having the same problem using a Big Easy Driver and the Sparkfun_Big_Easy_Driver_Basic_Demo.ino sketch.  I may have solved it, or at least come one step closer, so just wanted to drop a note here for anyone in the future coming across this.  Code excerpt is below for reference.

In the sketch's main loop, there is a call to the resetBEDPins() function at the end of each main loop cycle.  By commenting out the call to this function in the main loop, the motor now remains engaged and can hold a lifted load once the motor stops.

I imagine that the culprit is the line digitalWrite(EN, HIGH) in the resetBEDPins() function, which would be disconnecting all outputs powering the motor as per the BED user manual and thus preventing the coils from being energized for holding torque.

That said, by commenting resetBEDPins() out of the main loop, none of the other pins are being reset, and I can't yet speak to whether or not this would create new problems.  The true solution may just be to keep the call to resetBEDPins() in the main loop, and simply comment the line digitalWrite(EN, HIGH)  out of the resetBEDPins() function.  Nonetheless, the motor currently appears to work as expected with the resetBEDPins() call completely removed from the mainloop.


// -- CODE EXCERPT FROM Sparkfun_Big_Easy_Driver_Basic_Demo.ino
// -- resetBEDPins() FUNCTION COMMENTED OUT OF MAIN LOOP

//Main loop
void loop() {
  while(Serial.available()){
      user_input = Serial.read(); //Read user input and trigger appropriate function
      digitalWrite(EN, LOW); //Pull enable pin low to set FETs active and allow motor control
      if (user_input =='1')
      {
         StepForwardDefault();
      }
      else if(user_input =='2')
      {
        ReverseStepDefault();
      }
      else if(user_input =='3')
      {
        SmallStepMode();
      }
      else if(user_input =='4')
      {
        ForwardBackwardStep();
      }
      else
      {
        Serial.println("Invalid option entered.");
      }
      //resetBEDPins();
  }
}

//Reset Big Easy Driver pins to default states
void resetBEDPins()
{
  digitalWrite(stp, LOW);
  digitalWrite(dir, LOW);
  digitalWrite(MS1, LOW);
  digitalWrite(MS2, LOW);
  digitalWrite(MS3, LOW);
  digitalWrite(EN, HIGH);
}

MarkT

Well, I don't know what I did but I tried different code and now it holds just fine.  Thanks for the help everyone.
You must have had code that powered down the motor.  Of course it will stop holding if its powered down.

Any application requiring a stepper motor requires the motor to hold position, so you'd never power the
motor down in normal use.

What you can do with some drivers is reduce the current when the motor is stationary (as holding
torque is bigger than dynamic torque anyway) - this allows power savings for a motor thats often stationary,
so it can run cooler.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Go Up