Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
endstops [2017/01/25 23:14]
arthur [General video about mechanical endstops]
endstops [2019/05/13 23:02] (current)
wolfmanjm [Soft endstops]
Line 12: Line 12:
 You can use the <​kbd>​M119</​kbd>​ command to show the status of the configured endstops. You can use the <​kbd>​M119</​kbd>​ command to show the status of the configured endstops.
  
-<​kbd>​M119</​kbd>​ answers this way : +<​kbd>​M119</​kbd>​ answers this way :
  
 <​code>​ <​code>​
Line 19: Line 19:
 </​code>​ </​code>​
  
-If an endstop is not connected the pin should be set to Â«<​kbd>​nc</​kbd>​» ( meaning "not connected"​ ), and it's value will not be reported.+If an endstop is not connected the pin should be set to «<​kbd>​nc</​kbd>​» ( meaning "not connected"​ ), and it's value will not be reported.
  
 This is in particular useful when setting up your machine : you can issue the <​kbd>​M119</​kbd>​ 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 ). This is in particular useful when setting up your machine : you can issue the <​kbd>​M119</​kbd>​ 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 ).
Line 27: Line 27:
 If an endstop'​s values are inverted, it probably means you wired the pin as NO when it is NC, or the opposite. ​ 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 Â«<​kbd>​!</​kbd>​» character after the pin number ( see [[http://​smoothieware.org/​pin-configuration|Pin Configuration]] ).+You can reverse a pin in the configuration file by adding or removing a «<​kbd>​!</​kbd>​» character after the pin number ( see [[http://​smoothieware.org/​pin-configuration|Pin Configuration]] ).
  
 For example if the beta min endstop is inverted in your diagnostics,​ change : For example if the beta min endstop is inverted in your diagnostics,​ change :
Line 52: Line 52:
 You use the <​kbd>​G28</​kbd>​ command to home your machine. You use the <​kbd>​G28</​kbd>​ command to home your machine.
  
-For example : +For example :
  
 <​code>​ <​code>​
Line 65: Line 65:
 G28 G28
 </​code>​ </​code>​
 +
  
 will home all axes which have endstops enabled (all three by default). will home all axes which have endstops enabled (all three by default).
 +
 +If your axis is moving away from the endstop when homing, you need to invert your min and max endstops, or invert the direction of the axis, depending on your preference.
 <callout type="​warning"​ icon="​true"​ title="​ CNC mode/GRBL mode">​ <callout type="​warning"​ icon="​true"​ title="​ CNC mode/GRBL mode">​
 The firmware-cnc.bin is in CNC mode and by default uses grbl compatibility mode in this mode G28 does **not** home, it goes to a predefined park position (defined with G28.1). To home in CNC/GRBL mode you issue $H, (or G28.2). The firmware-cnc.bin is in CNC mode and by default uses grbl compatibility mode in this mode G28 does **not** home, it goes to a predefined park position (defined with G28.1). To home in CNC/GRBL mode you issue $H, (or G28.2).
Line 91: Line 94:
  
 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). 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).
-reset will be required to continue, or sending M999, make sure you move away from the endstop though before trying to move.+Sending $X, or sending M999, or a reset will be required to continue. 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. To enable enstops as limit switches the following config options can be used, they are disabled by default.
Line 107: Line 110:
 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 <​kbd>​*.homing_retract_mm</​kbd>​ amount. ​ 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 <​kbd>​*.homing_retract_mm</​kbd>​ 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. ​+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 (eg ''​M206 X-5 Y-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.+That way you can home, and safely go to 0 without triggering a limit switch event. An alternative ​is to set min/max X/Y to -5 rather than 0.
  
 </​callout>​ </​callout>​
Line 123: Line 126:
 </​callout>​ </​callout>​
  
 +== Soft endstops
 +
 +Soft(ware) endstops is a feature that allows the board to refuse any command that would put it outside the bounds of the work area.
 +
 +Note that this feature only functions once the machine has been homed ( until then it can't know where it is ). After the machine has been homed this feature is enabled. it can be temporarily disabled using the <​kbd>​M211 S0</​kbd>​ M-code, and can be enabled again using the <​kbd>​M211 S1</​kbd>​ M-code.
 +
 +The configuration is as such : 
 +
 +<​code>​
 +soft_endstop.enable ​        ​true ​        # Enable soft endstops
 +soft_endstop.x_min ​         1            # Minimum X position
 +soft_endstop.x_max ​         999          # Maximum X position
 +soft_endstop.y_min ​         1            # Minimum Y position
 +soft_endstop.y_max ​         499          # Maximum Y position
 +soft_endstop.z_min ​         1            # Minimum Z position
 +soft_endstop.z_max ​         199          # Maximum Z position
 +soft_endstop.halt ​          ​true ​        # Whether to issue a HALT state when hitting a soft endstop (if false, will just ignore commands that would exceed the limit)
 +</​code>​
 +
 +Simply add this series of config options to your config file and the machine will start respecting soft endstops.
 +
 +You can test/debug the feature by issuing the <​kbd>​M211</​kbd>​ M-code, which will tell you the current status of the soft endstops.
 +
 +**NOTE** it is highly recommended that you always enable HALT when a soft endstop is hit, the ignore commands option is VERY dangerous as subsequent commands that are within the soft endstops limit will continue from an arbitrary position causing untold damage.
 == Usage example with home offsets == Usage example with home offsets
  
Line 152: Line 179:
 You might want to have a different origin point though. You might want to have a different origin point though.
  
-For example, if your X axis ​is homing to the max endstop, and that endstop is 200mm away from the machine origin, you can make sure the machine knows where that endstop is relative to your origin point by setting : +For example, if your X axis ​is homing to the max endstop, and that endstop is 200mm away from the machine origin, you can make sure the machine knows where that endstop is relative to your origin point by setting : 
  
 <​code>​ <​code>​
Line 158: Line 185:
 </​code>​ </​code>​
  
-If your X axis ​is homing to the min endstop, your work area is 200mm wide, and you want the origin point to be the center of the work area, you can set the origin point to the center of the work area by doing : +If your X axis ​is homing to the min endstop, your work area is 200mm wide, and you want the origin point to be the center of the work area, you can set the origin point to the center of the work area by doing : 
  
 <​code>​ <​code>​
Line 164: Line 191:
 </​code>​ </​code>​
  
-== External ​ressources+By default, the machine will home, and set the current position as configured, but will not move to 0,0 after homing. If you want to move to the origin after homing, you need to set <kbd> move_to_origin_after_home</​kbd>​ to true. 
 + 
 +<callout type="​default"​ icon="​true"​ title="​Going further">​ 
 +If you want to learn more about this module, or are curious how it works, Smoothie is Open-Source and you can simply go look at the code, [[https://​github.com/​Smoothieware/​Smoothieware/​blob/​edge/​src/​modules/​tools/​endstops/​Endstops.cpp|here]]. 
 +</​callout>​ 
 + 
 +== External ​resources
  
 === General video about mechanical endstops === General video about mechanical endstops