Homing and Limit Switches for GRBL CNC Routers: Wiring, Configuration, and Safe Homing Cycles
This site's touch probe and manual work-zero guides cover setting zero for a job. Homing switches solve a related but different problem: giving the machine a fixed, repeatable machine zero it can find on its own every time it powers on, so it always knows exactly where it is in its work envelope before you tell it where your material is. A surprising number of desktop CNC routers, including many stock Wolfpawn 4040 Pro configurations, ship with homing switches uninstalled or disabled by default. This guide covers wiring them properly, configuring GRBL's homing behavior, and running a homing cycle safely.
Why Homing Switches Matter
Without homing switches, GRBL has no idea where the machine physically is when it powers on — it just assumes wherever the gantry happens to sit is position (0,0,0) in machine coordinates. That's fine as long as you always jog to a known reference point and zero manually before every job, but it means there's no safety net if you forget, and no way for the machine to reliably return to the same physical location (useful for tool changes, resuming an interrupted job, or reusing a fixture) across power cycles. Homing switches give you a fixed, physical machine origin that's independent of where the gantry happened to be sitting when you flipped the power on.
Switch Types
| Type | How it works | Pros | Cons |
|---|---|---|---|
| Mechanical microswitch | Physical lever trips a normally-open or normally-closed contact | Cheap, simple, easy to diagnose with a multimeter | Wears mechanically, repeatability drifts slightly over thousands of cycles, susceptible to dust/chips jamming the lever |
| Inductive proximity sensor | Non-contact sensing of a metal target via induced eddy currents | No mechanical wear, very repeatable, dust-tolerant | More expensive, needs a metal flag/target, most run on 12-24V and need a level shifter or relay to interface with 5V/3.3V controller inputs |
| Optical (slot) sensor | A flag breaks an infrared beam between emitter and receiver | No contact, very precise trigger point | Sensitive to dust and swarf blocking the beam, needs careful mounting |
For a hobby-grade router cutting wood, plastics, and light aluminum, mechanical microswitches are the practical default — they're what most kits ship with, and their repeatability (typically within a few thousandths of an inch) is more than adequate for homing purposes, where you're establishing a reference point, not a finish-cut tolerance.
Wiring: Normally Closed vs Normally Open
Wire limit switches normally closed (NC) whenever the switch and wiring support it, not normally open (NO). With an NC circuit, the controller sees a closed loop during normal operation; if a wire chafes through, a connector works loose, or a switch physically fails, the circuit opens and GRBL immediately reports a triggered limit — a wiring fault fails safe. With an NO circuit, the same failure just looks like the switch never trips, and GRBL has no way to distinguish "switch never approached" from "switch or wiring broken." Wire all axis switches on each end in series into a single NC loop per axis (or a single shared input if you're not using per-axis limit inputs), landing on the controller's limit pins with a pull-up resistor enabled.
Key GRBL Settings ($ Parameters)
| Setting | Purpose | Typical value |
|---|---|---|
| $20 | Soft limits enable — blocks G-code moves that would exceed the configured work area | 1 (on), requires homing to be enabled first |
| $21 | Hard limits enable — triggers immediate alarm/stop when a limit switch trips | 1 (on) |
| $22 | Homing cycle enable | 1 (on) |
| $23 | Homing direction invert mask — sets which corner (which direction per axis) the machine homes toward | Machine-specific, set based on where your switches are physically mounted |
| $24 | Homing feed rate (the slow, precise final approach) | 25-100 mm/min |
| $25 | Homing seek rate (the fast initial approach before the precise pass) | 500-1000 mm/min, lower on smaller machines |
| $26 | Homing debounce delay, filters switch bounce/noise | 250 ms default is usually fine |
| $27 | Homing pull-off distance — how far GRBL backs off the switch after triggering, before starting the job | 1-5 mm |
| $5 | Limit pin invert mask — must match your NC/NO wiring choice or homing will never trigger, or trigger immediately | Set to match wiring; 1 for NC wired with pull-ups |
GRBL's homing cycle typically runs each axis in a defined order (often Z first, to lift the bit clear of the work before X/Y move), seeking each switch at the faster $25 rate, backing off, then re-approaching slowly at $24 for a precise trigger point, before pulling off by $27 and calling that position machine zero. Exact ordering and per-axis behavior varies slightly by GRBL version and by sender (gSender exposes most of these settings through a GUI settings page rather than requiring raw $-command entry, which is worth using if you're not comfortable with the command-line interface).
Commissioning Checklist
- With power off, verify continuity through each switch and its wiring with a multimeter before connecting anything to the controller — confirm NC behavior (continuous, opens on trip) matches your $5 setting.
- Mount switches so the gantry can't physically crash into the switch itself or its mounting bracket past the trigger point — add a few millimeters of mechanical travel margin beyond the electrical trigger.
- Jog manually toward each switch at a slow feed rate the first time, ready to hit the e-stop, and confirm the controller reports the alarm/limit state the instant contact is made.
- Run
$Hto home once wiring is confirmed. If the machine drives away from the switch instead of toward it, invert the corresponding bit in $23 rather than rewiring. - After a successful home, jog to a known feature (like a corner of the spoilboard) and confirm the machine coordinate display matches what you'd expect, to catch a mis-set pull-off distance or backwards axis.
Safety Note
Homing switches are a positioning aid, not a substitute for hard e-stop wiring or for staying near the controls during the first homing cycle after any wiring change. A mis-wired or mis-configured limit switch can cause the machine to drive well past its mechanical travel before anything intervenes — keep a hand near the e-stop or power switch for the first several homing cycles on a new or modified setup, in line with the general CNC safety practices covered elsewhere on this site.