G29 - Bed Leveling

calibration Probe the bed and enable leveling compensation AUTO_BED_LEVELING_(3POINT|LINEAR|BILINEAR|UBL)|MESH_BED_LEVELING


When you build Marlin you have the option to include one of 5 different bed leveling systems. Each leveling system comes with its own set of options and makes G29 behave differently, so documentation for these G-codes is divided up into 5 separate pages.

Mesh-based Leveling

Mesh leveling measures the height of the bed at several points to generate a 3D mesh representing bed imperfections. With compensation enabled, the nozzle follows the bed contours by dynamically adjusting the Z position (using bilinear interpolation between the measured points). The nozzle follows the contours of the bed more accurately with more mesh points and/or finer segmentation of moves.

  • Mesh Bed Leveling provides an economical interactive manual mesh-based leveling system for small boards or machines without a probe. Marlin provides a UI but an LCD controller is not required.

  • Auto Bed Leveling (Bilinear) provides mesh-based bilinear leveling, either with or without a probe (but not both).

  • Unified Bed Leveling provides mesh-based bilinear leveling with partial probing and many options to fit a mesh to the whole bed. Planar (matrix) operations can be applied to the mesh data, but active compensation is mesh based.

Matrix-based Leveling

With matrix-based leveling the height of the bed is measured at three points, or in a grid, to generate a rotation matrix. This matrix is used to rotate points in 3D space relative to the tilt of the bed. So if you print an object on a tilted surface the entire object is tilted. This system assumes the bed is perfectly flat, so it is most suitable for high end machines.