# Calibrate Bed Mesh

This section explains how to run a Bed Mesh Calibration. The Bed Mesh module may be used to compensate for bed surface irregularities to achieve a better first layer across the entire bed. It should be noted that software based correction will not achieve perfect results, it can only approximate the shape of the bed. Bed Mesh also cannot compensate for mechanical and electrical issues. If an axis is skewed or a probe is not accurate then the bed\_mesh module will not receive accurate results from the probing process.

{% hint style="info" %}
Prior to starting this calibration, remove any filament completely from your printer and ensure your nozzle does not have any extruded filament hardened on the nozzle. This will ensure a proper bed mesh calibration.
{% endhint %}

* From the MainsailOS web interface;
  * Click the <mark style="color:red;">`Home All`</mark> button in the <mark style="color:red;">`Controls`</mark> section;

![Home All](https://3358793419-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEUZ4ecqSLgI2D4esAcVS%2Fuploads%2Fx9VtpKUQv9DpbyxUYu7Z%2Fbed2.png?alt=media\&token=614868c0-101a-49ca-8822-7af9eaad5ed8)

* Send a <mark style="color:red;">`BED_MESH_CALIBRATE`</mark> command in the <mark style="color:red;">`Console`</mark>;

{% hint style="info" %}
The <mark style="color:red;">`[bed_mesh]`</mark> section in the <mark style="color:red;">`printer.cfg`</mark> file has been preconfigured to run a 25 point bed mesh calibration by default.

As long as your <mark style="color:red;">`z_offset calibration`</mark> was done properly, the printer should register all 25 points (5x5) and provide output at the end of the process.

If at any point the print head stops moving and you get a 'No trigger on probe after full movement' message, you can restart this section from the beginning and try again.

If you are not able to complete a <mark style="color:red;">`BED_MESH`</mark>_<mark style="color:red;">`_`</mark>_<mark style="color:red;">`CALIBRATE`</mark>, go back and redo the [Calibrate Probe Z Offset](calibrate-probe-z-offset) section and then try again.
{% endhint %}

![Bed Mesh Calibrate](https://3358793419-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEUZ4ecqSLgI2D4esAcVS%2Fuploads%2FSPzmgklRppcB1k095UTE%2Fbed3.png?alt=media\&token=9377cc8a-cc90-4324-8c18-58509bf523e9)

* Once the <mark style="color:red;">`bed_mesh`</mark> finishes probing all 25 points, you should get a <mark style="color:red;">`Mesh Bed Leveling Complete`</mark> message in the <mark style="color:red;">`Console`</mark>;
* Send a <mark style="color:red;">`SAVE_CONFIG`</mark> command in the <mark style="color:red;">`Console`</mark>;
  * This will update the <mark style="color:red;">`printer.cfg`</mark> file with the new <mark style="color:red;">`bed_mesh`</mark> settings and restart Klipper;

![SAVE\_CONFIG](https://3358793419-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEUZ4ecqSLgI2D4esAcVS%2Fuploads%2Fcy27M91F5PcV2usgJuo5%2Fbed4.png?alt=media\&token=02ed177d-b369-457a-bd09-cf291cd0965a)

* Checking the <mark style="color:red;">`printer.cfg`</mark> file to ensure the new <mark style="color:red;">`bed_mesh`</mark> settings are updated:
  * From the MainsailOS web interface, click <mark style="color:red;">`Machine`</mark>, then click on <mark style="color:red;">`printer.cfg`</mark>

![Machine > printer.cfg](https://3358793419-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEUZ4ecqSLgI2D4esAcVS%2Fuploads%2FJ2LcRPBhap2n8BAcJ0MF%2Fbed5.png?alt=media\&token=966e71cb-934a-42ba-b0a1-3215c8c00fc3)

* The <mark style="color:red;">`printer.cfg`</mark> file should load into an editor window;
* Scroll down to the very bottom of the <mark style="color:red;">`printer.cfg`</mark> file until you reach the;
  * <mark style="color:red;">`#*# <---------------------- SAVE_CONFIG ---------------------->`</mark> section;
  * A new <mark style="color:red;">`[bed_mesh default]`</mark> section should be present, along with the new <mark style="color:red;">`bed_mesh`</mark>  settings;

![\[bed\_mesh default\]](https://3358793419-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEUZ4ecqSLgI2D4esAcVS%2Fuploads%2FARkwbbbHttC9OZmNwIgI%2Fbed6.png?alt=media\&token=17f02a4d-7d50-4699-8f95-340e4dcc9841)

* Once you have confirmed these settings;
  * Close the <mark style="color:red;">`printer.cfg`</mark> file by clicking the <mark style="color:red;">`X`</mark> near the top right of editor;
