INTRODUCTION:
G28 is a command used in CNC programming to return the machine to its reference point often called the "home" position. The reference point is a fixed position on the machine, set by the manufacturer. It is used for calibration and as a safe position for tool changes.
How G28 works:
G28 moves the machine to the reference point
via an intermediate point. The intermediate point is specified in the G28 command. The machine will move from its current position to the intermediate point, and then from the intermediate point to the reference point.
Syntax: G28 X_ Y_2_;
where X, Y, Z specify the intermediate point.
But note: The intermediate point can be specified in absolute (G90) or incremental (G91) mode. The current modal state (G90 or G91) affects how the intermediate point is calculated.
e.g. G90 G28 X100.0 Y50.0 Z0
From current position, it goes to (X100, Y50, Z0) and from that location it goes to Home Position with rapid.
However, as discussed, using G28 in G90 mode (absolute) can be dangerous because the intermediate point is specified in the current work coordinate system. This is why it is safer to use G28 in G91 mode (incremental) so that the intermediate
point is relative to the current position.
Use G91 (incremental mode) with G28 so that the intermediate point is the current position plus the specified increments. If you specify 0, then the current position becomes the
intermediate point, and the machine mnoves directly to the reference point from the current position.
How it is used
• Individual axis returns:G91 G28 Z0 ; Return Z-axis to home first (safest!)
G91 G28 X0 Y0 ; Then return X and Y to home
Why do we do Z first? Because the Z axis is often the one that can crash into the workpiece or fixtures. By retracting Z first, we avoid collisions.
• All axes simultaneously
G91 G28 X0 Y0 Z0 ; Return all axes at once
All axes move together - ensure clearance!
• With clearance move first (extra safe)
G00 Z100.0 ; Rapid to safe height
G91 G28 Z0 ; Then return Z to home
G91 G28 X0 Y0 ; Then X and Y
Where we use it?
• End of program cleanupG00 Z100.0 ; Clearance move
G91 G28 Z0 ; Z home
G91 G28 X0 Y0 ; X and Y home
M30 ; Program end
• Tool Change Positioning
G91 G28 Z0 ; Go to Z home (tool change height)
M06 T02 ; Change to tool #2
• Mid-Program Repositioning
... cutting operations ...
G91 G28 Z0 ; Retract for inspection
M00 ; Optional stop
... resume ...
• Warm-Up/Startup Routine
G28 ; Home all axes
G04 P2000 ; Dwell for warm-up
Dangerous situations occurs during use of G28:
• Wrong coordinate modeG90 G28 X0 Y0 Z0 ; crash! Goes to work zero first
Always use G91 with G28!
• Intermediate point in fixture
G28 X50.0 Y50.0 ; Goes through X50,Y50 (might hit clamps!)
• Forgetting Z clearance
G91 G28 X0 Y0 ; X/Y move while tool is still in part!
Always retract Z axis first.
How it is different from G30 and G53?
G28 commands tool to primary reference point medium with G91. While G30 is secondary reference point medium. And G53 machine coordinate move high.G30 - second reference point
G91 G30 Z0 ; Go to second reference often tool change position
It is similar to G28 but different location. Often used for pallet changers, tool changers.
G53 - direct machine move
G53 G00 Z0 ; CRASH RISK! Moves to machine Z zero
Avoid unless you know exactly what you're doing!
Let's discuss about use of G90 and G91 in G28:
• In absolute mode (G90):
G28 X0 YO ZO would mean the intermediatepoint is absolute (0,0,0) in the current coordinate system (which could be work offset, so part zero). This is dangerous because it might cause a crash if the part zero is below the table.
• In incremental mode (G91):
G28 Z0 means move an incremental distance of 0 in the Z-axis, so the intermediate point is the current Z position. Then it goes to the Z home. Similarly, G28 X0 YO in incremental mode means the current X and Y are the intermediate points. So, the common practice is to use incremental mode with G28 to set the intermediate point as the current position, so the machine moves directly to the home position from the current position, but viathe current position (so no extra move). This is safebbecause it doesn't try to go through absolute zero of the work coordinate system.
The safest and most common way to send the machine home at the end of a program is:
G91 G28 ZO (first move Z to home, because Z is the most critical to clear)
G91 G28 X0 YO (then move X andY to home)
Why incremental? Because in G91, the G28 command interprets the given coordinates as relative to the current position. So, G91 G28 Z0 means use the current Z position as the intermediate point, then go to Z home. This ensures that the machine moves directly to the Z home without going to any other absolute position.
If you were in G90 (absolute) and you said G28 Z0, then the intermediate point would be at Z0 in the current coordinate system (which is usually the part zero). This could be very low and cause a crash if the machine tries to go through that point to get to the home position.
Let me show you an example:
Suppose you are at Z-5.0 (in the part) and you want to go to machine home in Z (which is at the top of the travel).
If you use G90 G28 ZO:
The intermediate point is Z0 (work zero, whick is the top of the part). So it goes from Z-5.0 to Z0 (rapid) and then to machine Z home. This might be acceptable if Z0 is above the part, but if Z0 is set to the part top, then it's only 5mm above the part and then it goes to home. Not necessarily a crash, but not as safe because if there is a fixture, it might hit.• If you use G91 G28 ZO:
The intermediate point is current Z (Z-5.0) plus 0, so Z-5.0. Then it goes from Z-5.0 to the machine Z home. This is a direct move from the current position to the home position, which is safe and efficient. However, note that some machines have a parameter that changes the behavior of G28. But the above is the standard.e.g.
How G90 G28 works?
G54 G00 X100. Y50. Z-10. (Cutting position)
G90 G28 X0 Y0 Z0 (absolute mode return)
What happens:
Machine reads G90 (absolute coordinates)
Machine reads G28 X0 Y0 Z0
Machine interprets: Go through intermediate point (X0,Y0,Z0) in work coordinates, then to machine home.
CRASH! Machine tries to go to work zero (part surface) before going home
Z0 might be below fixtures/tool holder!
How G91 G28 works:
G54 G00 X100. Y50. Z-10. (Cutting position)G91 G28 Z0 (incremental mode return)
What happens:
Machine reads G91 (incremental coordinates)
Machine reads G28 Z0
Machine interprets: Current position (Z-10) is the intermediate point, go directly to Z machine home.
SAFE! Goes straight up to Z home from current position
It's straight line from current position to safe height!
So, the best practice is to use G91 with G28 to return home safely.
Let me write the typical end of program:
M5 (spindle stop)
G91 G28 ZO (return Z to home)
G91 G28 X0 YO (return X and Y to home)
M30 (program end)
Alternatively, you can use:
G28 G91 ZO (same as above, but note that G91 is modal, so it stays in incremental until changed). If you are in G90 (absolute) mode at the start of the program, you must switch to incremental for the G28. Hence, the G91 before G28.
We are clarifying the use of G28 and G53 for machine coordinates and G54-G59 for work coordinates.
Let's break it down:
1. Use G53 when you want to move in machine coordinates but be cautious because it's absolute to the machine and can cause crashes. It is non-modal and must be used on every line you want in MCS. You can use G53 in absolute machine coordinate but you must know the exact safe positions.
e.g. G53 GO0 X0 YO Z0 (will move to the
machine's zero point)
G53 G00 X100.0 ; move to absolute machine coordinate X100.0
It could crash into table/fixtures!
G53 X50 Y50 Z50 will move the tool to the point (50, 50, 50) in the machine's coordinates.
Use G53 for moving to known safe positions like tool change height and special machine functions.
2. G28 is used to return to the machine's reference point (home), and it uses an intermediate point for safety. It is often used at the end of a program to send the machine home, which is a safe point for tool changes, etc.
e.g. G91 G28 X0 Y0 Z0 ; Return to machine home via intermediate point
G91 G28 Z0 ; Safer: Return Z to home
G91 G28 X0 Y0 ; Then X and Y to home
Use G28 for end of program cleanup, tool change positions, moving out of the way for maintenance.
3. G54-G59 are used to select the work coordinate system (WCS). Once set, all coordinates are relative to that WCS. Use it for all your part programming.
Always use work coordinates. This defines where your part is.
e.g. G54 G00 X0 Y0 Z100.0 ; Move to part zero + clearance
G55 X50.0 Y30.0 ; Switch to second fixture offset
G56 ; Third part location
G54 X50 Y50 Z50 will move the tool to the
point (50, 50, 50) in the work coordinate system.
Use G54-G59 for all part programming, multiple parts on table and different setups.
e.g.
% (Program start)
O1234 (Program number)
(1) SAFETY LINE (Always start with this)
G17 G20 G40 G49 G54 G80 G90 G94
(Note: G54 is in safety line - ALWAYS use work coordinates!)
(2) MOVE TO SAFE POSITION
G54 G00 X0 Y0 Z100.0 ← USING WORK COORDINATES!
Z5.0
(3) DO YOUR CUTTING
G01 Z-5.0 F100
... (all cutting here) ...
(4) CLEANUP AND GO HOME
G00 Z100.0 ← Still in work coordinates
G91 G28 Z0 ← NOW use G28 to return Z to machine home
G91 G28 X0 Y0 ← Then X and Y to machine home
M30 ← Program end
%
Golden rule for beginners: start every cutting move with G54 and end every program with G28. Forget G53 exists until you're an expert.
0 Comments