I'm using firmware Marlin 2.0.3 on an Anet A8 printer. I'm using a Roko SN04-N NPN bed leveller. I've managed to set up 3 points bed levelling but I wanted to try the bilinear levelling.

Issue is, the sensor goes out of the aluminum bed ever so slightly during levelling, resulting in the printing head crashing on the bed.

Where can I set the grid for the bilinear levelling in the config file? I didn't find the option in the file and Google wasn't of any help this time.

  • $\begingroup$ Did you define "Z-probe boundary limits"? Please post your changes to the configuration.h and configuratio_adv.h as in the latter file the boundaries are set in Marlin 2.x; e.g. #define MIN_PROBE_EDGE_LEFT MIN_PROBE_EDGE. Without posting the values, it would be guessing what is wrong. If you used the Anet A8 configuration files from Anet A8 config. you will find that these are incomplete with respect to bed limits, these files require updating! $\endgroup$
    – 0scar
    Feb 10, 2020 at 10:38
  • $\begingroup$ @0scar yes I did and it's ignoring it! This is my configuration.g and this is my configuration_adv.h. I think I got the config for the Anet from the Marlin examples, but I'm not 100%sure. Where should I find a complete setting? $\endgroup$
    – vale.maio2
    Feb 10, 2020 at 11:11
  • $\begingroup$ No it is not ignoring it, your bed limits are incorrect, I've updated the answer to your specific problem. Basically your left limit is incorrect (too far left), hence the sensor is not on the plate. Hope you can fix it now, happy printing! :-) $\endgroup$
    – 0scar
    Feb 10, 2020 at 14:46

3 Answers 3


If you have managed to setup 3-point levelling, you should be able to enable bi-linear levelling in the firmware.

From the configuration.h file for Marlin firmware you can find the following options:

 * Choose one of the options below to enable G29 Bed Leveling. The parameters
 * and behavior of G29 will change depending on your selection.
 *  If using a Probe for Z Homing, enable Z_SAFE_HOMING also!
 *   Probe 3 arbitrary points on the bed (that aren't collinear)
 *   You specify the XY coordinates of all 3 points.
 *   The result is a single tilted plane. Best for a flat bed.
 *   Probe several points in a grid.
 *   You specify the rectangle and the density of sample points.
 *   The result is a single tilted plane. Best for a flat bed.
 *   Probe several points in a grid.
 *   You specify the rectangle and the density of sample points.
 *   The result is a mesh, best for large or uneven beds.
 * - AUTO_BED_LEVELING_UBL (Unified Bed Leveling)
 *   A comprehensive bed leveling system combining the features and benefits
 *   of other systems. UBL also includes integrated Mesh Generation, Mesh
 *   Validation and Mesh Editing systems.
 *   Probe a grid manually
 *   The result is a mesh, suitable for large or uneven beds. (See BILINEAR.)
 *   For machines without a probe, Mesh Bed Leveling provides a method to perform
 *   leveling in steps so you can manually adjust the Z height at each grid-point.
 *   With an LCD controller the process is guided step-by-step.

If you are using 3-point levelling you enabled constant AUTO_BED_LEVELING_3POINT by removing the comment characters (//):


to enable bi-linear levelling, you should remove the comment characters before constant #define AUTO_BED_LEVELING_BILINEAR:


Definition of the grid is done by specifying how many point you want to have using constants GRID_MAX_POINTS_X and GRID_MAX_POINTS_Y:


  // Set the number of grid points per dimension.
  #define GRID_MAX_POINTS_X 3

The code above shows the default definition of a 9 point (3 x 3) grid.

Note that this will only work well if the area for the sensor to reach safely is correctly defined. If the sensor is missing the build plate, you have not correctly defined the limits for the sensor. Question "How to set Z-probe boundary limits in firmware when using automatic bed leveling?" has an accepted answer that describes how to define an area on the plate that the sensor may reach (the answer on this question also discusses Marlin 2.x).

In the specific case of the OP (after posting the config files)

From the posted configuration files your probe position can be obtained:

#define NOZZLE_TO_PROBE_OFFSET { 25, 55, 0 }

So your probe is at the right-back when facing the printer. Also your bed area attempt (commented) and the current active bed area can be obtained:

  //#define MIN_PROBE_EDGE_LEFT 5
  //#define MIN_PROBE_EDGE_RIGHT 200
  //#define MIN_PROBE_EDGE_FRONT 55
  //#define MIN_PROBE_EDGE_BACK 200

From these excerpts it is clear that the bed limits are incorrectly defined.

Following the theory from this answer the probe is only allowed to visit the following (dark red) area:

Probe area for back-right probe Marlin 2.0.x

This area is defined as:


which translates to:


As seen in the commented //#define MIN_PROBE_EDGE_LEFT 5 and uncommented #define MIN_PROBE_EDGE_LEFT MIN_PROBE_EDGE (equals 10) left probe limits, you are at least respectively 20  or 15 mm short, hence the sensor is not on the plate on the left.

  • $\begingroup$ I did try that, but the printer is still ignoring probe offset and probing boundaries. I've tried also this bugfix but still probing outside of the bed $\endgroup$
    – vale.maio2
    Feb 10, 2020 at 10:07
  • $\begingroup$ @vale.maio2 I've updated the answer, from your config files it was clear that the incorrect value for the left boundary was used causing the sensor to be off-plate on the left. $\endgroup$
    – 0scar
    Feb 10, 2020 at 14:50
  • $\begingroup$ thank you very much for your correction, but now when selecting the auto levelling, it just probes the center of the bed and stops there, same when printing something. Unfortunately I have to switch back to 3 points. $\endgroup$
    – vale.maio2
    Feb 10, 2020 at 15:49
  • $\begingroup$ @vale.maio2 That means that Z_SAFE_HOMING is active, strange that it stops... Look for more information on enabling bi-linear leveling here. Did you also determine the correct Z-offset and set it with M851? $\endgroup$
    – 0scar
    Feb 10, 2020 at 17:03
  • $\begingroup$ yes it's active but it's not an issue with 3 point levelling. I'll have a read at that documentation, but I've also discovered that the bed is absolutely uneven. I need to make it even fist, then even 3 point levelling should suffice. Thank you again for your input. $\endgroup$
    – vale.maio2
    Feb 10, 2020 at 19:45

Currently on 2.1.1 it is just


On line 1500 of Configuration.h

For example,

  • $\begingroup$ Hi and welcome to SE.3DP. Thanks for the update. I have added code formatting for you and a link to the actual line in the code, just to bulk your answer out a bit - to make it more substantial. Please don't forget to take the tour. $\endgroup$
    – Greenonline
    Nov 15, 2022 at 20:25

Note for anyone looking at the answer above, but in 2.1.x: The #define lines have been renamed:


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .