Stopping a stepper in run mode.

C, C++, and Visual C++
Post Reply
LavertuJS
Fresh meat
Posts: 3
Joined: Mon Oct 19, 2020 12:35 pm
Contact:

Stopping a stepper in run mode.

Post 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?
User avatar
mparadis
Site Admin
Posts: 660
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: Stopping a stepper in run mode.

Post 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.
LavertuJS
Fresh meat
Posts: 3
Joined: Mon Oct 19, 2020 12:35 pm
Contact:

Re: Stopping a stepper in run mode.

Post by LavertuJS »

Awesome, thanks!
LavertuJS
Fresh meat
Posts: 3
Joined: Mon Oct 19, 2020 12:35 pm
Contact:

Re: Stopping a stepper in run mode.

Post 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.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests