Table of Contents
Engage with Marlin and the BLTouch! Check out this step-by-step tutorial on how to set up Marlin auto bed leveling.
How to Set Up Marlin Auto Bed Leveling
Hands off, please.
Leveling the bed is one of the more time-consuming aspects of preparing a 3D print job. Manual leveling is a pain, as it necessitates numerous adjustments near all of a printer’s hot parts. That’s probably why automatic bed leveling (ABL) became so popular quickly. After installing and configuring a sensor, the nozzle starts at the proper height over the entire bed without the need for operator intervention.
If you’re running Marlin firmware, setting it up for auto bed leveling can be a tangled mess.
We’ve got a good, in-depth tutorial on the issue for anyone who isn’t familiar with altering and flashing firmware. Meanwhile, one critical insight is that comments play an essential role in the configuration process:
In the Marlin code, a commented line starts with two slashes: /
A line with two slashes at the beginning will be ignored.
When there are no slashes on a line, it is active code.
Let’s get started now that we have a better understanding of what to expect while adjusting firmware. Using the BLTouch as an example sensor, we’ll walk you through configuring Marlin to operate with your ABL sensor in this post. (There may be minor variances if you’re using a different device.)
How to Set Up Marlin Auto Bed Leveling
Before We Get Started
As a general warning, any changes to your firmware may have unintended and unfavorable repercussions, including hardware damage. As a result, always make a backup of a working configuration and proceed with caution and understanding.
The modifications will be made to Marlin’s “Configuration.h” file. The firmware package contains a folder with example setups for various popular 3D printers in case you need a starting point.
In Marlin, auto bed leveling takes up around a fifth of the configuration file, wandering through some portions and skipping others. There may be some significant gaps between critical portions. Still, we’ll identify landmarks along the road to help you keep on track.
How to Set Up Marlin Auto Bed Leveling
Electrical Configurations
Endstops
About a fourth of the way through Configuration.h, under “Endstop Settings,” we begin our voyage. We’re going to specify some electrical properties for the Z sensor here.
Because most 3D printer microcontrollers include inbuilt pull-up resistors, you probably won’t need to worry about these “ENDSTOPPULLUP” lines unless you’re having sensing troubles. If that’s the case, uncomment them.
The “ENDSTOPINVERTING” lines specify whether the triggered sensor produces a high or low signal. If you have an NPN-type sensor, the rule of thumb is to set “Z MIN PROBE ENDSTOP INVERTING” to true. Set both “Z MIN PROBE ENDSTOP INVERTING” and “Z MIN ENDSTOP INVERTING” to false for a PNP-type sensor. A moving pin probe, such as the BLTouch, would be set to false.
Before you start moving your bed or extruder assembly, ensure that your sensor indeed detects proximity. That way, if you make a mistake, it shouldn’t be a big deal.
The Z Probe
After that, we’ll jump forward a bit until we get to the Z probe possibilities. This is where we define the sensor’s electrical and mechanical characteristics.
First, we must provide the location of the probe’s connection. If the sensor has its own dedicated port, remove the comment from “Z MIN PROBE USES Z MIN ENDSTOP PIN” and replace it with the pin number. If it replaces an end-stop, that line would be commented, and “Z MIN PROBE ENDSTOP” would be uncommented instead.
“FIX MOUNTED PROBE” is uncommented a little farther down if the sensor has no moving parts. If your probe contains a servo mechanism that swings an arm, the servo port and the Deploy and Stow angles are the following options: uncomment and set.
The BLTouch’s settings are simple. Simply remove the BLTouch line from the code. Unless you’re having problems with the pin getting caught or being inconsistent, you don’t need to modify the delay.
Finally, starting with the probing heaters line, we arrive at a section dedicated to diagnosing difficulties such as vibration and configuring unusual devices. As a general rule, if you aren’t sure why you need to go there, you shouldn’t.
How to Set Up Marlin Auto Bed Leveling
Set everything in its proper location.
We’re still at the “Probe Options” section, but there’s one more stop to make. In Marlin auto bed leveling, one of the things we need to look at is some ASCII art that determines how to depict the location of the nozzle and sensor about one other. The message here is that the X and Y offset values will be negative if your sensor is in front or to the left of the printer’s nozzle.
Measure from the nozzle’s point to the sensor’s center to get the X and Y values. Make every effort to be accurate. You can also set Z to 0 for now and fill it in later, or you can keep it at 0 and save the value to your controller’s memory after setting the Z offset.
“PROBING MARGIN 10” should also be investigated. It should be uncommented already, but double-check that 10 mm is adequate space from your bed’s edge. (By lowering this value, you can level out more of the bed’s surface area.)
Then a few lines are skipped (about the speed of probing and how many times the sensor probes a spot). There should be some default positions for rest, stepper motor and servo settings, and other defaults that function well in most cases. You can make changes later if you like, but none of it is necessary right now.
On your LCD panel, there’s also a repeatability test that you don’t have to enable.
Note: Examine the comments as you progress through Configuration.h in your Marlin auto bed leveling adventure to see if they relate to your scenario. Defaults are where you should be in the majority of circumstances.
We’ve now exhausted our probe possibilities. Until we get to “Bed Leveling,” nothing else matters to us.
Adjusting the height of the bed
Next, we’ll establish the bed leveling pattern and protocol.
Suppose you’re confident that your bed is completely flat with no warps or uneven patches. In that case, you might use “AUTO BED LEVELING 3POINT” or “AUTO BED LEVELING LINEAR.” If you’re not sure, Marlin auto bed leveling has a feature called “AUTO BED LEVELING BILINEAR” that allows you to compensate. In the meantime, “AUTO BED LEVELING UBL” is a similar but more complex tool that enables you to produce a mesh diagram of your bed’s high and low portions.
Linear and bilinear would be good alternatives for most people. (Watch this video to learn how to level a mesh bed manually.) Make sure your method of choice is uncommented.
The G28 instruction returns your printer’s carriage to its home position, which is the final step before printing begins. The issue is that issuing a G28 clears all of the leveling data that has been accumulated. As a result, “#define RESTORE LEVELING AFTER G28” must be uncommented.
After the first layer or two, your model’s layers should be unaffected by your bed. Because of this, the variable “ENABLE LEVELING FADE HEIGHT” is left uncommented. The default number is 10, which should be sufficient. (With small prints, a lower value may be more evident.)
A bed test called the “Mesh Validation Tool” prints a grid of squares across your bed. When you enable it, the option appears in your LCD display. If you utilize it, you’ll also need to adjust your filament’s layer height, nozzle diameter, and temperature settings.
Settings for a Deeper Bed
The grid is then defined by the number of X and Y points. A 3 Ă— 3 grid is standard for a square bed, although a rectangular grid might be made by adding a row or column. The Y value (rows) is set to the X value (columns) by default, but you can configure each individually with alternative numbers. Just keep in mind that as the number of points grows, so does the size of the program your controller must run, which could cause a crash.
Now we’ll establish the boundaries for how far our probe can go without going over the edge or colliding with something. Uncomment each line and input the X or Y values for the minimum and maximum places.
Because an offset probe can’t go all the way from front to back or end to end, you’ll probably want to uncomment “EXTRAPOLATE BEYOND GRID” if you’re utilizing bilinear leveling. The following part allows you to explore a more advanced form of bilinear probing.
How to Set Up Marlin Auto Bed Leveling
Final Thoughts & Conclusions
Fortunately, there isn’t much else to do at this point. Things can stay very much the same in that region if you’re employing universal bed leveling. Mesh leveling is not an automatic procedure, as previously claimed. The only thing left to decide is whether you want your LCD menu to have more extensive leveling options. If this is the case, remove the comment from “#define LCD BED LEVELING.”
Finally, consider enabling the “BABYSTEP Z PROBE OFFSET” setting in “Configuration adv.h” as a side note. This allows you to fine-tune your Z-offset in micro-steps, making it more exact.
So we’ve reached the halfway point of the Configuration.h file in our Marlin auto bed leveling configuration journey.
There are several options to accommodate the differences between printers, probing methods, and probe gear, as many things are linked to Marlin and 3D printers in general. However, you should only be concerned with the sections that apply to your case. Configuring Marlin auto bed leveling is a simple operation if you understand your equipment and go through the choices carefully.
Let us know in the comments below or on our Facebook page to let us know your ideas, and we would appreciate seeing pictures of your works of art!