Duet wifi cheat sheet

Probing-related G-code

  • G30 – run a single probe.
  • G31 – set up probe, in particular the Z height at which the probe triggers; note the firmware supports multiple probes, so you must run M558 first to specify which one.
  • G32 – run a full autoprobe (that is, execute bed.g or uses the matrix defined by M557)
  • G92 – redefine coordinates so that current position is zero (or values specified)
  • M114 – report current position.
  • M557 – Set Z probe point or define probing grid.
  • M558 – set probe type (e.g. analog); also select which probe to use, so run this early in the setup process
  • M561 – clear all autocalibration or G92 settings
  • M665 – set delta configuration; this includes the manual calibration values that are the starting point for autocalibration. You can also use this command after an autoprobe to see the fitted values
  • M666 – set delta endstop adjustment; this includes the manual calibration values that are the starting point for autocalibration. You can also use this command after an autoprobe to see the fitted values
  • To enable the extruder motor and move it, send:
  • T0
  • G1 E10 F60

File config.g

M584 X0 Y1 Z2:4 E3; two Z motors connected to driver outputs Z and E1

M671 X-20:220 Y0:0 S0.5 ; leadscrews at left (connected to Z) and right (connected to E1) of X axis

M208 X-5:205 Y0:300 ; X carriage moves from -5 to 305, Y bed goes from 0 to 300

File bed.g:

G28 ; home

M401 ; deploy Z probe (omit if using bltouch)

G30 P0 X20 Y100 Z-99999 ; probe near a leadscrew, half way along Y axis

G30 P1 X180 Y100 Z-99999 S2 ; probe near a leadscrew and calibrate 2 motors

M402 ; retract probe (omit if using bltouch)

G92 z0 reset z to 0 or M564 S0 to disable axis limits.

Send G30 S-1 to probe the bed without resetting the Z=0 position

restart the Duet by sending M999

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

M564 S0 to disable axis limits

M401 deploy

M402 retract

X_PROBE_OFFSET_FROM_EXTRUDER -42 // X offset: -left +right [of the nozzle]
Y_PROBE_OFFSET_FROM_EXTRUDER -5 // Y offset: -front +behind [the nozzle]

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.

Adjusting z-offset

  1. Cancel any currently active mesh compensation with M561
  2. Use the X and Y jog buttons to position the nozzle over the centre of the bed
  3. 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.
  4. Once you have the nozzle touching the bed, send command G92 Z0 to tell the firmware that the head is at Z=0
  5. Jog the head up by 5 to 10mm
  6. 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.

— BL-TOUCH START GCODE —
G21 ; metric values
G90 ; absolute positioning
M82 ; set extruder to absolute mode
M107 ; start with the fan off
; confirm BL-touch safety
M280 P0 S160 ; BL-Touch Alarm release
G4 P100 ; Delay for BL-Touch homing
G28 X0 Y0 ; move X/Y to min endstops
G28 Z0 ; move Z to min endstops
; reconfirm BL-touch safety
M280 P0 S160 ; BL-Touch Alarm realease
G4 P100 ; Delay for BL-Touch
; bed leveling
G29; Auto leveling
M420 Z5 ; set LEVELING_FADE_HEIGHT
M500 ; save data of G29 and M420
M420 S1 ; enable bed leveling
; prepare hot-end
G92 E0 ; zero the extruded length
G1 F200 E3 ; extrude 3mm of feed stock
G92 E0 ; zero the extruded length again
M117 Printing
; — end of BL-TOUCH START GCODE –

A valid M671 command enables auto calibration of the Z motors. When you run G32 to perform bed probing, the final G30 command (the one with the S parameter) in bed.g will then cause auto calibration to be performed. The auto calibration uses a least squares algorithm that minimises the sum of the height errors. The deviation before and expected deviation after calibration is reported.

If you have two Z motors, the calibration process adjusts the bed tilt along a line between the two leadscrew positions, on the assumption that the tilt at right angles to this will not change. With three motors, it adjusts the tilt in both directions. With four motors, it adjusts the tilt in both directions and also the twist. You should not use 4 leadscrews with a bed that is rigid enough to resist twisting strongly.

You can run G32 again to repeat the process if you wish.

If your bed is not perfectly flat or the gantry sags a little when the head is over the middle of the bed, the process will cause a small shift in the Z=0 position. To correct this, if you are using the Z probe to do Z homing, you can just re-home Z at the end of your bed.g file.

Recommendations

  • If you have 3 or 4 Z motors, in bed.g use at least one probe point close to each leadscrew.
  • If you have just 2 Z motors, one at each end of the X axis, then set the Y coordinates of the leadscrews in the M671 command to be equal (the value doesn’t matter, so you can use zero). Use at least two probe points, one at each end of the X axis. All your probe points should have the same Y coordinate, which should be at or near the middle of the printable range.
  • Note: If you are experiencing the Z axis compensating in the opposite direction needed, that means your Z motors are swapped. You can either swap the X values in the M671 command, or swap the stepper motors plugged into the Duet.

Example for 2 motors

File config.g:

M584 X0 Y1 Z2:4 E3; two Z motors connected to driver outputs Z and E1

M671 X-20:220 Y0:0 S0.5 ; leadscrews at left (connected to Z) and right (connected to E1) of X axis

M208 X-5:205 Y0:300 ; X carriage moves from -5 to 305, Y bed goes from 0 to 300

File bed.g:

G28 ; home

M401 ; deploy Z probe (omit if using bltouch)

G30 P0 X20 Y100 Z-99999 ; probe near a leadscrew, half way along Y axis

G30 P1 X180 Y100 Z-99999 S2 ; probe near a leadscrew and calibrate 2 motors

M402 ; retract probe (omit if using bltouch)

  1. Cancel any currently active mesh compensation with M561
  2. Use the X and Y jog buttons to position the nozzle over the centre of the bed
  3. 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.
  4. Once you have the nozzle touching the bed, send command G92 Z0 to tell the firmware that the head is at Z=0
  5. Jog the head up by 5 to 10mm
  6. 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.

To enable the extruder motor and move it, send:

T0

G1 E10 F60

Similar Posts