Build a DIY Auto-Focus Z-Probe for Diode and CO2 Lasers: Sensor Wiring, Mounting, and GRBL/LightBurn Setup
- NEMA 17 stepper motor
- T8 lead screw and anti-backlash nut kit (8mm)
- MGN12 linear rail and carriage set
- Inductive proximity sensor (NPN, 12mm)
- Mechanical microswitch touch probe
- Stepper motor driver module (TMC2209)
- Flexible shaft coupler 5mm to 8mm
- Shielded 4-conductor stepper motor cable
- Shielded 2-conductor signal cable
- M3 socket head cap screw assortment
- Heat-set threaded inserts (M3)
- Digital calipers
<p>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.</p>
<h2>How This Works</h2> <p>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.</p>
<h2>Difficulty, Time, and Requirements</h2> <p>This is an intermediate electromechanical build — no advanced machining, but it requires comfort with GRBL configuration (<code>$</code> 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.</p>
<h2>Parts List</h2> <ul> <li>NEMA 17 stepper motor for the new Z-axis</li> <li>T8 lead screw and anti-backlash nut kit (8mm)</li> <li>MGN12-style linear rail and carriage set</li> <li>Inductive proximity sensor (NPN, 12mm) for metal-touch probing, or a mechanical microswitch touch probe for general material probing</li> <li>Stepper motor driver module (TMC2209 or A4988)</li> <li>Flexible shaft coupler, 5mm to 8mm</li> <li>Shielded 4-conductor stepper motor cable</li> <li>Shielded 2-conductor signal cable for probe wiring</li> <li>M3 socket head cap screw assortment</li> <li>Heat-set threaded inserts for the 3D printed mounts</li> <li>Digital calipers for calibration and verification</li> </ul>
<h2>Tools Required</h2> <p>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).</p>
<h2>Choosing a Probe: Inductive vs. Mechanical</h2> <table> <tr><th>Type</th><th>Pros</th><th>Cons</th></tr> <tr><td>Inductive proximity sensor</td><td>No moving parts to wear out; consistent trigger point; fast</td><td>Only 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</td></tr> <tr><td>Mechanical microswitch probe (deflection-style, like a 3D printer BLTouch-style probe or a simple lever switch)</td><td>Works on any material — wood, acrylic, foam, leather, anything with a solid surface</td><td>Has moving parts, small mechanical trigger-point variation (fractions of a millimeter), needs occasional cleaning of dust/debris from the mechanism</td></tr> </table> <p>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.</p>
<h2>Build Steps</h2> <ol> <li><strong>Design or print the Z-axis carriage.</strong> 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.</li> <li><strong>Mount the linear rail vertically</strong> 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.</li> <li><strong>Install the lead screw, motor, and coupler</strong>, 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.</li> <li><strong>Mount the probe to the head assembly</strong>, 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.</li> <li><strong>Wire the stepper driver</strong> 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.</li> <li><strong>Configure GRBL Z-axis settings</strong> — 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.</li> <li><strong>Configure the probe pin</strong> in GRBL's settings (<code>$6</code> for probe pin invert, depending on whether your probe is normally-open or normally-closed) and test triggering with a <code>G38.2</code> probe command, watching for the "PRB" response in the console confirming a successful probe cycle.</li> <li><strong>Set the probe-to-focus offset in LightBurn</strong> (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.</li> </ol>
<h2>Calibration and Verification</h2> <p>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.</p>
<h2>Safety Notes</h2> <ul> <li>Keep the probe wiring shielded and routed away from stepper motor cables where possible — probe signal glitches from electrical noise can cause a false trigger, setting focus height incorrectly on a job and potentially driving the head into the material.</li> <li>Set a firm Z-axis soft limit in GRBL so a failed or missed probe (material not detected) can't drive the head into the bed or material at full travel.</li> <li>This addition changes your machine's moving mass and head geometry — recheck beam alignment (on CO2 machines with mirrors) or laser module mounting rigidity (on diode machines) after installation, since a shifted optical path is a separate problem from focus height and won't be fixed by the probe.</li> <li>As with any laser modification, keep the standard laser safety practices in place throughout testing — safety glasses rated for your machine's wavelength, and no bypassing enclosure interlocks to test the new axis.</li> </ul>
<p>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.</p>