GRBL Gcode autofocus command

I have a GRBL based laser with an autofocus feature fitted (simple limit switch trip). This autofocus can be used in the manufactures own software or via a button on the unit.
I believe the autofocus button in Lightburn only shows with Rudia and not GRBL so I am trying to figure out what the command might be to create a macro button. The native software does not have a line command screen to see what is being sent.
Any help appreciated, thank you.

That’s the secret: “autofocus” is just a fancy name for “Z homing”. In both cases, the axis moves until the switch trips, at which point the controller sets that position as Z=0.

Assuming the manufacturer hasn’t added weird proprietary jank to the stock GRBL firmware, a manual Z home operation should do the trick.

One gotcha: you (probably) don’t want the machine to auto-home all axes when it’s turned on, because the focus probe (probably) won’t be positioned over anything useful. You may need to set up a separate XY homing macro, followed by a manual Z home when the material is set up properly.

Now, that sounds like weird proprietary jank …

Thank you.
I did think that about the z homing but wasn’t 100% sure. I dont have auto homing activated but may just create a few separate buttons for focusing the Z, returning it back to the top and XY home.

For XY Home, use $HX and $HY in your macros.

So I have just been paying attention a little more than I was before - the auto focus raises the Z first, trips the top switch twice (fast and slow), then lowers it down to do the bottom switch and again does a fast find then again slowly to set the focal height.
Now if I try to use $hz that will raise the laser up, not take it down. I’m trying to avoid adjusting the $3 position to correct this so I dont support you would know a the command to essentially home the axis in both directions?

The top switch sets the home position and the second does the focusing; the latter is totally not stock GRBL firmware behavior.

At this point, without knowing which machine / firmware / hardware you have, I’m out of suggestions.

If whoever wrote the firmware didn’t provide any documentation of the commands, you’re sunk.

Edit to add: If it’s a CNC-derived G-Code interpreter, then you might be able to use a G38 probe command. The LinuxCNC doc gives more details:

https://linuxcnc.org/docs/stable/html/gcode/g-code.html#gcode:g38

How that ties in with the initial home sequence remains a mystery.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.