Z probe retraction

Hi folks i have scannned the forum for an answer but couldn’t find one, with the Z probe is there a way of creating a retraction of say 10mm after it has zeroed rather than it finishing with the bit touching the probe. Cheers
Sorry forgot to add on Marlin dual end stop version.

Yes, but it’s not a firmware setting. It is some lines of g-code, and where to put that g-code will depend on how you are triggering the Home Z command.

G28 Z       ;  Home Z
G92 Z0.5    ;  Set current offset to 0.5 for Z
G0 Z5 F480  ;  Lift Z to allow touch plate to be removed

Note that the 0.5 in the second line is for a 0.5mm thick touch plate. The Z5 in the third line lifts the bit to 5mm absolutely, not relative to the touch plate, which will be 4.5mm above the touch plate. Adjust these values for the thickness of the plate and how far you want to lift the bit.

If you are using Repetier-Host, you can attach this code to a custom button. If you run from an SD card, you can put these lines in a .gcode file and run them like any other file. If you use the LCD, you can modify the V1 custom menu to run these lines for Home Z, but it requires flashing the firmware.

2 Likes

Cheers Robert,
will give it a go now, and report back.

Hi, thought i would look in the homing section of the ADV.H for the bumps and retracts to see if it was do-able from there here’s a screenshot of how i set it and it works “sort of” there always seems to be a 5mm offset. To explain it initially homes, retracts then slow homes, then retracts 30mm, but only shows +25mm on the screen and if i move the Z axis to zero manually it ends up 5mm of the part or where i would expect. Is there something else within Marlin that is creating that offset?
Also the issue is fine with the X and Y axis and work as as expected and screen shows +2mm for both, it only the Z axis.
The rest of the code is untouched apart from the home switch true / false flags which are working fine.

OK, found the answer interestingly the probe section of the code in “CONF H” interferes with the homing section in “CONF ADV H” the answer was to alter lines 963-965 to zero state, this takes out that random offset.

then all i it did was to change these settings in “CONF ADV H” and now it works exactly as planned, touches off, retracts, slow touch off, retracts to 30mm.

2 Likes

This is very cool. The only issue I see (and I may be missing something) is that this does not take into account thickness of the touch probe.

working on that now, i think what needs to be set is the nozzle offsets in “CONF H” to “0, 0, whatever the thickness of your block is”
testing right now will report back.
Also thanks Robert for leading down a path to find my own solutions, i used to (in a past life) be a programmer in the days when we were still programming in Hex and boolean, so i’m now having to learn a new coding language, its fun and rewarding when you get it right.

Ideally, you could set the offset with M851 after the fact too. Good work.

Try as i might there seems to be some kind of conflict/interference between the probing code and the homing codes that i can’t trace at present and that limits what i want it to do. One of the issues with using 3d firmware as a CNC controller i guess, i will keep plugging away in my spare time to try to crack the code and find the issue. But for now i’m going to get using my MPCNC for what i built it for rather than disappear down the “coding rabbit hole”. Here is what i did as a workaround @robertbu was correct and i bow to his better judgement.
One question you guys may be able to help with is getting repeatable Z homing, if i ask it to home Z again leaving the XY co-ordinates intact it seems to add to the existing Z values instead of re-homing Z to the new position, might be a relative vs absolute issue? i’m not sure of the syntax i would need to use if it is.
Also i can compile code to add extra custom commands, but they don’t show in the menu is there a limit of 5 onscreen or is it a setting i can’t see?

Huh strange. We have to work with a separate G38.2 command in the low rider because we want it to home (and auto square) up, but still use a single pin for the touch plate.

We ended up enabling G38.2 and use that to probe. G28 Z homes up, G38.2 probes down, and doesn’t reset the coords. So we G38.2 and then G92 immediately after.

Hi Jeff, Was just looking at the marlin page for the G38 commands and it seems a little vague, can you clarify if i send a G38.2 it will lower Z until it touches off and reset Z co-ordinates to Zero using Z-min pins?
To clarify what i’m trying to achieve if i was to cut a pocket within a pocket my original Z0 would be on the top of the stock but then i need to change tools and re-zero on the ledge in the pocket how would i do that with a custom command?
Cheers

It doesn’t reset the Z. At least I think it doesn’t. You have to immediately send a G92 right after.

G38.2 Z0
G92 Z0.5
G1 Z10 F300

Something like that. For any of the ways to control it, there is a way to create custom macros to put that into one button press. If you are trying to do that in a file, you need to wrap that with some M0 commands to pause while you put the touch plate in the right place.

Cheers Jeff good advice as always Thanks,
I will experiment with the above.
Have you any advice on adding the extra custom commands beyond 5 items, as my plan is to run everything without having to attach a PC, just because probably like you i spend hours using computers at work and really want to make my machine stand alone so it gets me away from feeling like i’m at work when i’m not if you know what i mean.

Have you any advice on adding the extra custom commands beyond 5 items

My solution (for the reason you list) was to create a pendant. Here is one on Thingiverse. Mine is conceptually similar, though a bit different. The pendent “just” pumps g-code across a serial connection, so I can see a number of different pendent types.

Another solution, while cumbersome, you can put individual commands in g-code files and run them off the SD card.

2 Likes

Robert has some good ideas.

In case you didn’t know, you can chain multiple commands together by adding \n between them.

Solved it, schoolboy error on my part i’m afraid, i forgot to add a n\G92 Z0.0 into the “home to part” script to reset the Z. works perfectly now