
CNC Limit Switches and Homing: Setup Types and Why They Matter
You can cut without homing, but you need a reliable way to establish the work position. Homing restores a machine reference after startup; it does not locate clamps, recover lost steps automatically or make a toolpath collision-proof.
Table of Contents
- The Most Skipped Step That Saves Your Machine
- What Homing Actually Does
- Homing vs Limit Switches: Same Hardware, Two Purposes
- The Hardware: Four Approaches
- Repeatability: What Actually Matters
- NC vs NO: Normally Closed vs Normally Open
- GRBL Homing Settings Reference
- Dual Endstops for Auto-Squaring
- Soft Limits: Your Safety Net
- Tool Probing and Z Work Zero
- What We'd Buy
- Parts for this guide
- Homing Sequence Flowchart
- Related Reading
The Most Skipped Step That Saves Your Machine
You can cut without homing, but you need a reliable way to establish the work position. Homing restores a machine reference after startup; it does not locate clamps, recover lost steps automatically or make a toolpath collision-proof.
Homing uses switches to establish machine coordinates. Work offsets locate the job within those coordinates. After a reset or power loss, home again and verify the work and tool offsets before resuming.
This guide covers the hardware, the types, and how to actually use them with GRBL.
What Homing Actually Does
A homing sequence:
- The axis searches toward its switch at the configured homing seek rate
- The switch triggers, the axis backs off and re-approaches at the locating rate; GRBL establishes machine coordinates and pulls off the switch
- If $20=1 and the travel settings are correct, soft limits check commanded motion against the machine envelope
An open-loop controller loses its trustworthy physical position after power loss or skipped steps. Re-home to restore machine coordinates, then verify the work offset and tool reference before restarting. Homing once does not preserve position through an outage.
Homing vs Limit Switches: Same Hardware, Two Purposes
The same switch can serve dual purposes:
- Homing: Finding the machine's zero reference point
- Limit: Preventing over-travel by stopping motion before crashing
GRBL can share switches between homing and hard limits. Homing is enabled with $22; hard-limit monitoring requires $21=1. A hard-limit trigger stops motion and raises an alarm, after which position may need to be restored by homing.
The Hardware: Four Approaches
1. Mechanical Endstops (Microswitches)
A little lever-actuated switch. Most common in hobby CNC. You hit it with a moving block or flag, the switch closes/opens, the machine knows it's at a limit.
Advantages:
- Cheap: $2-5 per switch
- Reliable when properly mounted, wired and protected from interference
- No electronics needed: just wire to controller
- Repeatability depends on the switch, actuator, mounting and homing speed
- Choose a sealed switch suitable for the dust or coolant exposure; exposed contacts and mechanisms can be contaminated
Disadvantages:
- Physical contact required: the carriage has to move far enough to actually hit the switch
- Requires mechanical design: you need a actuator arm or flag
- Space constraints: takes up room to mount
Best for: builds that can provide a rigid actuator and protected switch mounting
2. Optical Endstops
Light beam interrupted = signal. No mechanical contact.
Advantages:
- Non-contact: no wear
- Consistent: good repeatability if mounted carefully
- Fast response
- Can be very compact
Disadvantages:
- Slightly more expensive: $5-15 per sensor
- Requires alignment that keeps the flag reliably inside the sensor's specified detection zone
- Dust and moisture can affect light path
- Need power/signal wiring (not just two-wire switch)
Best for: Clean environments, very compact builds, retrofits where mechanical space is tight.
3. Inductive Proximity Sensors
Detects metal without contact; sensing range depends on the target material and sensor
Advantages:
- A suitably sealed sensor tolerates dust and coolant, but nearby metal or chips can affect detection
- No contact wear; follow the chosen sensor's environmental and electrical ratings
- Repeatability must be checked for the selected sensor, target and approach direction
- Can be mounted behind non-metal surfaces
- Fast response
Disadvantages:
- More expensive: $8-20 per sensor
- Requires power supply (12V or 24V typical)
- Non-ferrous metals can be detected too, often at a shorter range; use the sensor's target specifications
- Check the sensor's response time against approach speed and available stopping distance
Best for: Wet environments, dirty shops, machines running long hours where switch wear is a concern, production machines where tight repeatability is mandatory.
4. Hall Effect Sensors
Detects a magnet's field and can be used for linear or rotary position sensing
Advantages:
- Non-contact, non-optical
- Reliable
- Small
Disadvantages:
- Needs a securely mounted magnet and suitable sensing geometry
- Less common in hobby setups
Hall switches can home linear axes when the magnet, sensing distance and controller interface are designed together.
Repeatability: What Actually Matters
A homing switch's repeatability is how close to the same position it stops each cycle. This is different from accuracy (how close to the true zero).
Mechanical endstop: measure repeated homing on your machine; mount stiffness and actuator geometry matter
Optical endstop: verify repeatability with the actual flag and keep the optical path clean
Inductive sensor: verify repeatability with the intended target, gap and approach direction
Here's the practical truth: if your repeatability is 0.2mm and your cutting tolerance is 0.1mm, you have a problem. If your repeatability is 0.2mm and your tolerance is 1mm, you're fine. Know your requirements before upgrading.
NC vs NO: Normally Closed vs Normally Open
Switches come in two flavors:
NC (Normally Closed): Switch is "on" when not triggered, "off" when pressed.
- With correct NC input polarity and hard limits enabled, an open circuit is detected as a limit condition
- An NC circuit can reveal open wires, but it does not detect every fault and is not a safety-rated stop system
NO (Normally Open): Switch is "off" when not triggered, "on" when pressed.
- If the wire breaks → machine doesn't know about the limit
- Dangerous: broken wire means lost limit detection
Use the switch logic supported by your controller. NC wiring can detect open wires; with stock GRBL's direct switch inputs it normally requires $5=1. Verify the input state and trigger response before moving the machine.
GRBL Homing Settings Reference
GRBL uses these parameters ($word format):
$22 = 1 (Enable homing)
$23 = 0 (Homing direction; 0=negative, 1=positive)
$24 = 25 (Homing seek velocity, mm/min)
$25 = 500 (Homing feed velocity, mm/min)
$26 = 250 (Homing debounce, milliseconds)
$27 = 1.0 (Homing pull-off, mm)What these mean:
- $22=1: Enable homing. If 0, homing commands are ignored.
- $23: Homing direction invert mask. 0 searches positive on all axes; 3 reverses X and Y; 7 reverses X, Y and Z. Check axis directions before homing.
- $24: Homing feed rate in mm/min, used for the slower final locating approach.
- $25: Homing seek rate in mm/min, used for the initial switch search.
- $26: Homing debounce delay in milliseconds, used between homing phases; it is not a general hard-limit noise filter.
- $27: Pull-off distance. After homing, back away from the switch this many mm. Prevents the carriage from binding against the switch.
Dual Endstops for Auto-Squaring
Independent homing of paired motors can square a gantry. GRBL 1.1h offers an optional compile-time dual-axis mode for X or Y; the controller wiring, driver outputs and firmware configuration must support it.
Each side stops at its own switch during homing. The gantry returns to the alignment set by those switch positions; adjust and measure that alignment first.
Requirements:
- Separate drivers and switches for the paired motors, wired to the selected firmware's pin map
- GRBL board with dual-axis support (custom GRBL firmware or compatible controller)
- Mechanical design that allows independent motor control
Dual homing can restore a calibrated gantry alignment after startup or loss of position
Check the exact firmware build. GRBL 1.1h added optional dual-motor self-squaring, disabled in the default build; compatible grblHAL or FluidNC systems are other options. Verify motion-controller support before assuming Mach3 can square independently.
Soft Limits: Your Safety Net
After homing, $20=1 checks commanded targets against the configured machine envelope. Set and verify $130, $131 and $132 for X, Y and Z travel.
A move beyond the configured envelope triggers a soft-limit response. Moves inside that envelope can still hit stock, clamps or the table if the toolpath or offsets are wrong.
Enable soft limits after verifying homing, machine coordinates and all three travel settings.
Tool Probing and Z Work Zero
A touch plate locates the tool relative to a known surface and can set a work offset. It does not establish the machine's complete Z travel envelope or replace a homing reference for soft limits.
Common workflow:
- Home the required axes using the controller's configured homing cycle
- Position the tool safely above the touch plate on the stock
- Run the probe cycle against the connected plate and account for its measured thickness
- Set work offset from there
Use probing after homing to set the job's Z reference, or after a tool change as required by the workflow. Omitting a Z home switch requires a deliberately configured controller strategy and does not give stock GRBL valid Z soft limits automatically.
A Z home switch and a tool probe complement each other: one establishes machine reference, the other the tool's work reference.
What We'd Buy
For a new build: Mechanical NC (normally closed) limit switches with good lever arms to ensure positive contact. Budget $15-20 for a complete 3-axis set.
For demanding work: choose a sensor with documented repeatability under your target and environmental conditions, then verify the installed machine
For retrofits: Whatever fits your existing frame geometry. Mechanical is almost always the easiest retrofit.
Parts for this guide
If you are buying after reading this, these are the specs to look for.
| Part | What to buy | Where to look |
|---|---|---|
| Mechanical homing switches The builder needs a repeatable physical reference for each homed axis. | Three sealed SPDT snap-action switches with accessible COM and NC contacts, lever geometry suited to the machine and a contact rating suitable for the controller's low-current inputs; more switches if dual homing is planned. | |
| Shielded endstop cable The switch runs need reliable connections routed away from spindle and motor wiring. | Flexible shielded two-core 0.25 mm2 signal cable for passive switches; choose continuous-flex construction where it runs in a drag chain and terminate the shield per the controller manual. | |
| Adjustable switch brackets The builder needs to set switch positions and calibrate paired gantry references. | Rigid slotted brackets sized for the selected switch mounting holes, with locking hardware and adjustable actuator stops. | |
| Dial indicator and rigid stand The reader needs to measure actual repeated homing before relying on it for returning to a job. | Metric 0.01 mm graduation plunger indicator with a rigid mount suited to the machine bed, for comparison measurements rather than a claimed absolute accuracy. |
"Search" buttons open a search for that exact spec, so compare listings against it before buying. Some links earn us a commission at no extra cost to you (disclosure).