Site Navigation

Your Account

Choose Language

Bed levelling using multiple independent Z motors

On a printer which uses two or more Z motors to raise/lower the bed or gantry, you can have the firmware probe the bed and adjust the motors individually to eliminate tilt. This feature is implemented in firmware version 1.19 and later.

Prerequisites ¶ 

  • You must have a bed or gantry that is raised/lowered by two, three or four leadscrews or similar, where each one is driven by its own Z motor
  • Each Z motor must be driven from a separate stepper motor output on the Duet + optional DueX expansion board
  • As usual with this arrangement, you must use M584 to assign the 2, 3 or 4 drivers to the Z axis
  • You must use the M671 command to define the X and Y coordinates of the leadscrews. The M671 command must come after the M584 command and must specify the same number of X and Y coordinates as the number of motors assigned to the Z axis in the M584 command; and these coordinates must be in the same order as the driver numbers of the associated motors in the M584 command. The M671 command must also come after any M667 or M669 command.
  • You can optionally specify a maximum correction per leadscrew in the M671 command (S parameter). If you don't, it defaults to 1mm.
  • You must set up a bed.g file in the usual way with at least as many probe points as Z motors. You can have more if you wish.
  • The value of the S parameter on the final G30 command in bed.g must equal the number of Z motors.

How it works ¶ 

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.

Example ¶ 

File config.g:

...
M584 X0 Y1 Z2:5:6 ; three Z motors connected to driver outputs 2, 5 and 6
M671 X-15:100:215 Y190:-10:190 S0.5 ; leadscrews at rear left, front middle and rear right
...

File bed.g:

G28 ; home
M401 ; deploy Z probe
G30 P0 X20 Y190 Z-99999 ; probe near a leadscrew
G30 P1 X180 Y190 Z-99999 ; probe near a leadscrew
G30 P2 X100 Y10 Z-99999 S3 ; probe near a leadscrew and calibrate 3 motors
M402 ; retract probe

0 Comments

Add Comment

View Statistics:

Past 24 Hours: 15

Past 7 Days: 95

Past 30 Days: 576

All Time: 2,101