Conditional homing and z-height fine adjustment
-
Hi,
I was wondering why you home to Z max.
Thanks.
Frederick
-
@fcwilt said in Conditional homing and z-height fine adjustment:
Hi,
I was wondering why you home to Z max.
Thanks.
Frederick
I have had several considerations for implementing the z-max switches:
- When the axis home they drop down a couple of mm. If the bed is max down it would crash into the hard mechanical endstops, offsetting the mesh and creating a terrible noise. Creating endstops and adjusting the homeing files eliminated this problem
- After the print i want the bed to drop down so i have easy access to the print and don't have to move something manual. Now i can simply home the Z-axis, and don't need to worry abbout the previous issue
- Additional benefit is having 2 z-max switches is that i can easily have a fixed reference point without much adjustment and home both z motors individually without much hassle.
There are a couple of downsides aswell:
- Starting a print can take considrable longer as the bed needs to travel from z-max to z-min.
- You have to carefully need to measure the Z-max to get your mesh leveling to work niceliy. Also you need something in your start g-code to do some z-level fine adjustments, (Hence above script).
To reduce the total time before the print starts i want to check the homing status to prevent a unnessecairy homing cycle in case the z-axis is already homed. And i wanted to test out the meta commands to see what would be possible.
-
@GuidoP said in Conditional homing and z-height fine adjustment:
I have had several considerations for implementing the z-max switches: ...
Thank you for the reply.
All of my printers home to Z min and it seems to me all of the reasons you stated for using Z max apply to Z min.
-
The crash scenario is the same for min versus max.
-
Most slicers will execute some user defined code on print completion. One of the things my "printing complete" macro does is move down to a bit - it could just as easily move to Z max.
-
I don't understand the fixed reference issue. You are referencing the frame when using either min or max - correct?
Thanks for the help in understanding.
I don't know if this makes any difference but I eliminated multiple Z steppers in favor a single stepper, belt driven setup which naturally keeps both Z axis lead screws in sync.
Frederick
-
-
@fcwilt Thanks for sharing your thoughts and considerations.
An alternative to my current setup would indeed be using a z-min homing scenario and just use the endstops as safetystops so the bed wont crash when is full down when the machine starts. (This is actuatlly my backuo scenario if i don't get the macro running).The crash scenarion in a z-min homing situation is higher imho:
- Machine starts, axis are not homed. The machine has no clue where the different axis are located
- Homing is initiated. X and Y homing will initiate (in the default g-code) a Z move in the z-max direction. Regardless if z-max or z-min is used
- If the bed is at or near the z-max position, with z-min endstops the machine has no way of knowing it will run out of bed travel and will crash to the mechanical limits. In a z-max endstop configuration the z-max endstop will trigger, stopping the move gracefully. With to independend z-motors you'll need to re-perform the bed leveling again due to the unknown shift between the two leadscrews. I'm not sure what would happen in your setup with a single stepper for 2 leadscrews. Does the belt slip or does the stepper skip steps?
I have two optical endstops bolted to the frame between steppermotor and linear rod. As the frame is square and level these switches are in the same position horizontally. I use a single 25mm aluminium angle profile bolted directly to the 2020 profiles of the bed as endstop flag. So basically there are no manual adjustments and everything is referenced to a fixed point resulting in a repeatable fixed horizontal level.
An alternative to this procedure on the z-min side would be using the z-probe to probe near the leadscrews and let the duet calculate how to level things out. This is a bit more straight forward without extra probing time. (Or use a single steppermotor which drives 2 leadscrews.... )There are a lot of differnt approaches and sollutions to solving a single problem. These are my solutions now, which i might (or might not) change in the future... That's the beauty of learning and progressing...
Anyway, i'm getting a bit off-topic... Sorry...
-
@GuidoP said in Conditional homing and z-height fine adjustment:
- Homing is initiated. X and Y homing will initiate (in the default g-code) a Z move in the z-max direction. Regardless if z-max or z-min is used
If it moves in the Z max direction when using Z min end stop then something is wrong. It should not do that.
Frederick
-
@fcwilt said in Conditional homing and z-height fine adjustment:
If it moves in the Z max direction when using Z min end stop then something is wrong. It should not do that.
Maybe he means the small lift before homing x and y for clearance?
-
@Phaedrux said in Conditional homing and z-height fine adjustment:
Maybe he means the small lift before homing x and y for clearance?
What small lift? I must do things backwards. I home Z first and then move to Z=5 before I home Y & X.
Frederick
-
@fcwilt For instance in homeall.
G1 Z5 F100 S2 ; Lower bed 5mm to ensure it is below the trigger height
-
@Phaedrux said in Conditional homing and z-height fine adjustment:
@fcwilt For instance in homeall.
G1 Z5 F100 S2 ; Lower bed 5mm to ensure it is below the trigger height
What would you do that?
Consider when homing to Z min:
G1 Z-999 H1
G1 Z20
G1 Z-999 H1When the first G1 executes if the endstop is already triggered no movement takes place and the next G1 executes which is safe.
Am I overlooking something?
Frederick
-
@fcwilt said in Conditional homing and z-height fine adjustment:
Am I overlooking something?
Yes, when using a probe you must position the probe first, so X and Y must be homed first, and by default the configurator includes a short lift of the Z axis to give clearance for the X Y move and to lift the probe above trigger height.
But I was just speculating on what he might have been meaning.
-
@Phaedrux said in Conditional homing and z-height fine adjustment:
Yes, when using a probe you must position the probe first, so X and Y must be homed first, and by default the configurator includes a short lift of the Z axis to give clearance for the X Y move and to lift the probe above trigger height.
Ah... I see.
I use a Z min endstop switch setup for homing in relation to the frame so I never encountered that issue.
I only use the Z probe for setting Z=0 and mesh comp probing, things which only occur after the ZYX homing has been done.
Thanks.
Frederick
-
@Phaedrux said in Conditional homing and z-height fine adjustment:
@fcwilt said in Conditional homing and z-height fine adjustment:
If it moves in the Z max direction when using Z min end stop then something is wrong. It should not do that.
Maybe he means the small lift before homing x and y for clearance?
Thats correct
-
Thanks all for the input, but unfortunately it does not bring me closer to an answer to the original question: Why does the conditional gcode not work as intended? Where is the bug in the code??
-
I finally got the macro working with following code:
; Source: https://forum.duet3d.com/topic/4202/homing-to-z-max-when-also-using-a-z-probe/19 ; Start g-code: G28, M98 P"0:/macros/Leveling/SetZ" ; run z fine tuning ; If the printer hasn't been homed, home it ;M291 P"checking homing status" R"Homing status" S1 ; Report status if !move.axes[0].homed || !move.axes[1].homed || !move.axes[2].homed ; Check if axis are not homed ;If axis are not homed, home axis echo "Axis are not homed, performing homing" M98 P"0:/sys/homeall.g" else ;If axis are already homed, home only the X and Y axis echo "axis are homed, re-homing x and Y" M98 P"0:/sys/homex.g" ; Run the Home X macro M98 P"0:/sys/homey.g" ; Run the Home Y macro ;G1 X100 Y100 H0 F1800 ; move to be centre slowly. ;End homeing check M291 P"Axis homed" R"Homing status" S1 ; Report status ;echo "start fine tuning z-level" G1 X100 Y100 H0 F1000 ; move to be centre slowly. G1 Z15 H1 F8000 ; Raise the bed to start probing G30 ; probe for z=0 G1 Z10 H1 F1000 ; raise nozzle G30 S-1 ; check z gap G1 Z10 H1 F1000 ; raise nozzle M400 ; Wait until all moves are completed
I changed and tested several different thing, but i think the trick that did it was removing the empty line between the end of the "If" block and the start of the "else" block.