G28 and G30 are essential CNC commands for returning the machine to predefined home positions using safe intermediate points. While G28 returns axes to the machine’s primary home (zero-return) position, G30 provides up to four additional home positions for advanced workflows. These commands are crucial for safe machine movement, tool changes, robotic loading, automated pallet changers, clearance moves, and any situation where the machine must avoid fixtures or tall parts. Mastering G28 and G30 is a key skill for professional CNC programmers in 2025.
1. What G28 Does
G28 returns the machine to machine home, but only after passing through a safe midpoint.
Syntax:
G28 X# Y# Z#
Example:
G28 Z0.
This moves Z upward through a safe point, then sends it to machine Z home.
Important:
The programmed coordinate is NOT the destination—it is the intermediate point.
2. Safe Movement Example (Standard Practice)
To retract safely before tool change:
G28 G91 Z0.
G90
This is the industry-standard safe retract method because:
- It switches to incremental mode (G91)
- Moves Z up to a safe point
- Then homes Z completely
Used millions of times every day.
3. What G30 Does
G30 returns axes to secondary home positions.
Most machines support:
- G30 P1 (Home #1)
- G30 P2 (Home #2)
- G30 P3 (Home #3)
- G30 P4 (Home #4)
These positions are programmable in machine parameters.
Perfect for:
- Robot load position
- Pallet change retract
- Probe park location
- Fixture clearance zone
- Secondary tool change location
Example:
G30 P2 Z0.
Returns Z to home position #2.
4. Real Example — Multi-Level Safe Moves
Using G30 for automation clearance:
(After machining OP10)
G30 P2 Z0.
(Go to robot load height)
(After robot loads next part)
G30 P1 X0. Y0.
This ensures consistent robotic handoff height.
5. Combining G28/G30 for Safe Axis Sequencing
For tall fixtures or large parts:
G28 Z0. (Raise Z first)
G28 X0. (Then move X)
G28 Y0. (Finally Y)
Never retract all axes simultaneously when part is tall.
6. G91 Trick for Safe, Predictable Behavior
Best practice:
G91 G28 Z0.
G91 G28 X0. Y0.
G90
This avoids unpredictable paths caused by absolute home references.
7. Advanced Example — Using G30 for Probe Parking
Before running heavy roughing operations:
G30 P3 Z0.
(Probe moves to safe parked location)
This eliminates probe crashes.
8. G30 for Dual-Pallet Systems
During pallet change:
G30 P2 Z0. (Tool out of the way)
M60 (Pallet change command)
G30 P1 Z0. (Return to machining start location)
Excellent for horizontal machining centers.
9. Common Mistakes & Fixes
Mistake: Moving to home directly without safe point
G28 X0 Y0
→ Tool may crash into part
Fix:
Use G91 G28 Z0 first.
Mistake: Forgetting to switch back to G90
Always return to absolute mode after G91 moves.
Mistake: G30 home positions not set correctly
Must be configured in machine parameters.
Mistake: Calling G28 with XYZ active simultaneously
Raises crash risk in crowded work zones.
10. Best Practices for 2025 CNC Shops
- ALWAYS retract Z before X/Y
- Use G30 positions for special equipment
- Park probes and fixtures with G30 P3/P4
- Use G28 in G91 mode for safe, predictable retracts
- Never home directly from inside deep pockets
- Use G30 for robot-attended machines
11. Pro-Level Example — Full Safe Retract Sequence
G91
G28 Z0.
G28 X0. Y0.
G90
T2 M06
G30 P2 Z0.
(Go to dual home for next operation)
This is professional-level CNC safety programming.
12. Summary
G28 and G30 are essential commands for safe and intelligent machine motion. G28 returns axes to machine home using a safe intermediate point, while G30 provides up to four customizable home positions for automation, probing, and fixture clearance. In 2025’s automated CNC environment, using G28/G30 correctly prevents crashes, protects tooling, and ensures stable machine workflows.
Leave a comment