Page 1 of 1

Stopping a stepper in run mode.

Posted: Mon Oct 19, 2020 12:52 pm
by LavertuJS
I'm using a NEMA 23 stepper with the STC1003 controller.

I want the stepper to stop when it hits a limit switch at the end of the course.

Obviously, I could just deenable the controller to cut power to the stepper, but that seems likely to cause damage.

Otherwise, I could set the velocity limit to 0, but I'm not sure if it's fast enough to stop on time.

Is there any preffered method of stopping the stepper?

Re: Stopping a stepper in run mode.

Posted: Mon Oct 19, 2020 1:56 pm
by mparadis
The best you can do is set the target position equal to the current position. If the system has too much inertia to stop, you may want to move the limit switches in advance of the physical limit just to be sure.

Re: Stopping a stepper in run mode.

Posted: Mon Oct 19, 2020 2:28 pm
by LavertuJS
Awesome, thanks!

Re: Stopping a stepper in run mode.

Posted: Mon Oct 19, 2020 2:46 pm
by LavertuJS
I have a follow up question about integrating an encoder:


How can I use an encoder to control the stepper position instead of the controller's internal logic?

I'm using a ENC1000 to read a linear quadrature encoder. I have several positions along the travel where I activate functions unrelated to the stepper control so I'd like to have everything in the same reference frame (the encoder's) to simplify things.

My guess would be to add a check in the encoder's onPositionChange handler that verifies where the motor is relative to the target position and sets it's velocity accordingly, but adding more stuff might slow down the callback.

I could also use step mode, fiddle around to get the rescale factor correct and use the limit switch to zero the position on both so they match if the first option doesn't work.