G29
is most commonly used without any arguments. This uses the defaults set in Configuration.h
.
- G0-G1: Linear Move
- G2-G3: Arc or Circle Move
- G4: Dwell
- G5: Bézier Cubic Spline
- G6: Direct Stepper Move
- G10: Retract
- G11: Recover
- G12: Clean the Nozzle
- G17-G19: CNC Workspace Planes
- G20: Inch Units
- G21: Millimeter Units
- G26: Mesh Validation Pattern
- G27: Park toolhead
- G28: Auto Home
- G29: Bed Leveling
- G29: Bed Leveling (3-Point)
- G29: Bed Leveling (Linear)
- G29: Bed Leveling (Manual)
- G29: Bed Leveling (Bilinear)
- G29: Bed Leveling (Unified)
- G30: Single Z-Probe
- G31: Dock Sled
- G32: Undock Sled
- G33: Delta Auto Calibration
- G34: Z Steppers Auto-Alignment
- G34: Mechanical Gantry Calibration
- G35: Tramming Assistant
- G38.2-G38.5: Probe target
- G42: Move to mesh coordinate
- G53: Move in Machine Coordinates
- G54-G59.3: Workspace Coordinate System
- G60: Stored Positions
- G61: Return to Saved Position
- G76: Probe temperature calibration
- G80: Cancel Current Motion Mode
- G90: Absolute Positioning
- G91: Relative Positioning
- G92: Set Position
- G425: Backlash Calibration
- M0-M1: Unconditional stop
- M3: Spindle CW / Laser On
- M4: Spindle CCW / Laser On
- M5: Spindle / Laser Off
- M7-M9: Coolant Controls
- M10-M11: Vacuum / Blower Control
- M16: Expected Printer Check
- M17: Enable Steppers
- M18, M84: Disable steppers
- M20: List SD Card
- M21: Init SD card
- M22: Release SD card
- M23: Select SD file
- M24: Start or Resume SD print
- M25: Pause SD print
- M26: Set SD position
- M27: Report SD print status
- M28: Start SD write
- M29: Stop SD write
- M30: Delete SD file
- M31: Report Print Time
- M32: Select and Start
- M33: Get Long Path
- M34: SDCard Sorting
- M42: Set Pin State
- M43: Debug Pins
- M43 T: Toggle Pins
- M48: Probe Repeatability Test
- M73: Set Print Progress
- M75: Start Print Job Timer
- M76: Pause Print Job Timer
- M77: Stop Print Job Timer
- M78: Print Job Stats
- M80: Power On
- M81: Power Off
- M82: E Absolute
- M83: E Relative
- M85: Inactivity Shutdown
- M86: Hotend Idle Timeout
- M87: Disable Hotend Idle Timeout
- M92: Set Axis Steps-per-unit
- M100: Free Memory
- M102: Configure Bed Distance Sensor
- M104: Set Hotend Temperature
- M105: Report Temperatures
- M106: Set Fan Speed
- M107: Fan Off
- M108: Break and Continue
- M109: Wait for Hotend Temperature
- M110: Set / Get Line Number
- M111: Debug Level
- M112: Full Shutdown
- M113: Host Keepalive
- M114: Get Current Position
- M115: Firmware Info
- M117: Set LCD Message
- M118: Serial print
- M119: Endstop States
- M120: Enable Endstops
- M121: Disable Endstops
- M122: TMC Debugging
- M123: Fan Tachometers
- M125: Park Head
- M126: Baricuda 1 Open
- M127: Baricuda 1 Close
- M128: Baricuda 2 Open
- M129: Baricuda 2 Close
- M140: Set Bed Temperature
- M141: Set Chamber Temperature
- M143: Set Laser Cooler Temperature
- M145: Set Material Preset
- M149: Temperature Units
- M150: Set RGB(W) Color
- M154: Position Auto-Report
- M155: Temperature Auto-Report
- M163: Set Mix Factor
- M164: Save Mix
- M165: Set Mix
- M166: Gradient Mix
- M190: Wait for Bed Temperature
- M191: Wait for Chamber Temperature
- M192: Wait for Probe temperature
- M193: Wait For Laser Cooler Temperature
- M200: Volumetric Extrusion Diameter
- M201: Print / Travel Move Limits
- M203: Set Max Feedrate
- M204: Set Starting Acceleration
- M205: Set Advanced Settings
- M206: Set Home Offsets
- M207: Firmware Retraction Settings
- M208: Firmware Recover Settings
- M209: Set Auto Retract
- M210: Homing Feedrate
- M211: Software Endstops
- M217: Filament swap parameters
- M218: Set Hotend Offset
- M220: Set Feedrate Percentage
- M221: Set Flow Percentage
- M226: Wait for Pin State
- M240: Trigger Camera
- M250: LCD Contrast
- M255: LCD Sleep/Backlight Timeout
- M256: LCD Brightness
- M260: I2C Send
- M261: I2C Request
- M280: Servo Position
- M281: Edit Servo Angles
- M282: Detach Servo
- M290: Babystep
- M300: Play Tone
- M301: Set Hotend PID
- M302: Cold Extrude
- M303: PID autotune
- M304: Set Bed PID
- M305: User Thermistor Parameters
- M306: Model Predictive Temp. Control
- M350: Set micro-stepping
- M351: Set Microstep Pins
- M355: Case Light Control
- M360: SCARA Theta A
- M361: SCARA Theta-B
- M362: SCARA Psi-A
- M363: SCARA Psi-B
- M364: SCARA Psi-C
- M380: Activate Solenoid
- M381: Deactivate Solenoids
- M400: Finish Moves
- M401: Deploy Probe
- M402: Stow Probe
- M403: MMU2 Filament Type
- M404: Filament Width Sensor Nominal Diameter
- M405: Filament Width Sensor On
- M406: Filament Width Sensor Off
- M407: Read Filament Width
- M410: Quickstop
- M412: Filament Runout
- M413: Power-loss Recovery
- M420: Bed Leveling State
- M421: Set Mesh Value
- M422: Set Z Motor XY
- M423: X Twist Compensation
- M425: Backlash compensation
- M428: Home Offsets Here
- M430: Power Monitor
- M486: Cancel Objects
- M493: Fixed-Time Motion
- M500: Save Settings
- M501: Restore Settings
- M502: Factory Reset
- M503: Report Settings
- M504: Validate EEPROM contents
- M510: Lock Machine
- M511: Unlock Machine
- M512: Set Passcode
- M524: Abort SD print
- M540: Endstops Abort SD
- M569: Set TMC stepping mode
- M575: Serial baud rate
- M592: Nonlinear Extrusion Control
- M593: ZV Input Shaping
- M600: Filament Change
- M603: Configure Filament Change
- M605: Multi Nozzle Mode
- M665: Delta Configuration
- M665: SCARA Configuration
- M666: Set Delta endstop adjustments
- M666: Set dual endstop offsets
- M672: Duet Smart Effector sensitivity
- M701: Load filament
- M702: Unload filament
- M710: Controller Fan settings
- M808: Repeat Marker
- M810-M819: G-code macros
- M851: XYZ Probe Offset
- M852: Bed Skew Compensation
- M860-M869: I2C Position Encoders
- M871: Probe temperature config
- M876: Handle Prompt Response
- M900: Linear Advance Factor
- M906: Stepper Motor Current
- M907: Trimpot Stepper Motor Current
- M908: Set Trimpot Pins
- M909: Report DAC Stepper Current
- M910: Commit DAC to EEPROM
- M911: TMC OT Pre-Warn Condition
- M912: Clear TMC OT Pre-Warn
- M913: Set Hybrid Threshold Speed
- M914: TMC Bump Sensitivity
- M915: TMC Z axis calibration
- M916: L6474 Thermal Warning Test
- M917: L6474 Overcurrent Warning Test
- M918: L6474 Speed Warning Test
- M919: TMC Chopper Timing
- M928: Start SD Logging
- M951: Magnetic Parking Extruder
- M993: Back up flash settings to SD
- M994: Restore flash from SD
- M995: Touch Screen Calibration
- M997: Firmware update
- M999: STOP Restart
- M7219: MAX7219 Control
- T0-T7: Select or Report Tool
- T?-Tx: MMU2 Special Commands
Description
Automatic (Linear) Bed Leveling probes the bed in a grid and enables bed leveling compensation using a matrix to compensate for bed tilt, applying a “least-squares” approximation.
The printer must be homed with G28
before G29
.
Automatic Probing
Using an electronic probe Marlin can probe the entire grid with a single G29
command. See parameter descriptions and examples below for details.
Manual Probing
Click for Details
Auto Bed Leveling now includes a PROBE_MANUALLY
option for systems lacking a probe.
PROBE_MANUALLY
adds these parameters to G29
:
-
Q
: Query leveling andG29
state -
A
: Abort current leveling procedure
To do manual probing simply repeat G29
until the procedure is complete.
The first G29
accepts the same parameters , shown in the Usage section below. The exact parameters available will depend on which style of bed leveling is enabled. (Note: UBL parameters are not covered on this page unless they coincide. See the G29
for UBL page for a full list of its options.)
Before probing the bed:
- Use
G29 Q
to get the current status. IfG29
isn’t idle, abort withG29 A
. - Use
M420 V
to view leveling data. You can sendM420 S1
to use the existing data.
To probe the bed using G-code:
- Use
G29
to move to the first point for Z adjustment. - Adjust Z so a piece of paper can just pass under the nozzle.
- Use
G29
to save the Z value and move to the next point. - Repeat steps 3-4 until completed.
- Use
M500
to save the leveling data to EEPROM, if desired.
To probe the bed using your LCD controller: (Requires LCD_BED_LEVELING
)
- Select the
Level Bed
sub-menu, then chooseLevel Bed
(notCancel
). - Wait for
Homing XYZ
to complete. - When
Click to Begin
appears, press the controller button to move to the first point. - Use the controller wheel to adjust Z so that a piece of paper can just pass under the nozzle.
- Press the controller button to save the Z value and move to the next point.
- Repeat steps 4-5 until completed.
- Use
Control
>Store memory
to save the mesh to EEPROM, if desired.
Notes
- Any arguments left out of
G29
will use the default values set inConfiguration.h
. - By default
G28
disables bed leveling. FollowG28
withM420 S
to turn leveling on.- With
ENABLE_LEVELING_AFTER_G28
leveling will always be enabled afterG28
. - With
RESTORE_LEVELING_AFTER_G28
leveling is restored to whatever state it was in beforeG28
.
- With
- To save time and machine wear, save your matrix to EEPROM with
M500
and in your slicer’s “Starting G-code” replaceG29
withM420 S1
to enable your last-saved matrix. - For multi-axis machines (
I_DRIVER_TYPE
defined) without implementation of inverse kinematics, bed leveling produces wrong results while the toolhead is not oriented vertical and perpendicular to the bed and must be turned off withM420 S0
Usage
G29 [A<bool>] [B<linear>] [C<bool>] [D<bool>] [E<bool>] [F<linear>] [H<linear>] [J<bool>] [L<linear>] [O] [P<int>] [Q<bool>] [R<linear>] [S<rate>] [T<bool>] [V<0-4>] [X<int>] [Y<int>]
Parameters
[A<bool>] | Abort leveling procedure in-progress ( |
[B<linear>] | Set the back limit of the probing grid. |
[C<bool>] | Create a fake grid for testing. ( |
[D<bool>] | Dry-Run mode. Just probe the grid but don’t update the bed leveling data |
[E<bool>] |
|
[F<linear>] | Set the front limit of the probing grid. |
[H<linear>] | Set the square width and height of the area to probe. |
[J<bool>] | Jettison the leveling data stored in SRAM and turn off leveling compensation. Data in EEPROM is not affected. |
[L<linear>] | Set the left limit of the probing grid. |
[O] | Optional. If leveling is already enabled then exit without leveling. (1.1.9) |
[P<int>] | Set the size of the square grid that will be probed - P x P points |
[Q<bool>] | Query the current leveling state ( |
[R<linear>] | Set the right limit of the probing grid. |
[S<rate>] | Set the XY travel speed between probe points. |
[T<bool>] | Generate a Bed Topology Report |
[V<0-4>] | Set the verbose level. Level 2 and up act like ‘T’. |
[X<int>] | Set the number of columns (in X) that will be probed. |
[Y<int>] | Set the number of rows (in Y) that will be probed. |
Examples
Automatic Probing examples
Probe a 5x5 matrix.
Probe a 4x8 matrix from X50
Y50
to X150
Y150
, printing a full report.
Manual Probing example
Each G29
command goes to the next step until the whole procedure is done. The V1
parameter provides a progress report.