Z Maximum and Z Position and Homing
-
Sorry if this has been discussed before but I'm confused with Z maximum and Z position and homing.
In config.g the machine dimensions are set, including the Z axis maximum:
M208 X214 Y214 Z218.315 S0 ; set axis maxima
My cartesian machine homes to the top and I have assumed this would be the only place I should need to set the machine height.
But in both homeall.g and homez.g there is a G92 that has for a comment.
; set Z position to axis maximum (you may want to adjust this)
In my homeall.g and homez.g this Z position number is different; and one is different from the number in config.g.
Why are there two files where Z position can be set? And is maximum in config.g different than position in the two home files?
I think I am confused because my machine homes to the top using a switch while I suspect many people home using other means.
-
@gbartsch You can remove the G92 commands, they are not needed any more. If you home in +Z direction, G1 H1 will set the position to the defined Z maximum when the endstop switch is triggered (and vice versa if you move in -Z direction).
-
@chrishamm Thank you! That helps a lot and makes the process easy.
-
You can also use a macro to measure the exact height of the endstop from the actual bed surface. This is handy for Z max endstops configurations.
; 0:/macros/Bed Leveling/0_Set Zmax height.g ; Automates measuring the Zmax height for optical endstop at ~300mm ; M291 P"This will set Z0 and calibrate Zmax height" R"Proceed?" S3 M291 P"Homing all axis" T5 G28 ; Home all G90 ; Absolute positioning ;M98 P"0:/macros/0_Center Nozzle.g" ; Move nozzle to bed center G1 X150 Y150 F6000 M291 P"Adjust nozzle height until it's touching bed" Z1 S3 G92 Z0 ; set Z0 M291 P"Z will now move to max and save the height" S3 G1 H3 Z300 F600 M500 ; save m208 value for z axis to config override
-
@Phaedrux That's cool!
I don't know much about reading this but it looks like when the macro is run prompts will ask permission to proceed? First I would make sure the nozzle is free of any plastic. Then upon running the macro I would need to manually move the nozzle down till it just touches the bed? Then click a prompt and the axis would move back up (but there is only one prompt)?
But how can this work without a probe? I don't have any BLTouch or optical sensor.
-
The M291 commands are message boxes. Some have a simple timer and show info, others are blocking and have an OK/Cancel button, or gives you a jog dialog to move the Z axis until it just touches the bed.
You don't need a probe because you are manually moving the nozzle to touch the bed so it knows where Z0 is. Then it does a special homing move to the Z max endstop to get the exact height that it triggers at and then saves that value to config-override.g which gets loaded again at startup and will have an M208 command with the measured Z height.
-
@Phaedrux Oh my! This is magic. I'll do this right away. Thanks for explaining.
So I can leave my Z maximum setting in config.g?
-
@gbartsch said in Z Maximum and Z Position and Homing:
So I can leave my Z maximum setting in config.g?
Yes, it doesn't need to change.
You would need M501 at the end of config.g to load config-override.g but that're probably already there if you've PID tuned your heaters and used M500 to save them.
You can then check the config-override.g file to see what it's saved.
Take care when running this macro. Perhaps it would be wise to reduce motor currents first, just in case. You could add
M915 X50 Y50 Z50
after the G28 command to reduce motor currents by 50% and then addM915 X100 Y100 Z100
at the end to return them to normal. -
@Phaedrux said in Z Maximum and Z Position and Homing:
You would need M501 at the end of config.g to load config-override.g but that're probably already there if you've PID tuned your heaters and used M500 to save them.
Thanks. Yes M501 is there; I've run the PID tuning and values were written to config-override.g so everything is working. I'd never used it before the firmware upgrade and it's great.
-
@Phaedrux said in Z Maximum and Z Position and Homing:
Take care when running this macro. Perhaps it would be wise to reduce motor currents first, just in case. You could add M915 X50 Y50 Z50 after the G28 command to reduce motor currents by 50% and then add M915 X100 Y100 Z100 at the end to return them to normal.
Does this look OK?
; Automates measuring the Zmax height for mechanical endstop at ~214mm ; M291 P"This will set Z0 and calibrate Zmax height" R"Proceed?" S3 M291 P"Homing all axis" T5 G28 ; Home all G90 ; Absolute positioning M915 X50 Y50 Z50 G1 X107 Y107 F6000 M291 P"Adjust nozzle height until it's touching bed" Z1 S3 G92 Z0 ; set Z0 M291 P"Z will now move to max and save the height" S3 G1 H3 Z300 F600 M500 ; save m208 value for z axis to config override M915 X100 Y100 Z100
-
@Phaedrux said in Z Maximum and Z Position and Homing:
Take care when running this macro.
So as not to smash the nozzle into the bed?
-
Everything seemed to run perfectly till after the X axis moved to the top and touched the limit switch and an error message popped up saying the process took too long and to see the message in the console:
-
I've given you the wrong command for motor current reduction. it should be
M913
notM915
-
@Phaedrux No worries! Thank you.
Actually the value was written to config-override.g and is, I believe, working.
Interestingly the macro says my Z maximum is ~0.25mm more than the Z maximum I've been using so without adjusting my slicer Z Offset the first layer was too squished. This could be due to how I ran the test.
I measured a piece of thick-ish paper that was on hand and placed it under the nozzle and dropped the nozzle till I could slide the paper out without too much trouble. Then I dropped the nozzle the thickness of the paper before putting the axis back to the top.
I'll run the macro again.
-
@gbartsch said in Z Maximum and Z Position and Homing:
slicer Z Offset
With an accurate measurement of the Z0 position you shouldn't need any slicer offset.
Which reminds me, that macro should be run at print temps on nozzle and bed to account for thermal expansion.
-
@Phaedrux said in Z Maximum and Z Position and Homing:
With an accurate measurement of the Z0 position you shouldn't need any slicer offset.
The smallest moves the macro makes are 0.05mm (I'd like to know how to adjust that value) and I don't find 0.05mm fine enough to get a perfect first layer; particularly when printing tiny parts with very little contact area to the bed.
My Z leadscrews have an 8mm pitch but even with them 16x micro-stepping gives theoretical Z resolution of 0.02mm. I'm not sure what actual resolution the machine is capable of but I adjust my Z offset in 0.02mm amounts and it makes changes that give me very good first layer control.
Maybe I'm missing something with the macro? If I could jog the X axis down by 0.02mm it would be perfect. To avoid trying to see the nozzle touch the bed I'd put a 1mm thick steel ruler under the nozzle and jog down till I could feel the ruler just start to drag on the nozzle and then pull it out. Then I'd lower the nozzle 1mm and then move the axis to the top.
That is a really cool macro.
-
You could manually send the key commands from the macro to do the measuring portion. That way you can position the Z axis however you want.
Start by homing, then jog Z down to touch the bed however you need to get it where you want it. Then send
G92 Z0
to set Z0. Then sendG1 H3 Z300 F600
to measure the distance between Z0 and the Zmax endstop trigger. M500 to save. -
@Phaedrux said in Z Maximum and Z Position and Homing:
That way you can position the Z axis however you want.
Thank you! It's so cool what the Duet can do. I'll be trying that for sure at some point.
Right now I have my machine set so I don't need any Z offset. Because of my disability I sometimes have to do things in non-conventional ways because I can't do things the normal way. To get the Z height I adjust the Z offset in the slicer and when the print shows a perfect first layer (or skirt thickness) I adjust the machine Z maximum by that amount and the result is 'close enough'.
The above assumes the machine Z maximum is already close.
I also tram the build plate, when needed, by printing dots in the center and corner of the bed and then adjust as needed. It's messy but at least I can do that without help.
-
@gbartsch said in Z Maximum and Z Position and Homing:
To get the Z height I adjust the Z offset in the slicer and when the print shows a perfect first layer
Nothing wrong with that.
-
@Phaedrux said in Z Maximum and Z Position and Homing:
Nothing wrong with that.