Duet : Centering the bed or setting the bed origin

Difficulty Level: Advanced

Reading Time: Minutes


With most printer geometries you can choose where on the bed the origin (the X=0 Y=0 point) will be. There are two common choices:

  1. X=0 Y=0 is at the centre of the printable area. This has a number of benefits. You will configure your slicer to centre prints on X0 Y0 regardless of the size of the bed; so you don’t need to change the slicer configuration depending on the bed size, and you may be able to print the same sliced files on more than one printer. If you have an IDEX printer then you don’t need to change the print centering in the slicer depending on whether you print the part in ditto mode or in normal mode; also IDEX mirror mode printing is easier to set up.
  2. X=0 Y=0 is one corner of the printable area, typically the front left corner. Some users of Cartesian and CoreXY printers prefer this scheme. You will need to configure your slicer so that it know where the centre of the bed is, in order to centre prints on that position.


Setting the origin on a Cartesian or CoreXY/CoreXZ/CoreXYU printer

The M208 S0 command defines the upper position limits of each axis, and the M208 S1 command defines the lower position limits. When an axis is homed to a low end (minimum) homing switch, the axis is assumed to be at the lower position limit. When it is homed to a high end (maximum) homing switch, it is assumed to be at the upper position limit. Therefore, changing the position limits in the M208 command will move the origin.

Example: a Cartesian printer uses a low end X homing switch, which triggers when the head reference point (i.e. the nozzle in a single tool printer) is 8mm off the low-X edge of the bed. It uses a high-end Y homing switch, which triggers when the head reference point is 2mm off the high-Y edge of the bed. The bed is 200mm square.

1. Suppose we want to make X0 Y0 the centre of the bed. Then the Xmin edge of the bed is at X=-100 and the homing switch triggers at X=(-100-8) = -108mm. Similarly, the Ymax edge of the bed is at Y=100 and the Y homing switch triggers at Y=(100+2) = 102mm. So we can use the following commands in config.g:

M208 S0 X-108 Y-100  ; set axis lower limits
M208 S1 X100 Y102    ; set axis upper limits

or alternatively when using firmware 2.02 or later:

M208 X-108:100 Y-100:102  ; set axis limits

2. If instead we want to make X0 Y0 the corner of the bed then we would use:

M208 S0 X-8 Y0     ; set axis lower limits
M208 S1 X200 Y202  ; set axis upper limits

or if using firmware 2.02 or later:

M208 X-8:200 Y0:202     ; set axis limits


1. You would normally have Z parameters in the M208 commands too.

2. The M208 limits set the position immediately after the corresponding G1 S1 command completes by triggering the homing switch. However, if your homing file has a G92 command after the G1 S1 command (as is typically the case when homing to a Z-min switch), then the G92 command will override that position.

Duet : Calibrating Z Probe

Difficulty Level: Advanced

Reading Time: Minutes

Test and calibrate a Z probe

Static test of the Z probe

Static test using the web interface

  • Apply power to the printer.
  • Connect to the printer from a browser.
  • If the probe needs to be deployed before use (e.g. BLTouch), test the deploy and retract functions, by sending M401 to deploy the probe and M402 to retract it.
  • With the Z probe deployed (if applicable) but not close enough to the bed to trigger it, check that the Z probe reading in Duet Web Control is zero or close to zero.
  • If your Z probe is of a type that produces a continuous output when triggered (for example IR, inductive, capacitive and switch-type probes), hold a surface below the Z probe to cause it to trigger (or jog the nozzle towards the bed until it is close enough to trigger). Check that the Z probe reading in DWC is correct (about 537 for the Mini Differential IR probe, and about 1000 for most other types).
  • If your Z probe produces a short pulse when it triggers (e.g. Smart Effector, Precision Piezo, FSRs with John SL board, BLTouch) then the pulse will probably be too short for you to see. Proceed to the dynamic test.

Static test using Panel Due or a USB connection

As above, but either monitor the Z probe reading in PanelDue if you have one, or send G31 via USB every time you want to read it.

Dynamic test

  • Apply power to the printer.
  • Connect to the printer from a browser or via USB.
  • If your printer is Cartesian or CoreXY, home X and Y. If it is a Delta, home all.
  • Position the print head well above the bed.
  • Send command G30 to do a single Z probe. This will deploy the probe (if applicable) and start the head descending or the bed rising.
  • Hold a suitable surface below the print head to trigger the Z probe. The probe should trigger and the Z movement should stop.
  • If the Z movement doesn’t stop, turn off power to the printer before the head crashes into the bed. It is also a good idea to reduce motor currents in case of a crash.

Calibrate the Z probe trigger height

  1. Make sure the dynamic test is successful (Z probe stops when it senses the bed) before doing this.
  2. Cancel any currently active mesh compensation with M561
  3. Use the X and Y jog buttons to position the nozzle over the centre of the bed
  4. Jog the nozzle down until it is just touching the bed or just gripping a sheet of paper. If the firmware doesn’t let you jog it down far enough, send M564 S0 to disable axis limits.
  5. Once you have the nozzle touching the bed, send command G92 Z0 to tell the firmware that the head is at Z=0
  6. Jog the head up by 5 to 10mm
  7. Send command G30 S-1. The nozzle will descend or the bed rise until the probe triggers and the Z height at which the probe stopped will be reported. If you are using a nozzle-contact Z probe, the trigger height will be slightly negative. For any other type of Z probe where the probe triggers before the nozzle contacts the bed, it will be positive.
  8. Repeat from step 5 two or three times to make sure that the trigger height is consistent.
  9. In Duet Web Control, go to Settings -> System Editor and edit the config.g file. Set the Z parameter in the G31 command to the trigger height that was reported. Save the file.
  10. Open config-override.g and check that there are no G31 commands in it. If you find any, delete those lines and save the file.
  11. To apply the new trigger height, restart the Duet by sending M999 or pressing Emergency Stop.

Fine tuning the trigger height

After you’ve done the procedure above, you can fine tune your G31 Z value to get a good first layer. During a test print, watch the first layer go down and adjust the Z position using the baby stepping function. If you have to move the nozzle closer to the bed, increase the G31 Z value by the amount of baby stepping used. If you have to move the nozzle farther away from the bed, decrease the G31 Z value by the amount of baby stepping used.

Measuring Probe X Y Offset

  • The firmware needs to know the position of the probe in relation to the tool. In most cases, the nozzle tip.
  • If your probe uses the nozzle tip, the X Y offset would be G31 X0 Y0.
  • If you have access to the CAD files for your probe mount you may already know the probe X Y offset, or it may have been provided to you with the parts.
  • Otherwise, you will need to measure the distance between probe and nozzle.

Here is an easy way to measure the offset:

  1. Tape down a piece of paper onto the bed.
  2. Bring the nozzle down to the bed surface and lower it until the nozzle starts to depress into the paper, making a small impression.
  3. Mark the impression with a marker tip to make it more visible.
  4. Now jog X and Y until the probe is directly over the spot where the nozzle was.
  5. Take the amount you jogged as your X and Y offset to use in G31.
  6. When the probe is to the left of the nozzle the X value is negative.
  7. When the probe is in front of nozzle the Y value is negative.
  8. To the right and behind the values are positive.

Note that the offsets will follow the right hand coordinate system, meaning that X movement to the left of the nozzle will be negative, and right of the nozzle will be positive. And Y movement behind the nozzle will be positive, and movement in front of the nozzle will be negative.

Here’s an example of how to measure.

More information on Z Probes

BL Touch

There is detailed information here:

Connecting a BL Touch.

Also BeTrue3d.dk has a very detailed tutorial on using a BL touch, including how to setup bed leveling an bed compensation here:



Source: Test and calibrate a Z probe – Duet3D (dozuki.com)