CNC Router — GRBL Command Reference
cncgrblgcodecommandsreferenceugscncjs1c3d
Markdown
CNC Router — GRBL Command Reference
GRBL is the firmware on most desktop CNC routers. This is a quick reference for the commands you'll use at the console and the GCode you'll see in toolpaths.
GRBL Real-Time Commands
These work immediately, even mid-job — send directly from UGS or CNCjs console:
| Command | Action |
|---|---|
~ | Resume from feed hold / pause |
! | Feed hold — pause the job |
? | Status report (position, state) |
Ctrl+X | Soft reset — emergency stop, keep position |
$X | Kill alarm lock after emergency stop |
$H | Home all axes (if homing enabled) |
$HX | Home X axis only |
GRBL Settings ($ commands)
| Setting | Description | Example |
|---|---|---|
$0 | Step pulse time (μs) | $0=10 |
$1 | Step idle delay (ms) | $1=25 |
$2 | Step port invert mask | $2=0 |
$3 | Direction port invert | $3=4 |
$5 | Limit pin invert | $5=0 |
$10 | Status report mask | $10=1 |
$11 | Junction deviation | $11=0.010 |
$20 | Soft limits enable | $20=1 |
$21 | Hard limits enable | $21=0 |
$22 | Homing enable | $22=1 |
$23 | Homing direction invert | $23=0 |
$24 | Homing feed rate | $24=25 |
$25 | Homing seek rate | $25=500 |
$27 | Homing pull-off | $27=1 |
$100 | X steps/mm | $100=40 |
$101 | Y steps/mm | $101=40 |
$102 | Z steps/mm | $102=200 |
$110 | X max rate (mm/min) | $110=3000 |
$111 | Y max rate | $111=3000 |
$112 | Z max rate | $112=500 |
$120 | X acceleration | $120=200 |
$121 | Y acceleration | $121=200 |
$122 | Z acceleration | $122=50 |
$130 | X max travel | $130=400 |
$131 | Y max travel | $131=400 |
$132 | Z max travel | $132=90 |
$30 | Max spindle speed (RPM mapping) | $30=1000 |
$31 | Min spindle speed | $31=0 |
$32 | Laser mode enable | $32=0 |
Common GCode Commands
| GCode | Description |
|---|---|
G0 X10 Y10 | Rapid move to X10 Y10 |
G1 X10 Y10 F500 | Linear move at 500mm/min |
G2 X10 Y0 I5 J0 | Clockwise arc |
G3 | Counterclockwise arc |
G17 | XY plane (default) |
G20 | Inch mode |
G21 | Millimeter mode |
G28 | Home axes |
G90 | Absolute positioning |
G91 | Relative positioning |
G92 X0 Y0 Z0 | Set current position as origin |
M3 S10000 | Spindle on clockwise at 10000 RPM |
M4 S10000 | Spindle on counterclockwise |
M5 | Spindle stop |
M8 | Coolant on |
M9 | Coolant off |
Zeroing Workflow
; Jog to desired XY origin
G92 X0 Y0 ; Set XY zero here
; Jog Z to material surface
G92 Z0 ; Set Z zero at surface
; Return to origin and begin job
G0 X0 Y0
G0 Z5 ; Safe height clearance
Troubleshooting GRBL
| Symptom | Check |
|---|---|
| Steps missing (position drift) | Acceleration too high — reduce $120/$121 |
| Machine won't home | Homing not enabled ($22=1), or limit switch wiring |
| Spindle doesn't run | Check M3 command, $30 setting, PWM wiring |
| Alarm on connect | Send $X to kill alarm, then $H to home |
| Position wrong after reset | Always home after power cycle or reset |