Back to the Gcode Dictionary
G30: Single Z-Probe
- G30 [Pnnn] [Xnnn] [Ynnn] [Znnn] [Hnnn] [Snnn]
- Pnnn Probe point number
- Xnnn X coordinate
- Ynnn Y coordinate
- Znnn Z coordinate
- Hnnn Height correction
- Snnn Set parameter
- Kn (supported in RRF 3.01-RC5 and later only, default 0) Z probe number
- G30 ; Probe the bed at the current XY position. When the probe is triggered, set the Z coordinate to the probe trigger height.
- G30 S-1 ; Probe the bed at the current XY position. When the probe is triggered, do not adjust the Z coordinate, just report the machine height at which the probe was triggered.
- G30 S-2 ; Probe the bed at the current XY position. When the probe is triggered, adjust the Z offset of the current tool to make the current position Z=0.
- G30 S-3 ; Probe the bed and set the Z probe trigger height to the height it stopped at (supported in RRF 2.03 and later)
- G30 P0 X20 Y50 Z-99999 ; Probe the bed at X20 Y50 and save the XY coordinates and the height error as point 0
- G30 P3 X180 Y180 Z-99999 S4 ; Probe the bed at X180 Y180, save the XY coordinates and the height error as point 3 and calculate 4-point compensation or calibration
- G30 P3 X180 Y180 Z-99999 S-1 ; As previous example but just report the height errors
Caution: the XY coordinates are permitted to be outside the normal printable bed area! This is intentional, because some printers (e.g. delta printers) benefit from probing areas not used for printing.
G30 without a P parameter
This probes the bed starting at the current height. Depending on the value of the S parameter it can be used to home the Z axis, to measure the Z probe trigger height, or to adjust the Z offset of the current tool.
G30 with a P parameter
This is used for operations that are performed after the printer has been homed and that require the height error at more than one probe point to be measured. These operations are typically performed in the bed.g file. With a Z parameter of -9999 or less, the head moves to the specified XY coordinates and the dive height (set using the H parameter in the M558 command), and probes the bed.
On the last G30 command in the sequence, the S parameter indicates that a complete set of points has been probed and instructs the firmware what sort of calibration to perform. If the value is -1 then the Z offsets of all the points probed are printed, but no calibration is done. If the value is zero or not present, then this specifies that the number of factors to be calibrated is the same as the number of points probed. Otherwise, the value indicates the number of factors to be calibrated, which must be no greater than the number of points probed. From version 1.09, the number of factors may be 3, 4 or 5 when doing old-style auto bed compensation on a Cartesian or CoreXY printer, and 3, 4, 6, 7, 8 or 9 when doing auto calibration of a Delta printer.
See Calibrating a Delta Printer, setting up the bed.g file for a more detailed explanation.
If a "normal" Z parameter is given instead of -9999 or lower, then the bed is not probed, but instead that value is used as if the Z probe had triggered at that height.
The optional H parameter is a height correction for that probe point. It allows for the Z probe having a trigger height that varies with XY position. The nominal trigger height of the Z probe (e.g. at bed centre) is declared in the Z parameter of the G31 command in the config.g file. When you probe using G30 and the probe triggers, the firmware will assume that the nozzle is at the nominal trigger height plus the value you have in the H parameter.