G29 - Bed Leveling (Unified)
Description
The Unified Bed Leveling System (UBL) provides a comprehensive set of resources to produce the best bed leveling results possible.
See the full Unified Bed Leveling documentation for more details. (Examples below.)
Notes
Requires AUTO_BED_LEVELING_UBL
.
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
.
It’s highly recommended to enable EEPROM. With EEPROM storage enabled, UBL is limited to 3-Point (G29 P0 T
) and Grid (G29 P0 G
) Leveling.
When you do a G28
and then a G29 P1
to automatically build your first mesh, you’ll notice that UBL probes increasingly far from the starting location. (The starting location defaults to the center of the bed.) Other grid leveling systems start in the corner and probe in a zigzag. UBL’s pattern is better for Delta machines, allowing for the center of the Mesh to be populated (and edited) more quickly. You can then do a small test print to check the mesh early in the process. You don’t need to populate the entire mesh to use it. You don’t want to spend a lot of time generating a mesh only to realize that the the resolution or M851 Z
probe offset is off. UBL mesh generation gathers points closest the nozzle unless you specify an (X,Y) coordinate pair.
UBL requires a decent amount of EEPROM to store its mesh data. And it takes some effort to get this Mesh data correct for a given machine. To keep this data from being destroyed when the EEPROM version changes the Mesh data is stored at the high end of the EEPROM. (Happily, no developers seem to mind.)
This system is built around Edward Patel’s “Mesh Bed Leveling” system. A big “Thanks!” to him and to the creators of 3-Point and Grid Based leveling. Combining their contributions we now have the functionality and features of all three systems combined.
Parameters
G29
[A<bool>]
[B<bool>]
[C<bool/float>]
[D<bool>]
[E<bool>]
[F<float>]
[H<float>]
[I<int>]
[J<int>]
[K<int>]
[L<int>]
[P<0|1|2|3|4|5|6>]
[Q<int>]
[R<int>]
[S<slot>]
[T<0|1>]
[U<bool>]
[V<0|1|2|3|4>]
[W<bool>]
[X<float>]
[Y<float>]
[A<bool>]
|
Activate
Unified Bed Leveling (i.e., |
[B<bool>]
|
Business Card mode (
|
[C<bool/float>]
|
|
[D<bool>]
|
Disable Unified Bed Leveling (i.e., |
[E<bool>]
|
Stow probe after probing |
[F<float>]
|
Fade height. (UBL only! For others use Fade the amount of Mesh Based Compensation over a specified height. At the specified height, no correction is applied and natural printer kenimatics take over. If no number is specified for the command, 10mm is assumed to be reasonable. |
[H<float>]
|
Height:
|
[I<int>]
|
Invalidate a number of mesh points (default 1).
|
[J<int>]
|
Grid (or 3-Point) leveling:
|
[K<int>]
|
Kompare: Subtract (diff) the stored mesh with the given index from the current mesh. This operates on the mesh in-memory, so it will probably make the active mesh unsuitable for printing. |
[L<int>]
|
Load a mesh. If no index is given, load the previously-activated mesh. The given mesh index will be used for subsequent Load and Store operations. |
[P<0|1|2|3|4|5|6>]
|
Phase:
The
|
[Q<int>]
|
Test Pattern. Load the specified Test Pattern to check for correct operation. This command is intended for developers and is not required for everyday bed leveling. |
[R<int>]
|
Repeat count. (Default
|
[S<slot>]
|
Save the mesh to EEPROM in the given slot.
|
[T<0|1>]
|
Topology: Include a Topology Map in the output.
|
[U<bool>]
|
Unlevel: Probe the outer perimeter to assist bed tramming. (Use with
|
[V<0|1|2|3|4>]
|
Verbosity Level (0-4) |
[W<bool>]
|
What?: Display valuable UBL data. |
[X<float>]
|
X position for all phases and commands (Default: current X) |
[Y<float>]
|
Y position for all phases and commands (Default: current Y) |
Examples
This is a minimal ‘quick-start’ sequence for set-up and initial probing of a UBL mesh on a machine that includes a display and z-probe
M502 ; Reset settings to configuration defaults...
M500 ; ...and Save to EEPROM. Use this on a new install.
M501 ; Read back in the saved EEPROM.
M190 S65 ; Not required, but having the printer at temperature helps accuracy
M104 S210 ; Not required, but having the printer at temperature helps accuracy
G28 ; Home XYZ.
G29 P1 ; Do automated probing of the bed.
G29 P2 B T ; Manual probing of locations. USUALLY NOT NEEDED!
G29 P3 T ; Repeat until all mesh points are filled in.
G29 T ; View the Z compensation values.
G29 S1 ; Save UBL mesh points to EEPROM.
G29 F 10.0 ; Set Fade Height for correction at 10.0 mm.
G29 A ; Activate the UBL System.
M500 ; Save current setup. WARNING - UBL will be active at power up, before any G28.
Use G26
and G29
commands to fine-tune a measured mesh
G26 C P T3.0 ; Produce mesh validation pattern with primed nozzle.
; NOTE - PLA temperatures are assumed unless you specify - e.g. - B 105 H 225 for ABS Plastic
G29 P4 T ; Move nozzle to 'bad' areas and fine tune the values if needed.
; Repeat G26 and G29 P4 T commands as needed.
G29 S1 ; Save UBL mesh values to EEPROM.
M500 ; Resave UBL's state information.
Use 3-point probe to ‘tilt’ a stored mesh; e.g. in your startup script
G29 L1 ; Load the mesh stored in slot 1 (from G29 S1)
G29 J ; No size specified on the J option tells G29 to probe the specified 3 points and tilt the mesh according to what it finds.