G30 G-code

G-code icon

G30 means “move the probe until it hits something in the Z axis”.

On CNC Mills

On CNC mills it can be used to:

  • Find where the workpiece is located in the Z dimension
  • Find the length of a newly inserted tool
  • Find the touch point between a tool and the workpiece

On 3D Printers

On a 3D printer it can be used to:

  • Find the touch point of the bed and actuator
  • Calibrate Delta machines
  • Automatically level beds with unequal heights

To probe in other axes like X and Y, see the G38.2 and G38.3 G-codes.

Format

The command is used as such:

G30

Which means: move (in the Z axis) until the probe is triggered, then report what distance was traveled.

You can also do:

G30 Z10

Which means: move (in the Z axis) until the probe is triggered, then set the current Z position to 10 (using G92 Z10).

This is useful for example if you want to use the probe to measure the distance between something else on the actuator and what is touched, and you know the distance between the probe’s height and that thing’s height.

It is also possible to specify a speed at which to move with:

G30 F100

Parameters

Parameter Usage Example
Z Once the probe hits, set the Z position to this value G30 Z0
F Move at this speed in millimeters/minute G30 Z10 F100

Feedrate

The F parameter sets the movement speed for this move.

It sets the speed only for this specific move and is not modal.

It temporarily overrides the configuration option, see zprobe.

Configuration

This command is configured via the Zprobe module’s options.

V1 Zprobe Configuration:

The basic zprobe settings include:

  • - Enable the probe module
  • - Pin where the probe sensor is connected
  • - Probing speed (mm/sec)
  • - XY travel speed between probe points
  • - Height above bed for rapid XY moves
  • - Maximum probe travel distance

Example V1 configuration:

zprobe.enable                true
zprobe.probe_pin             1.28!^
zprobe.slow_feedrate         5
zprobe.fast_feedrate         100
zprobe.probe_height          5
zprobe.return_feedrate       0
zprobe.max_z                 200

V2 Zprobe Configuration:

V2 uses INI-style configuration with additional options for advanced probing behavior:

[zprobe]
enable                = true
probe_pin             = 1.28!^
slow_feedrate         = 5
fast_feedrate         = 100
probe_height          = 5
return_feedrate       = 0
max_z                 = 200
debounce_ms           = 0
reverse_z             = false
dwell_before_probing  = 0
nist_G30              = false

Key V2 Settings:

  • - Enable the probe module
  • - Pin where the probe sensor is connected
  • - Probing speed (mm/sec)
  • - Debounce time (NEW) for noisy signals
  • - (NEW) Pause before probing (useful for piezo probes)
  • - (NEW) Probe upward instead of downward
  • - (NEW) Enable NIST-compliant G30 behavior

Further reading

These resources are used as references for Gcode:

This is a wiki! If you'd like to improve this page, you can edit it on GitHub.