Endstops are small switches at the end of axes.

They can be used to "home", that is find the end of an axis so that the controller is then aware of it's current position.

They can also be used as limit switches, to make sure the machine will never move out of an axis' boundaries.

The SDCARD must be unmounted from the host before doing any homes

Always unmount from the computer before doing home.

Configuration

The config settings for Endstops are as follows :

Option Example value Explanation
endstops_enable true The endstop module is enabled if this is set to true. All of it's parameters are ignored otherwise.
corexy_homing false Set to true if this machine uses a corexy or a h-bot arm solution
delta_homing false Set to true if this machine uses a linear_delta arm solution
rdelta_homing false Set to true if this machine uses a rotary_delta arm solution
scara_homing false Set to true if this machine uses a scara arm solution
alpha_min_endstop 1.24^ Alpha ( X axis or alpha tower ) minimum limit endstop. Set to nc if not installed on your machine.
alpha_max_endstop 1.25^ Alpha ( X axis or alpha tower ) maximum limit endstop. Set to nc if not installed on your machine.
alpha_homing_direction home_to_min In which direction to home. If set to home_to_min, homing ( using the G28 G-code ) will move until it hits the minimum endstop and then set the current position to alpha_min. If set to home_to_max, homing will move until it hits the maximum endstop, and then set the current position to alpha_max
alpha_min 0 This gets loaded after homing when alpha_homing_direction is set to home_to_min and the minimum endstop is hit.
alpha_max 200 This gets loaded after homing when alpha_homing_direction is set to home_to_max and the maximum endstop is hit.
beta_min_endstop 1.26^ Beta ( Y axis or beta tower ) minimum limit endstop. Set to nc if not installed on your machine.
beta_max_endstop 1.27^ Beta ( Y axis or beta tower ) maximum limit endstop. Set to nc if not installed on your machine.
beta_homing_direction home_to_min In which direction to home. If set to home_to_min, homing ( using the G28 G-code ) will move until it hits the minimum endstop and then set the current position to beta_min. If set to home_to_max, homing will move until it hits the maximum endstop, and then set the current position to beta_max
beta_min 0 This gets loaded after homing when beta_homing_direction is set to home_to_min and the minimum endstop is hit.
beta_max 200 This gets loaded after homing when beta_homing_direction is set to home_to_max and the maximum endstop is hit.
gamma_min_endstop 1.28^ Gamma ( Z axis or gamma tower ) minimum limit endstop. Set to nc if not installed on your machine.
gamma_max_endstop 1.29^ Gamma ( Z axis or gamma tower ) maximum limit endstop. Set to nc if not installed on your machine.
gamma_homing_direction home_to_min In which direction to home. If set to home_to_min, homing ( using the G28 G-code ) will move until it hits the minimum endstop and then set the current position to gamma_min. If set to home_to_max, homing will move until it hits the maximum endstop, and then set the current position to gamma_max
gamma_min 0 This gets loaded after homing when gamma_homing_direction is set to home_to_min and the minimum endstop is hit.
gamma_max 200 This gets loaded after homing when gamma_homing_direction is set to home_to_max and the maximum endstop is hit.
homing_order XYZ Optional order in which axis will home, default is they all home at the same time, if this is set it will force each axis to home one at a time in the specified order. For example XZY means : X axis followed by Z, then Y last. NOTE This MUST be 3 characters containing only X,Y,Z or it will be ignored
alpha_limit_enable false If set to true, the machine will stop if one of the alpha ( X axis or alpha tower ) endstops are hit
beta_limit_enable false If set to true, the machine will stop if one of the beta ( Y axis or beta tower ) endstops are hit
gamma_limit_enable false If set to true, the machine will stop if one of the gamma ( Z axis or gamma tower ) endstops are hit
alpha_fast_homing_rate_mm_s 50 Speed, in millimetres/second, at which to home for the alpha actuator ( X axis or alpha tower )
beta_fast_homing_rate_mm_s 50 Speed, in millimetres/second, at which to home for the beta actuator ( Y axis or beta tower )
gamma_fast_homing_rate_mm_s 4 Speed, in millimetres/second, at which to home for the gamma actuator ( Z axis or gamma tower )
alpha_homing_retract_mm 5 Distance to retract the alpha actuator ( X axis or alpha tower ) once the endstop is first hit, before re-homing at a slower speed.
beta_homing_retract_mm 5 Distance to retract the beta actuator ( Y axis or beta tower ) once the endstop is first hit, before re-homing at a slower speed.
gamma_homing_retract_mm 1 Distance to retract the alpha actuator ( Z axis or gamma tower ) once the endstop is first hit, before re-homing at a slower speed.
alpha_slow_homing_rate_mm_s 25 Speed, in millimetres/second, at which to re-home for the alpha actuator ( X axis or alpha tower ) once the endstop is hit once.
beta_slow_homing_rate_mm_s 25 Speed, in millimetres/second, at which to re-home for the beta actuator ( Y axis or beta tower ) once the endstop is hit once.
gamma_slow_homing_rate_mm_s 2 Speed, in millimetres/second, at which to re-home for the gamma actuator ( Z axis or gamma tower ) once the endstop is hit once.
endstop_debounce_count 100 Debounce each endstop pin over this number of values. Set to 100 if your endstops are too noisy and give false readings.
alpha_trim -0.1 DELTA ONLY Software trim for alpha ( X axis or alpha tower ) stepper endstop (in millimetres ). When the endstop is hit, the axis will move this distance towards the endstop (negative values move endstop away from the endstop )
beta_trim -0.1 DELTA ONLY Software trim for beta ( Y axis or beta tower ) stepper endstop (in millimetres ). When the endstop is hit, the axis will move this distance towards the endstop (negative values move endstop away from the endstop )
gamma_trim -0.1 DELTA ONLY Software trim for gamma ( Z axis or gamma tower ) stepper endstop (in millimetres ). When the endstop is hit, the axis will move this distance towards the endstop (negative values move endstop away from the endstop )
move_to_origin_after_home false If set to true, once homing is complete, the machine will move to it's origin point

Reading

You can use the M119 command to show the status of the configured endstops.

M119 answers this way : 

min_x:0 min_y:0 min_z:0 max_x:0 max_y:0 max_z:0
ok

If an endstop is not connected the pin should be set to «nc», and it's value will not be reported.

This is in particular useful when setting up your machine : you can issue the M119 command with your endstops unpressed, check that the values are 0 ( which would be correct ), and issue the command again with your endstops pressed, check that the values are all 1 ( which is correct for pressed endstops ).

If an endstop always reports 0, it probably means that it is not wired correctly.

If an endstop's values are inverted, it probably means you wired the pin as NO when it is NC, or the opposite.

You can reverse a pin in the configuration file by adding or removing a «!» character after the pin number ( see Pin Configuration ).

For example if the beta min endstop is inverted in your diagnostics, change :

beta_min_endstop   1.26^

to :

beta_min_endstop   1.26^!

Inverted

If, when homing, your endstop moves a few millimeters, and stops, it most probably means it's inverted ( it thinks it's already hitting the endstop, and moves back from it ). Just invert it in config and see if that helps.

Homing

You use the G28 command to home your machine.

For example : 

G28 Z0

will home the Z axis.

And :

G28

will home all axes which have endstops enabled (all three by default).

Notes

Currently only min or max endstops can be used for homing.

Do not set endstops for axes that shall not be homed.

Note for Deltas using M666 to set soft trim

When you home a delta that has non zero trim values, you will find that X and Y are not 0 after homing. This is normal.
If you want X0 Y0 after homing yo can set `move_to_origin_after_home true` in the config, this will move the effector to 0,0 after it homes and sets the trim. However note this may crash into your endstops, so make sure you enable limit switches, as this will force the carriages off the endstops after homing but before moving to 0,0.

Limit switches

Endstops may be configured to act as limit switches, during normal operations if any enabled limit switch is triggered the system will halt and all operations will stop, it will send a !! command to the host to stop it sending any more data (a recent dev octoprint and recent Pronterface support this).
A reset will be required to continue, or sending M999, make sure you move away from the endstop though before trying to move.

To enable enstops as limit switches the following config options can be used, they are disabled by default.

alpha_limit_enable                          true            # set to true to enable X min and max limit switches
beta_limit_enable                           true            # set to true to enable Y min and max limit switches
gamma_limit_enable                          true            # set to true to enable Z min and max limit switches

When one axis is enabled both min and max endstops will be enabled as limit switches, setting an endstop pin to nc will disable it.

Retract

After homing the axis is usually left triggering the endstop, this would prevent that axis from moving, so when limit switches are enabled after homing the axis will back off the endstop by the *.homing_retract_mm amount.

The downside is if you home to 0 and at 0 the endstop is triggered going to 0,0 will cause a limit switch to fire. The workaround is to set homing offset to -5 or enough to back off the endstop so when you go to 0,0 it does not trigger the endstop.

That way you can home, and safely go to 0 without triggering a limit switch event. An alternativve is to set min/max X/Y to -5 rather than 0.

Azteeg X5

On an Azteeg X5 mini with only 3 endstop connectors you can still connect two microswitches in series set to normally closed to ground and connected to the relevant input, this will allow for min and max limit switches to still work.

Usage example with home offsets

Here is a common sequence that you may do to set bed height, this need not be repeated unless the bed changes.

; Home
G28
; move to 5mm above bed
G0 Z5
;  then manually jog down until nozzle is on bed or just traps a sheet of thin paper
; sets the Z homing offset based on current position
M306 Z0
G28
G0 Z0
; check nozzle still captures thin sheet of paper
M500
; saves the results in EEPROM equivalent

BLTouch

Smoothieboard_BLTouch123.jpg