Z probing error

Hi All

I am trying to set a gcode file (or preferably single macro) to home my xcarve Z axis only with a z probe. I have G54 offsets in use to use a set work position based on an L shaped bracket I use to set my workpiece each time.

I have tried this as a gcode file
G38.2 Z-30 F60
G92 Z -15
G0 Z 10

but get an error ‘invalid gcode in handleGCode: 38.2’

what am I doing wrong with this file, or can it be made into a single macro for UGCS


Homing your Z axis would involve having a home switch at the top of the travel and putting a retract distance in the Grbl parameters which I think is $27.

This is the gcode I am using in a macro to create a Z zero on top of my work using the Inventables Z probe if that is what you are trying to attempt.

It’s in inches and the .589" is the thickness of the brass round portion of the Z probe. You need semicolons in between each code of the macro. I gleaned this from other discussions and manipulated them until I got something that worked.

G20;G91;G38.2 Z -.500 F1; G92 Z .589; G0 Z .125

The macro when clicked in UGS will drop down at a rate of 1 inch a minute for a distance of a half an inch. If the bit contacts the probe round within that distance, it will make the measurement below the round Z zero, and then move back up another 1/8" to clear the brass round. You can change the Z-.500 to a larger or smaller number if you like. You can change the Z.125 to a different number if you like. You’ll have to measure the thickness of your Z plate and adjust that accordingly too.

G92 won’t persist across power cycles and doesn’t change the G54 offset. You may need to move your G91 prior to the G38.2 but otherwise it should work.

Here’s what I use for setting a G54 Z offset with probing:

G38.2 Z-1 F3
G10 L20 P1 Z0.829
G91 G0 Z0.125

Thanks so much for pointing me in the right direction.

I ended up with this that at least works, although may not be the most efficient.

I force home all three axis on startup $h, send to work home using G54 settings. This leaves the Z quite high to add/change bits. Then I run the macro below (thanks for the help here) to zero using inventables zprobe. I’m in UK so all metric now.

M5; G17; G21; G91 G38.2 Z-40 F10; G92 z15; G91 G0 Z15; G90

This works for the zero then I raise Z enough for me to slip my dust shoe on.

I have added a couple of relays and added lines to the Header section of grbl.mm post processor for Vcarve to raise bit, pause one second, turn on dust extraction, wait four seconds, turn on strobe, wait one second, turn on router, wait two seconds, then start carve. The pauses stop any interference causing drop outs. It has had no disconnection issues after putting these pauses in. I think the pull of dust extractor motor kicking in and router starting caused line noise. At the end of the carve, the bit is raised, router turned off, wait two seconds, turn dust extractor off, turn off strobe, wait two seconds, return to X0Y0. I have added a strobe light to outside workshop so I can see when router finishes if I’m not in the workshop for all of a long carve, as strobe turns off at end.

All good in my world now thanks to amazing help on here.

1 Like