Dual Z axis homing issue

Hello,

I have my Lowrider CNC working with dual z homing and using Z_min and Z_max pins as Min endstops for the Z axis. I want to invert these so I edited the direction of endstop when homing so that Z direction is positive.

// Direction of endstops when homing; 1=MAX, -1=MIN
// :[-1,1]
#define X_HOME_DIR -1
#define Y_HOME_DIR -1
#define Z_HOME_DIR 1

Now when I home my Z axis both motor lift the Z axis. However, the endstops are not working. I am thinking that I have told Marlin sonewhere that both endstops are used for Z min and therefore it doesn’t care when they are pressed when looking for Zmax endstops.

I can’t find where to change it in the code though. Tried inverting the endstops aswell but no luck.
Any ideas?

If your intention is to have the lowrider home Z to the top of its travel you will have to move your homing switches to operate when the gantry has reached its maximum up position, then you will need to enable both #define USE_ZMAX_PLUG and #define USE_ZMIN_PLUG. If you are using normally closed switches you will also need to set #define Z_MIN_ENDSTOP_INVERTING true and #define Z_MAX_ENDSTOP_INVERTING true, otherwise leave them commented out.

(configuration.h)

Hey thanks for your response!
All the endstops are defined as below
#define USE_XMIN_PLUG
#define USE_YMIN_PLUG
#define USE_ZMIN_PLUG
#define USE_XMAX_PLUG
#define USE_YMAX_PLUG
#define USE_ZMAX_PLUG

And inverting as
#define X_MIN_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
#define Y_MIN_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
#define Z_MIN_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
#define X_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
#define Y_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
#define Z_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
#define Z_MIN_PROBE_ENDSTOP_INVERTING true // Set to true to invert the logic of the probe.

It doesn’t seem to matter if the Endstop Inverting is true or false when I reverse my homing direction.

1 Like

I think you are misunderstanding the #define X_MIN_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop… this parameter is used to determine if you are using home switches that are normally open or normally closed. If the switch contacts are closed when the carriage hits the switch that is refered to as normally open, if the switch contacts are open when the carrage hits the switch then that is referred to as normally closed. The advantage with setting the switch to normally closed is that if you suffer a broken wire to the switch the machine will think it is already at the limit and so will not move. If you set this parameter incorrectly the machine will act in the same way, it will believe you are already homed.

// Direction of endstops when homing; 1=MAX, -1=MIN sets the DIRECTION of travel to home
#define USE_ZMAX_PLUG tells the m/c you are using an endstop connected to the control board
#define X_MIN_ENDSTOP_INVERTING false tells the m/c the logical signals to expect

You can send M119 to obtain the state of the switches…check that they are working the way you want

Thanks for the response! I am aware of the X_MIN_ENDSTOP_INVERTING false/true and like I said in my original post I have the Z homing working when homing to min with dual endstops. The endstops deliver the correct responses when I send M119.

When I Invert my homing direction the Z starts to home towards the max direction but doesn’t stop when hitting the endstops which before worked when homing to min.

The thing is that I am using dual motordrivers for Z and dual endstops to square the machine. My theory is that the machine still recognises there endstops as min and not max and therefore it doesn’t care when I trigger them when it is trying to home to the Max position.

Another thought, you say that if the enstop inverting is set wrong then the machine will not move since it thinks that it is triggering the endstop. Even if i change these for the z endstops there is no difference when homing leading me to futher belive that the machine doesn’t recognise the endstops as MAX.

Could you expand on this claim for your first response.
" If you are using normally closed switches you will also need to set #define Z_MIN_ENDSTOP_INVERTING true and #define Z_MAX_ENDSTOP_INVERTING true, otherwise leave them commented out."
Why would I want to invert them? That leaves them Triggered when not actually triggered when sending M119

Endstops are ignored until homing. They don’t stop regular movement.

We have a working configuration in the MarlinBuilder releases for this. The dualLR setups home up, and have a separate G38.2 probe set up on the zmin.

I haven’t found it easy to reuse the zmin endstop pin when Z_HOME_DIR is +1. So the easiest solution is to make Zmax the Z1 endstop (no conf needed) and set the Z2 to Ymax or Xmax.

You didn’t mention which board you have. If there isn’t one rhat works for you, maybe you can just look at the differences. Or else, you can figure out what the script is doing by looking at the source.

I went through this with another builder. By setting up G38, you will find that the zmin endstop does not show up when you issue a M119 command. That means when you home, it never triggers and just keeps on going. The Zmax endstop is there. With G38 enabled, you would have to assign the Z1 endstop to another pin. With dual Y’s, that leaves Xmax. In the end, we just diasbled the G38 and went back to using zmin and zmax. Now they both show up with M119 and the homing worked.

Thanks I’ll have a look at that next week. I donät have any free endstop pins left. Ramps 1.4 board with dual y endstops, dual z, single x and probe (6 total). Do you mean I could change for example Ymax to for as the pins for Z2Max and Z2Max as Ymax?

1 Like

Thanks! I am using G38 and my Zmin shows up with M119image (This was with inverting för z endstops set to true)

From you description I understand it as if you don’t use your probe anymore? My homing works with G38 enabled as long as i home in negative z direction

Please let me know which endstops you are using for the Z and Z2 motors, and for the z probe.

Your Z endstops are showing as triggered. I am guessing they are not actuated and should therefore be showing up as open. Depending on how you wired your endstops, and configured the pullups/pulldowns, that would affect the behavior. For example, if you wired the NC (normally closed) between signal and ground, and set endstop pullups, then this would send logic 0 when open and logic 1 when closed. You would not need to invert the logic in software. You can test by manually actuating the microswitch for each z axis and using M119 to check that the behavior matches your expectations.

Not in the pins file. Look at this (this is how we edit a vanilla Marlin for dual yz:

With z home dir set to +1, marlin is going to always use the zmax endstop for the Z1 motor.

In configuration_adv.h, the endstop for the Z2 motor is set to Xmax.

So if you’re only homing Z so far, you would plug Z1 endstop into Zmax and the Z2 endstop into Xmax.

Dual Y endstops is still Ymin and Ymax.

X is still Xmin.

That leaves Zmin, and we want probes! There is some hurdles to go through with this. Specifically, unsetting zprobe uses zmin and then setting the z probe pin to the zmin pin. It is weird, but it works. Then enabling G38 so we can tell marlin to probe down, even when homing up.

Thank you all for your help. I have decided to stay with the Z axis homing down and just use two identical objects to square the Z with and then probe as usual:)