Disable Limit Switches on CNC and Laser with GRBL
On lightweight home CNC and diode lasers, limit switches are often the main cause of errors and malfunctions. Vibrations, dust, electrical interference, and cheap contacts generate false triggers that suddenly stop the machine during work.
With GRBL, physical limit switches are controlled by $21 (Hard limits). This guide shows you the correct configuration to permanently eliminate problems.
1. Disable physical limit switches (Hard Limits)
Parameter $21 controls Hard Limits: if active, GRBL immediately stops the machine at the slightest electrical signal from limit switch pins. To disable:
Send from serial console (LaserGRBL, UGS, Candle):$21=0
After this command, GRBL will completely ignore physical limit switches. No false trigger can stop the machine anymore.
2. Enable software limits (Soft Limits)
With hard limits disabled, you can still protect the machine from collisions using Soft Limits ($20). GRBL calculates position virtually and prevents commands outside the work area.
$20=1
Before enabling, set the work area correctly:
$130=300.0 (max X in mm)
$131=300.0 (max Y in mm)
$132=50.0 (max Z in mm, if present)
$20=1 and $21=0 ideal combination for lightweight CNCs.
3. The $23 parameter (Homing direction invert)
The $23 parameter has nothing to do with limit switch sensitivity or disabling. It only defines the movement direction during the homing cycle.
$23=0โ homing toward X-, Y-, Z- (default)$23=3โ homing toward X+, Y+
Leave the default value or change it only if the carriage moves in the wrong direction during homing.
GRBL parameters summary table
| Parameter | GRBL Name | Disable value | Enable value | Function |
|---|---|---|---|---|
$20 | Soft limits | 0 | 1 (recommended) | Software protection without physical sensors |
$21 | Hard limits | 0 (recommended) | 1 | Protection with physical limit switches (sensitive to interference) |
$22 | Homing cycle | 0 | 1 | Enables zero search at startup |
$23 | Homing dir invert | - | - | Inverts homing direction (no effect on triggers) |
Alternative: keep hard limits without false triggers
If you want to keep physical limit switches active ($21=1), reduce false triggers with:
- Software debounce:
$26=250(250ms filter on bounces) - 100nF capacitor on limit switch pins to GND
- Shielded cables and good grounding
Send $$ in the console to see all current parameters.
Quick troubleshooting checklist
- โ
First solution:
$21=0+$20=1 - ๐ Check cables and connectors (oxidation, breaks)
- ๐งน Clean limit switches from dust and debris
- ๐ Mechanical alignment and tight fasteners
- โก Check electrical interference (motors, inverters)