No matter how well you constrain, tighten, and align the components of your 3D printer there are bound to be imperfections in alignment that can negatively affect your print quality. Among these issues, irregularities in bed-nozzle distance is one of the most problematic. After all, if the first layer doesn’t adhere to the bed then the rest of the print job is moot.
Marlin includes a “Bed Leveling” feature that compensates for these imperfections by taking measurements of the bed-nozzle distance at 3 or more points and then adjusting the nozzle position throughout the print so that it remains at a consistent distance from the bed.
Marlin allows you to take these bed measurements using nothing but a piece of paper, but for an improved experience the best option is to install a bed probe (also called a “Z probe”).
Marlin supports a wide variety of probe types:
- Simple switch
- Nozzle probe
- Switch on a servo arm
- Switch on a solenoid
- Inductive probes
- BLTouch - and clones
- Sled-mounted probe
- Allen-key delta probe
- No probe
Bed Leveling Methods
Marlin includes various methods of probing and leveling:
- 3-Point probes a triangle to determine the height and tilt of the bed plane. During printing the nozzle is adjusted in X, Y, and Z, so you can even print on a badly-tilted bed. However, this method requires a very flat and even surface.
- Linear Grid probes a square grid (as much as possible on
DELTA) to determine the height and tilt of the bed. After that it works just the same way as 3-point leveling.
- Bilinear Grid probes a grid in the same manner as Linear Grid, but during printing the Z axis is adjusted according to bilinear interpolation between the measured points. This allows the printer to compensate for an uneven surface,
- Mesh Bed Leveling works in the same manner as Bilinear Grid but takes different
G29parameters. (This feature is superseded by combining the manual probe option with bilinear leveling, and will not be included in future versions of Marlin.)
- Unified Bed Leveling combines elements of bilinear and planar leveling and includes extra utilities to help improve measurement accuracy, especially for deltas. See this page for an article specifically about this feature.
1. Z Probe Pin
Before configuring any bed probe be sure to read its documentation and the documentation for your electronics. Make sure you know to which pins the probe will be connected. Marlin provides reasonable defaults, but they will not apply to every situation.
In general, on deltabots the probe should be connected to the unused Z-Min endstop pin (if there is one). On machines that use Z-min for an endstop, the Z-Max pin is recommended next, so this is set as the default alternative on most boards.
- If the probe is connected to the Z-Min pin, enable
- For Marlin 126.96.36.199 and earlier, if the probe is connected to any other pin, enable
- The probe-specific pin is defined with
Z_MIN_PROBE_PIN. Most boards have a default, but it can be overriden in the configuration.
2. Probe Type
What kind of probe do you have?
Use this option for a fixed switch or inductive probe.
Use this option if the nozzle itself is used as the probe.
Endstop switches are inexpensive, and some printer kits include one or two replacement parts. So one popular probe type mounts an endstop switch on a servo-driven arm. Set this option to
0 for a servo-probe connected to the first servo plug,
1 for the next servo plug, etc. Set the servo’s deployed/stowed angles with the
Select this option for a switch mounted on a solenoid.
The BLTouch by ANTCLABS is a compact probe specifically designed for use on inexpensive 3D printers. It uses a Hall effect sensor to detect the movement of a metal pin that can be magnetically extended and retracted. The BLTouch connects to the servo pins which function to send commands to the probe.
This is a switch mounted on a “sled” that can be docked to the end of the X axis. The X carriage can pick up this sled, use it to perform probing, and put it back when done.
This is a popular solution on deltas. A spare Allen key is used with an endstop switch to make a probe that’s deployed and stowed by turning the key 90 degrees. You can either deploy and stow the key manually or configure movements that bump the key against some fixed point. Options for this type of probe are included in the delta example configurations that come with Marlin.
The bed-nozzle distance can be measured without a probe by following a
manual procedure. The nozzle moves to each point and pauses. You adjust the Z height so that the nozzle is touching the bed. Once the Z height is adjusted, you tell the machine to go to the next point. Continue until all points are probed. This option can be used with all Auto Bed Leveling options except UBL, which is freestanding.
3. Other Probe Options
LCD_BED_LEVELINGprovides a guided process to assist with
PROBE_MANUALLY(or Mesh Bed Leveling). Without this option you must send
G29to move to the next point and
G1(or buttons in your host software) to adjust the Z axis.
Z_MIN_PROBE_ENDSTOP_INVERTINGshould be set to
trueif your probe uses normally-open (NO) switches. Normally-closed switches are recommended because they have the appropriate failsafe state and are less prone to false positives.
ENDSTOPPULLUP_ZMIN_PROBEmay be used if you need to disable the endstop pullup for some reason, such as having an external pull-down resistor on a normally-open switch.
USE_ZMAX_PLUGmust be enabled if the probe is connected to the Z-Max endstop pin.
USE_ZMIN_PLUGmust be enabled if the probe is connected to the Z-Min endstop pin. Et cetera, et cetera.