Home > Resources > Example Programs > Homing to a hard stop

Homing to a hard stop


System designers often want to home an axis to a hard stop to avoid the additional complexity and expense of a home sensor. The usual problem with this approach is that the stepper motor produces torque based on its position within its electrical and mechanical cycles. When it stalls, those cycles cause the motor to move back and forth against the stop. When motion is stopped, the motor may come to rest some distance from the stop. This distance is can be random. If this position were used as a home position, poor accuracy would result.

The following sample code uses an iterative approach to try to capture the position closest to home that the motor reaches as it repeatedly hits the hard stop. Since the capture loop in the program runs quickly and asynchronously to the motor’s motion, the lowest value can be captured. This can be tested by stopping the motor, setting the hold current, HC, to zero, and moving the axis manually to the stop and checking the position register (PR P). This is the value we are trying to find. Once we find that value, we move a fixed distance from that value using an absolute move to that value +/- a set amount. We do this because we cannot move to the exact position of the hard stop. Once at this position, we either set the position to zero (P=0), or to some offset value X (P=X).


Example program

MDrive MCodeLiberty* MCode - hMT On

When it comes to your form, fit and function requirements, don’t settle. Get precisely what you need working with us. We know motion.

Contact us with any questions about how we can help you with your motion application or for assistance with your IMS products.

Browse our resource section and find the most useful tools and documents for all our products.