G29 - Bed Leveling (Automatic)
Description
ABL probes the bed at 3 or more points and enables bed leveling compensation. The exact procedure and method depends on the type of bed leveling chosen in Configuration.h:
AUTO_BED_LEVELING_3POINTprobes 3 points and uses a matrix to compensate for bed tilt.AUTO_BED_LEVELING_LINEARalso uses a tilt matrix but probes a grid and applies “least-squares.”AUTO_BED_LEVELING_BILINEARprobes a grid and produces a mesh to adjust Z across the bed.
The printer must be homed with G28 before G29.
- For
AUTO_BED_LEVELING_UBLsee G29 UBL and G26 Mesh Editing. - For
MESH_BED_LEVELINGsee the G29 MBL page.
Automatic Probing
With an electronic probe Marlin can probe the entire bed in a matter of seconds —even before every print— with a single G29 command. Available parameters depend on the style of leveling. See parameter descriptions and examples below for details.
Manual Probing
Auto Bed Leveling now includes a PROBE_MANUALLY option for systems lacking a probe.
PROBE_MANUALLY adds these parameters to G29:
Q: Query leveling andG29stateA: 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 Qto get the current status. IfG29isn’t idle, abort withG29 A. - Use
M420 Vto view leveling data. You can sendM420 S1to use the existing data.
To probe the bed using GCode:
- Use
G29to move to the first point for Z adjustment. - Adjust Z so a piece of paper can just pass under the nozzle.
- Use
G29to save the Z value and move to the next point. - Repeat steps 3-4 until completed.
- Use
M500to save the leveling data to EEPROM, if desired.
To probe the bed using your LCD controller: (Requires LCD_BED_LEVELING)
- Select the
Level Bedsub-menu, then chooseLevel Bed(notCancel). - Wait for
Homing XYZto complete. - When
Click to Beginappears, 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 memoryto save the mesh to EEPROM, if desired.
Mesh Editing
AUTO_BED_LEVELING_BILINEAR adds these parameters to G29 for editing mesh points:
WWrite a mesh point. (Ignored during leveling.)IX index for mesh pointJY index for mesh pointXlogical X of mesh pointYlogical Y of mesh pointZZ to store in mesh. If omitted, current raw Z.
Notes
Any arguments left out of G29 will use the default values set in Configuration.h.
G28 disables bed leveling. Follow with M420 S to turn leveling on, or use RESTORE_LEVELING_AFTER_G28 to automatically keep leveling on after G28.
Parameters
G29
[A<bool>]
[B<linear>]
[C<bool>]
[D<bool>]
[E<bool>]
[F<linear>]
[J<bool>]
[L<linear>]
[O]
[P<int>]
[Q<bool>]
[R<linear>]
[S<rate>]
[T<bool>]
[V<0|1|2|3|4>]
[W<bool>]
[X<int/float>]
[Y<int/float>]
[Z<float>]
[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 ( |
[J<bool>]
|
(Without |
[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|1|2|3|4>]
|
Set the verbose level
|
[W<bool>]
|
Write a mesh Z offset ( |
[X<int/float>]
|
|
[Y<int/float>]
|
|
[Z<float>]
|
Specify the Z offset when setting a mesh value ( |
Examples
Automatic Probing examples
G29 ; execute ABLG29 is most commonly used without any arguments. This uses the defaults set in Configuration.h.
G29 P5 ; 5x5 matrixProbe a 5x5 matrix. (AUTO_BED_LEVELING_LINEAR)
G29 X4 Y8 L50 R150 F50 B150 T V4Probe a 4x8 matrix from X50 Y50 to X150 Y150, printing a full report. (AUTO_BED_LEVELING_LINEAR)
Manual Probing example
G29 V1 ; Ready! Go to Point 1, wait...
G29 V1 ; Store Z, go to Point 2, wait...
G29 V1 ; Store Z, go to Point 3, wait...
G29 V1 ; Store Z, go to Point 4, wait...
G29 V1 ; Store Z, go to Point 5, wait...
G29 V1 ; Store Z, go to Point 6, wait...
G29 V1 ; Store Z, go to Point 7, wait...
G29 V1 ; Store Z, go to Point 8, wait...
G29 V1 ; Store Z, go to Point 9, wait...
G29 V1 ; Store Z. Calculate matrix. Activate.Each G29 command goes to the next step until the whole procedure is done. The V1 parameter provides a progress report.