Back to the Gcode Dictionary
This command can be used without any additional parameters.
- X Flag to home the X axis
- Y Flag to home the Y axis
- Z Flag to home the Z axis
- U, V, W, A, B, C, D Flags to home additional axes that may have been created
This command may not be used within a homing file.
G28 ; Home all axes
G28 XZ ; Home the X and Z axes
The X and Z parameters in this example act only as flags. Any coordinates given are ignored. For example, G28 Z10 results in the same behavior as G28 Z. Delta printers cannot home individual axes, but must always home all three towers, so the X Y Z parameters are simply ignored if the Firmware is in Delta mode.
The purpose of homing is to move the specified axes in such a way as to establish a known position for them, for example by moving an axis motor until an endstop switch is triggered. Homing an axis normally leaves it in a fixed position, however this position needs not be the zero position.
The way in which each axis is homed is completely configurable using the homing macro files, which specify what actions are taken. Execution of the G28 command is as follows:
- If there are no G28 parameters that correspond to axes that exist, or if the printer is a delta, then all axes are to be homed. Otherwise, the axes to be homed are determined by enumerating parameters of the G28 command.
- Each axis or delta tower to be homed is flagged as "position not known".
- If all axes or towers are to be homed, the file homeall.g is processed, except that on a delta printer homedelta.g is processed. If this process results in some but not all axes become flagged as "position known", an attempt will be made to home the remaining axes as if the G28 command had listed those axes.
- For each remaining axis flagged as "to be homed" the appropriate homing file is executed (homex.g, homey.g, homez.g etc.).
For Cartesian printers that use a Z probe to home Z instead of an endstop it is sensible to setup the homeall.g with the XY axes to home first, then move the carriage to a safe position –usually the middle of the bed– where it can safely probe downward to home Z. For an example see Configuring RepRapFirmware for a Cartesian printer.
Neither homeall.g nor any other homing file may itself contain a G28 command, however it may use a M98 command to invoke another homing file.
Because the behaviour of G28 can be complex, it is recommended to consider the printer actions carefully before including G28 in your ending GCode. On a Cartesian or CoreXY it could result in colliding with the printed object. An alternative to move the carriage at the completion of a print is to use G0 or G1.