Guide: How to Calibrate an Auto Bed Leveling (ABL) Sensor

Several months ago I wrote an in-depth article on How to Setup Auto Bed Leveling which covered the entire process from start to finish… at least almost. This was my first time using auto bed leveling and I was still testing out various methods to calibrate the sensor, where I decided to leave this for a separate guide. At that point, none of the instructions I had found worked out and print jobs would embed plastic in to the build surface, needing to be replaced several times in the process.

As I was getting tired of buying more Build Tak stickers every other week, I went looking once again and stumbled across a video from 3D Maker Noob that seemed promising. Rather than try to adjust the sensor’s position by hand, he used a series of g-code commands to calibrate it with ease. Go figure, it took all of 5 minutes and my auto bed leveling sensor was near perfect.

Most of this guide will just reiterate the information he provides in the video, but several personal observations have been added as well. Once you understand it, auto bed leveling makes perfect sense, but most of the resources found online are either needlessly complicated or just plain wrong.


Before we can get started, we first need to grab some software that can communicate with the 3D Printer over USB. Most slicers have this feature built-in, but Cura seems to be the rare exception that lacks direct machine commands (despite otherwise being a complete printing solution). There are however several other tools I have linked below that will work just fine for our needs, where I would suggest Pronterface based on the simple, easy to use interface.

Repetier Host

As a third option, Simplify3D ($149) is exceptional software and my preferred slicer software of choice. It is however quite expensive and not worth the price tag for the average person, so unless you already own it, one of the free solutions above will be more than capable of getting the job done.

Calibrate Steps

Go ahead and connect the 3D Printer to your computer using a USB cable and power it on. Start up Pronterface (or whatever software you decide to use) and connect it to the machine. The Baud Rate will likely be set to the default of 115200 and the COM port will appear when the 3D Printer is connected, such as COM3.

Now our goal here is to find and set the proper Z-Offset for our nozzle, based on the position of the ABL sensor and where it triggers. The Z-Offset is an adjusted value, which raises or lowers the nozzle from the actual home position. So if we run “Auto Home” and the current nozzle position is at 0, a Z-Offset of -0.5mm would bring it closer to the bed.

It’s important to note that the Z-Offset value is not used when the printer auto homes (G28 command) or probes (G29 command) the bed, only during an actual print. This wasn’t documented anywhere and caused quite a bit of initial confusion on my part.

Step 1: Clear the Z-Offset

Since there may already be a pre-existing z-offset configured in the firmware or EEPROM, we will start by clearing out any current values and reset the offset to 0.00.

G28 Home the nozzle
M851 Z0 Set the z-offset to zero
M500 Store the settings to EEPROM
M501 Load the settings from EEPROM
M851 Echo the current z-offset value, make sure this reports Z0


Step 2: Move to Actual Z-Offset

When the Auto Bed Leveling (ABL) sensor is triggered, the firmware will raise the nozzle up by several millimeters. Since we want to work from the actual 0 z-offset, we need to re-position it at the point the sensor was triggered. To do this, we will use G1 F60 Z0, where G1 is the move command, F60 is the travel speed, and Z0 is where we are moving to.

G28 Z Home the nozzle on the Z axis
G1 F60 Z0 Move the nozzle down to the actual 0 offset


Step 3: Calibrate Z-Offset
Just like we are used to with manual bed leveling, go ahead and insert a piece of paper under the nozzle to test the distance. Using the movement controls in the software, start lowering the nozzle towards the build plate in increments of -0.1mm, until there is a slight drag on the paper when sliding it underneath. We will temporarily disable the software endstops, where that will allow us to go in to negative values on the Z axis while we calibrate the proper offset.

Once you are satisfied with the distance between the nozzle and the bed, make a note of the z-offset on the 3D Printer’s LCD screen, which should look something like “Z-0.5”. Now add the thickness of the paper you used to this value and that is your actual z-offset.

Note: A normal sheet of paper has an average thickness of 0.08mm. If your LCD screen reads Z-0.5, we would configure this as Z-0.58.

M211 S0 Turn OFF the Software Endstops
M851 Z-0.58 Set the z-offset value
M211 S1 Turn ON the Software Endstops
M500 Store the settings to EEPROM
M501 Load the settings from EEPROM

Start Script

Since we want the 3D Printer to use the auto bed leveling sensor and probe the surface before each print, we need to tell it to do so via the Start script. This is a list of G-code commands that it executes in order before the print can start. Open your preferred slicer software, locate the Start script and add the G29 probe command to it.

Cura: To access the Start script g-code in Cura, go to the Settings menu -> Printer -> Manage Printers. Select the desired printer in the list and click the Machine Settings button next to it. You will find the “Start G-Code” section in the bottom left.

Cura Start G-Code Script

Simplify3D: To access the Start script in Simplify3D, open the Process Settings -> Scripts tab -> Starting script tab.

S3D Start G-Code Script

Final Thoughts

As I am of the mindset “why fix what isn’t broken”, auto bed leveling always seemed like a solution for a problem that didn’t exist. Sure, it takes a few minutes to level the bed by hand, but I didn’t exactly understand what this feature was capable of. Until it was properly configured, it seemed to be a hindrance more so than anything, turning a simple process in to something complex.

Once it was setup and I eventually figured out how to calibrate the sensor, the benefits became much more apparent and it was a luxury I came to appreciate. While it of course reduces the frequency in which leveling is required, the real upside was the fact that it maps out the build surface when probing. In cases where the bed isn’t perfectly flat, it will use the generated mesh data to adapt and work around imperfections in the plate… something that manual bed leveling simply cannot do.

11 thoughts on “Guide: How to Calibrate an Auto Bed Leveling (ABL) Sensor

  1. Dear Brett,

    I have been suffering for days after I upgraded my 3D printer with 3D touch sensor, thanks to your excellent guide, I was able to properly configure it finally! (after tens of failed prints and many frustrations ). I appreciate your kind efforts in making this guide and sharing it with the rest of the planet.

    1. Hi Ihsan,

      That’s awesome! I’m glad to hear this helped get it sorted out.

      You’re definitely not the only one that has suffered through this. Despite being relatively knowledgeable with firmware, configuring and calibrating bed leveling sensors left me extremely confused. It wasn’t well documented and everything I found online seemed to be wrong. It took a lot of experimenting to figure out what worked, but that video I linked from Breaks n Makes was a great starting point.


    2. what I did not know is that a G28 command disables bed leveling. So, in your start Gcode in your slicer add M420 S1 right after the G28 command and before the G29 bed level command.

  2. Same as Ishan here. Thank you so much Brett !
    After a firmware update (where I just changed the MAX number of points for the ABL mesh), impossible for me to set the Z offset correctly again. I spent my entire evening yesterday trying to fix this, driving me nuts.
    In step 3, why do you switch off the Software Endstops (M211) before running the M851 command ?
    I understand that M211 is used to prevent motion outside a predefined boundary, but M851 is just changing a value in memory, it does not actually move the head. Does the M211 command here really do something ?

    1. Hi Michael,

      I wrote this guide a couple years ago, mostly as a reminder for myself when I have to do it again 🙂 The steps aren’t so fresh on my mind anymore, but the way I wrote that section is a tad confusing.

      For the second step “Set the Z-Offset value”, I think this was really meant to encompass all of the instructions above. It’s not just 1) turn off endstop 2) set the value and 3) turn endstop back on. The second step should also be figuring out the desired value as described in the preceding paragraphs. I will look at rewriting that part to make it more clear.


      1. I found your guide through a google search, and after checking further your website, I noticed that this guide is not to be seen in the “Posts” section. Maybe is it on purpose as it is older ? Anyway just wanted to let you know.

  3. Thank you for this fantastic article.
    One question: are you adding these commands to your start-up script, or storing them in the EEPROM from pronterface? My issue is that it doesn’t care at all what is in EEPROM, slices from cura 4.8 never take the stored zaxis settings into account.

    Is it calling the eeprom settings after the auto bed leveling commands?

    G28 Home the nozzle
    M851 Z0 Set the z-offset to zero
    M500 Store the settings to EEPROM
    M501 Load the settings from EEPROM
    M851 Echo the current z-offset value, make sure this reports Z0

    1. Hi Kent,

      What control board do you have running on your 3D Printer? Certain models like the SKR Mini E3 V1.2 did not have an on-board EEPROM, where that could potentially explain the issue.

      As for those specific steps, they are being entered into the live console from Pronterface, where that’s the equivalent of just sending commands directly to the 3D Printer. G28 homes it, then we clear the existing Z offset (just in case to be on the safe side), followed by storing/reloading EEPROM to make sure the changes were in fact saved.


  4. Brett, Wow man thank you. I tried to get the BL Touch up and running so many times manually. I could not get it to work. Thanks to your guide i just printed the best print yet with a brim that was so consistent that I want to frame it!

  5. Thanks for the tutorial. However my printer won’t move any on the G1 F60 Z0 command.
    I have a Mega S with bltouch

  6. Hey Brett,

    Thanks for this great tutorial on how to set the Z-offset.
    It definitely helped me, and I love it : concise, straight to the point!
    Just a note, to help those who, like me, don’t have an LCD screen (then, it is impossible to get the Z from it) –> use M114 command from Pronterface, or Octoprint.

    M114 ; returns the current position

    It will return a line that looks like that :
    X:177.00 Y:150.00 Z:-2.80 E:0.00 Count X:14160 Y:12000 Z:-1132

Leave a Reply

Your email address will not be published. Required fields are marked *

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top