Skip to main content
WARNING! From February 2022, these pages are no longer maintained.
Please see the current Duet3D documentation at https://docs.duet3d.com/
Help

Revision to Using mesh bed compensation

Tony

+[title|Using mesh bed compensation]
+[toc]
+
+
+
+Mesh bed compensation allows the printer adjust the nozzle height during printing to compensate for an uneven bed.
+
+'''Note for cartesian and coreXY printers this is recommended to be used instead of bed levelling (G32). For Delta printers G32 is delta calibration and should be run before G29.'''
+
+== Before you enable mesh bed compensation ==
+
+* You must be running RepRapFirmware 1.17 or later. Viewing the height map in the web interface requires Duet Web Control 1.14 or later.
+* If your printer is Cartesian or CoreXY, get the bed as level as you can by mechanical adjustment. Bed compensation increases wear on the Z axis moving parts, so you don't want to be doing more of it than necessary.
+* If your printer is a Delta, calibrate it first (see [[Calibrating a delta printer]]). Bed compensation is not a good substitute for accurate calibration.
+* Make sure that your Z probe is correctly configured and working. This includes the trigger height and the X and Y offsets of the probe relative to the nozzle. Refer to the M558 and G31 commands in the GCodes page of the reprap.org wiki at http://reprap.org/wiki/G-code.
+* On a Cartesian printer, you can use either mesh levelling (G29) or G30/G32 probing, not both. On a Cartesian printer mesh levelling is recommended but bed probing is still supported for backward compatibility with older firmware configurations.
+
+== Checking the trigger height ==
+
+The Z probe trigger height must not vary significantly with XY position. Measure the trigger height of your Z probe at various XY positions and make sure it is consistent. To measure the trigger height:
+
+# Make sure there is no filament stuck to the nozzle (you may want to do this test with the nozzle hot)
+# Cancel any existing bed compensation by sending M561
+# Send M208 S1 Z-3 to temporarily allow Z moves down to Z=-3mm. This is to ensure that you can lower the nozzle all the way to the bed in step 5.
+# Command the print head to the XY coordinates you want to probe
+# Command the print head down in small steps until the nozzle just touches the bed or just grips a sheet of paper. You may need to send M564 S0 to allow movement lower than where the firmware thinks Z=0 is. You may also wish to create a macro to lower the head by e.g. 0.02mm to get greater accuracy (G91 followed by G1 Z-0.02).
+# Send G92 Z0 to define that height as Z=0
+# Command the nozzle up 5mm (G1 Z5)
+# Send G30 S-1 to probe the bed without resetting the Z=0 position
+# Read off the Z height from the web interface. That is the trigger height.
+# Repeat the previous two steps a couple of times to make sure you are getting a consistent result
+# Repeat steps 4-10 for the other XY positions you want to check
+
+On a delta printer, it can be quite hard to achieve a consistent trigger height. Z probes that are mounted on the effector are sensitive to any tilting of the effector, because it affects the relative heights of the Z probe and the nozzle. You can reduce this effect by mounting the probe as close to the nozzle as possible. Probing solutions that use the nozzle itself as the probe are usually not affected by effector tilt, but some types are sensitive to the XY position of the nozzle for other reasons.
+
+== Define the mesh size and spacing ==
+
+Use the [[Gcode#Section_M557_Set_Z_probe_point_or_define_probing_grid|M557]]command to define the spacing of the mesh that you want to set up, and either the X and Y limits or (for a delta printer) the probing radius.
+
+Example for a Cartesian or CoreXY printer:
+
+[code]M557 X10:190 Y10:190 S20 ; probe from X=10 to 190, Y=10 to 190mm with a mesh spacing of 20mm[/code]
+
+Example for a delta printer:
+
+[code]M557 R130 S20 ; probe within a radius of 130mm from the centre with a mesh spacing of 20mm[/code]
+
+There is a firmware-dependent limit on the number of probe points allowed. If you exceed that limit, an error message will be returned when you run the M557 command, and you should increase the mesh spacing (S parameter) to reduce the number of probe points.
+
+== Probe the bed ==
+
+Home the printer if you haven't already, then use the command G29 (or G29 S0) to run the probing sequence. All points in the mesh that are reachable by the probe will be probed. When probing is complete, a message will be returned indicating whether or not it was successful.
+
+== Examine the height map ==
+
+If you sent the G29 command from Duet Web Control, it should display the height map automatically. Otherwise you can view the height map in Duet Web Control by right-clicking the arrow next to the Auto Bed Compensation or Auto Delta Calibration button and selecting "Show Mesh Grid Heightmap" from the drop-down menu.
+
+The height map file is normally called '''/sys/heightmap.csv''' but you can specify a different filename in G29, M374 and M375 commands. You can view, edit or download it using the System Editor tab in Duet Web Control.
+
+== Using mesh bed compensation before printing ==
+
+* Running G32 to auto calibrate a delta printer will clear the local height map info (but not the copy in heightmap.csv). Therefore, if you wish to use both auto calibration and mesh bed compensation, you must run G32 before you run G29, not after. You can include a G29 command at the end of your bed.g file if you wish.
+* If you don't want to probe the bed every time, you can use command G29 S1 to load the height map from the last time you used G29 to probe the bed.
+* You can use the M376 command to taper off bed compensation over a specified height
+
+== Summary of gcode commands related to mesh bed compensation ==
+
+* '''G29''' or '''G29 S0''' Probe the bed and save height map to file
+* '''G29 S1''' Load height map from file
+* '''G29 S2''' Clear height map
+* '''G30''' Probe the bed at a single point (can be used to measure Z probe trigger height)
+* '''G31''' Set Z probe trigger height, threshold and offsets from the print head reference point
+* '''G32''' Run sys/bed.g file. You can put commands in bed.g to perform mesh bed levelling, e.g. M401 followed by G29 S0 followed by M402.
+* '''M374''' Save height map to file
+* '''M375''' Load height map from file (same as G29 S1)
+* '''M376''' Set bed compensation taper height
+* '''M401''' Deploy Z probe (runs sys/deployprobe.g file)
+* '''M402''' Retract Z probe (runs sys/retractprobe.g file)
+* '''M557''' Define the probing grid
+* '''M558''' Set Z probe type, dive height, probing speed, travel speed between probe points, and probe recovery time
+* '''M561''' Clear height map (same as G29 S2)
+
+See the [[Gcode|G-code page]]for details of these commands.
+
+== Troubleshooting ==
+
+If you get jerky movements when the head moves across the bed at speed with mesh bed levelling enabled, but not with it disabled, this indicates that your Z jerk setting is too low for the travel speed you are using and the amount of compensation needed. Increase the Z parameter in the M566 command in config.g, or use a lower travel speed.
+
+If the heightmap.csv file contains a column of zeros at the start or the end, this indicates that the corresponding X coordinate was not reachable by the probe, taking account of the bed size specified in the M665 command on a delta printer or the M208 commands for other printers, and the probe offset specified by the X and Y parameters in the G31 command.; Similarly, if there is a row of zeros then the corresponding Y coordinate was not reachable.