I just finished a CNC that uses Marlin Firmware. The dimensions of it are quite large (3200 x 2000 mm) and the table is not perfect. I'm thinking of adding a proximity sensor to store a mesh in the eeprom and thus compensate for any errors. I'm not sure how to do this. I would like to be able to execute an action from the display (full graphics) and have samples taken over the whole table, but I do not know how to tell the firmware where to take the samples, nor what the dimensions of it are.

  • $\begingroup$ Welcome to 3D Printing! $\endgroup$ – Pᴀᴜʟsᴛᴇʀ2 Oct 2 '18 at 12:38

Auto bed leveling requires some settings (constants) in the configuration of your Marlin firmware.

It is recommended to read about the implementation of automatic bed leveling first. There are a few options to choose the kind of leveling, for 3D printers a commonly chosen option is AUTO_BED_LEVELING_BILINEAR which is the best option if you do not know if your bed is flat or not. If you are certain it is flat but tilted (e.g. when you have a milled bed or a glass plate in 3D printing) you could go for AUTO_BED_LEVELING_3POINT or AUTO_BED_LEVELING_LINEAR.

What further is important is the sensor type you choose. Do you want a touch or a proximity sensor. The latter is your preference (as specified in your question), which is a little simpler as you do not need to configure for servos for deploying and stowing.

You need to set:


for using a fixed proximity sensor.

In the configuration file you also need to specify the position of the probe in relation to the nozzle (in your case tool center):

#define X_PROBE_OFFSET_FROM_EXTRUDER 10  // X offset: -left  +right  [of the nozzle]
#define Y_PROBE_OFFSET_FROM_EXTRUDER 10  // Y offset: -front +behind [the nozzle]

and optionally:

#define Z_PROBE_OFFSET_FROM_EXTRUDER 0   // Z offset: -below +above  [the nozzle]

This latter is not necessary as you can always set the distance of the sensor trigger point to the nozzle/tool plane by G-code command M851 Z-x.xx

You would also need to set the boundaries of the probe area to prevent the tool to hit unwanted positions (fill out values or leave the constants):

// Set the boundaries for probing (where the probe can reach).

Once properly setup, command G29 runs the leveling of the bed, options are available for that command to store the bed mesh to EEPROM.

Enabling LCD_BED_LEVELING constant in the configuration file will add a Bed Leveling sub-menu to the LCD. But you could also work with SD-card stored files that load these codes.

This reference explains the automatic leveling in more detail, but there are many more detailed guides to follow from the internet. Be sure that you get a recent guide to that is easier to set in the latest firmware.

| improve this answer | |
  • $\begingroup$ Thanks!. Can I uncomment MESH_BED_LEVELING and AUTO_BED_LEVELING_BILINEAR at the same time?. I want to test the result of this manually before going to the automatic solution. With both methods activated, both options will appear on the menu?. (auto and manual). $\endgroup$ – Ariel Larraburu Oct 2 '18 at 13:21
  • $\begingroup$ No I do not think it is possible, if you look into the config file you see that if you enable both, AUTO_BED_LEVELING_BILINEAR is executed is some #if statement and it will then never go to the #elif of MESH_BED_LEVELING . $\endgroup$ – 0scar Oct 2 '18 at 13:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.