← Projects
laser intermediate Sep 13, 2026 ◯ 6 min read

Build a DIY Auto-Focus Z-Probe for Diode and CO2 Lasers: Sensor Wiring, Mounting, and GRBL/LightBurn Setup

Build time: 1-2 weekends (mechanical build plus incremental tuning)
Tools needed: 3D printer, soldering iron, wire strippers/crimpers, hex key set, digital calipers, laptop with LightBurn and serial/GRBL console access
Parts List
laserauto focusz-probegrbllightburnz-axis

Focus height is the single most repeated manual step in laser operation — every time material thickness changes, most diode and small CO2 laser owners are stuck using a focus jig, a ramp test, or "eyeballing it with a piece of acrylic" against the nozzle. A touch-probe auto-focus Z-axis takes that step out of the workflow entirely: touch off on the material, and the controller sets focus height automatically, the same way a 3D printer probes its bed. This build adds a motorized Z-axis with a physical touch probe to a GRBL-based diode laser (or a CO2 machine with an accessible Z-axis), wired and configured for LightBurn's Z-axis and material-height probing features.

How This Works

The build has three parts: a motorized Z-axis that can move the laser head up and down under GRBL control, a touch probe that closes an electrical contact the instant it touches the material surface, and firmware/software configuration that uses that probe signal to set focus height automatically before each job. Machines that shipped with a fixed, non-motorized focus mechanism need the Z-axis added as part of this build; machines that already have a motorized Z (many CO2 machines, and higher-end diode lasers) only need the probe wired in and the software configured.

Difficulty, Time, and Requirements

This is an intermediate electromechanical build — no advanced machining, but it requires comfort with GRBL configuration ($ settings), basic wiring, and 3D printing or fabricating a probe mount specific to your machine's head assembly. Expect a weekend for the mechanical and wiring work, plus incremental tuning time afterward. It assumes a GRBL or grblHAL-based controller (standard on most diode lasers including the Longer Ray5 20W, and common on many CO2 conversions) with a spare input pin available for the probe signal — check your controller's board documentation for an unused Z-probe or limit-switch header before starting.

Parts List

Tools Required

3D printer for the probe mount and Z-carriage adapter bracket (or access to one), soldering iron, wire strippers and crimpers, hex key set, digital calipers, and a laptop with LightBurn and access to your controller's GRBL settings over serial (LaserGRBL, a terminal program, or LightBurn's own console work fine).

Choosing a Probe: Inductive vs. Mechanical

TypeProsCons Inductive proximity sensorNo moving parts to wear out; consistent trigger point; fastOnly detects metal — won't trigger on wood, acrylic, leather, or most laser materials directly, so it needs a metal touch plate technique or is limited to metal-bed referencing Mechanical microswitch probe (deflection-style, like a 3D printer BLTouch-style probe or a simple lever switch)Works on any material — wood, acrylic, foam, leather, anything with a solid surfaceHas moving parts, small mechanical trigger-point variation (fractions of a millimeter), needs occasional cleaning of dust/debris from the mechanism

For general laser work across mixed materials, a mechanical deflection probe is the more broadly useful choice, since most jobs aren't cutting bare metal. If your primary use case is metal marking or engraving on a fixed metal jig plate, an inductive sensor is faster and has no wear parts.

Build Steps

  1. Design or print the Z-axis carriage. This needs to mount your laser head rigidly to the linear rail carriage while preserving the correct beam/optics alignment — if your laser head has an existing fixed mount, model the new carriage around its existing mounting holes rather than redesigning the head bracket from scratch.
  2. Mount the linear rail vertically to your machine's gantry or head-mounting plate, square to the work surface. Check squareness with a machinist square before final tightening — any tilt here becomes a focus-height error that changes across the work area.
  3. Install the lead screw, motor, and coupler, aligning the lead screw parallel to the linear rail. Some binding or roughness when turning the screw by hand usually means the rail and screw aren't quite parallel — loosen and re-square before proceeding.
  4. Mount the probe to the head assembly, positioned so it contacts the material surface at (or very near) the same XY point the laser beam fires through, and at a known, fixed offset below the nozzle/lens. This offset gets entered into your firmware configuration in the next step.
  5. Wire the stepper driver to your controller's Z-axis stepper output (if the board has an unused axis driver already) or to an added driver module wired into a spare GPIO pair configured as step/direction in GRBL's pin map. Wire the probe signal to the controller's dedicated probe input if one exists, or to a limit-switch input reconfigured for probing.
  6. Configure GRBL Z-axis settings — steps/mm (calculated from your lead screw pitch and microstepping), max travel, and homing direction if you're adding limit switches. Jog the axis in small increments first and verify the physical movement matches the commanded distance before moving on.
  7. Configure the probe pin in GRBL's settings ($6 for probe pin invert, depending on whether your probe is normally-open or normally-closed) and test triggering with a G38.2 probe command, watching for the "PRB" response in the console confirming a successful probe cycle.
  8. Set the probe-to-focus offset in LightBurn (or your control software's equivalent setting) — this is the physical distance between where the probe triggers and where the beam is actually in focus, measured directly with calipers during setup and re-verified any time the probe or head is remounted.

Calibration and Verification

Before trusting the auto-focus for real jobs, run a focus verification cut: probe on a known material thickness, cut a small test pattern, and compare cut quality against a manually-focused cut on the same material and settings. Repeat across a few different material thicknesses spanning your typical range (thin plywood through thicker acrylic) to confirm the offset holds consistently rather than only working at one thickness. Re-verify the offset any time the probe, head, or optics are removed and reinstalled — a probe that's been bumped even slightly out of position will silently produce a small but real focus error on every subsequent job.

Safety Notes

Once tuned, an auto-focus probe removes one of the most tedious parts of running a laser across varied stock — no more ramp tests or focus gauges for routine material changes. It's a build that pays for itself quickly in shops running a lot of different material thicknesses through the same machine, and the underlying probe-and-offset technique is the same one 3D printers have used for years, just applied to a different axis.