The default set up for RepRap Z endstops seems to be a minimum Z microswitch. It’s easy to set up, but soon becomes a right pain when you need to make an adjustment of a fraction of a millimetre – pretty tough to move your microswitch that small a distance. One alternative is to fix the microswitch at the maximum of the axis and adjust the known position of the endstop in the firmware.
Here are instructions on how to configure the TVRRUG Marlin firmware for a maximum endstop.
Configuration instructions
The following instructions refer to configuring a maximum Z endstop. To configure a maximum endstop on the X or Y axes, just replace Z with the correct axis name.
Open the Configuration.h
file in your editor and make the highlighted changes from line 160:
// ENDSTOP SETTINGS:
// Sets direction of endstops when homing; 1=MAX, -1=MIN
#define X_HOME_DIR -1
#define Y_HOME_DIR -1
#define Z_HOME_DIR 1
#define min_software_endstops false //If true, axis won't move to coordinates less than HOME_POS.
#define max_software_endstops true //If true, axis won't move to coordinates greater than the defined lengths below.
#define X_MAX_LENGTH 205
#define Y_MAX_LENGTH 205
#define Z_MAX_LENGTH 120
// The position of the homing switches. Use MAX_LENGTH * -0.5 if the center should be 0, 0, 0
#define X_HOME_POS 0
#define Y_HOME_POS 0
#define Z_HOME_POS Z_MAX_LENGTH
At first it may seem puzzling as to why minimum software endstops must be disabled, until you read the accompanying comment: If true, axis won’t move to coordinates less than HOME_POS.
With the Z_HOME_POS
being equal to the Z_MAX_LENGTH
, this means the Z axis will never be able to move away from its maximum position.
To adjust the Z home position, change the value of Z_MAX_LENGTH
.
Save, compile and upload the edited firmware to your TVRRUG electronics.
Pitfalls
There main problems I have found so far with this set up are:
- Adjusting the endstop position requires a re-upload of the firmware
- A GCode command to set the value of
Z_MAX_LENGTH
on the fly would save a lot of hassle.
- A GCode command to set the value of
- There is no quick way to know the correct value for
Z_MAX_LENGTH
- The RepRap.org GCode reference lists an M207: Detect Z_MAX_LENGTH command to speedily detect and set the correct value of
Z_MAX_LENGTH
, but it is not available in the TVRRUG Marlin firmware currently.
- The RepRap.org GCode reference lists an M207: Detect Z_MAX_LENGTH command to speedily detect and set the correct value of
Hannah,
Having not built a RepRap it’s easy to say this as I’m not aware of the mechanical constraints, but making a little setup to adjust the Z endstop microswitch one thou( = 1/40th of a mm) should be fairly easy. This would provide the scope to make adjustments in both software and hardware.
Eric…
Hi Hannah, very helpful article, just hit this wall… going to re-implement with max endstops, meanwhile I have an urgent file to print 128mm high – will go dirty and edit the Gcode manually to include a Z height reset at Z10!!!
Hope your print was successful!