Building a Fully Functional GRBL CNC with Limit Switches, Probe & Spindle Control
GRBL is a powerful open-source firmware for CNC routers and laser cutters.
In this guide, we’ll take a basic GRBL machine and upgrade it to full functionality with:
- Limit switches for homing and soft limits
- Touch probe for automatic Z-zero
- PWM spindle control for automatic on/off and speed
📌 1. Wiring Limit Switches
Use normally-open (NO) or normally-closed (NC) mechanical switches for each axis.
Example Wiring:
- X-min → GRBL pin D9
- Y-min → GRBL pin D10
- Z-min → GRBL pin D12
Recommended: NC wiring for better noise immunity.
📌 2. GRBL Homing Configuration
Enable homing in GRBL by setting:
$22=1 (Enable homing cycle)
$23=3 (Set homing direction mask)
$27=5 (Homing pull-off in mm)
Run homing:
$H (Homing command)
Result: Machine moves to all limit switches, establishes machine zero.
📌 3. Adding a Z Probe
Connect probe plate to A5 input pin.
Use a magnetic alligator clip for tool contact.
G38.2 Z-20 F50 (Probe down up to 20 mm)
G10 L20 P1 Z15.0 (Set work offset with plate thickness)
Pro Tip: Add this as a macro in CNCjs or UGS for one-click probing.
📌 4. Spindle PWM Control
GRBL supports PWM spindle speed control on D11 (Arduino UNO).
Configuration:
$30=12000 (Max RPM)
$31=0 (Min RPM)
$32=0 (Disable laser mode)
To control spindle:
M3 S8000 (Turn on spindle at 8000 RPM)
M5 (Turn spindle off)
📌 5. Safety & Noise Filtering
- Use ferrite beads or shielded wires to avoid false limit switch triggers.
- Add debounce capacitors (0.1 µF) across switches for reliable homing.
- Always include an emergency stop switch in your setup.
📌 6. Recommended Hardware
| Component | Recommendation |
|---|---|
| Controller | Arduino Uno + CNC Shield v3 |
| Stepper Drivers | TMC2209 (quiet) or DRV8825 |
| Probe | 3D-printed probe plate or commercial touch probe |
| Spindle | 500W–1.5kW ER11 spindle kit with VFD |
📌 7. Workflow Example
- Power up, run $H homing cycle.
- Jog to part, run G38.2 probing macro.
- Load G-code program and start cycle.
- Machine automatically turns spindle on/off via M3/M5 commands.
📌 8. Future Upgrades
- Automatic Tool Changer (ATC) for GRBL using macros.
- Closed-loop steppers for missed step protection.
- WiFi control via ESP32 (FluidNC firmware).
✅ Conclusion
With homing switches, Z probe, and PWM spindle control configured, your GRBL machine becomes a professional-grade CNC router capable of repeatable, precise work.
This setup is the foundation for lights-out machining on hobby CNCs — and it’s 100% open-source.
Leave a comment