Setup Autocompensation

  • I'm wanted to use this autocompensation for the Z axis to level the two
    sides of the bed as sometimes the leadscrews may drop just a little.
    Ive read up on it and started the configuration but I'm not so sure I got it right.
    From what I found on internet I have this for know

    M667 S1 ; set to CoreXY mode
    M569 P0 S1 ; X Drive 0 goes forwards (change to S0 to reverse it)
    M569 P1 S1 ; Y Drive 1 goes forwards
    M569 P2 S1 ; Left Z DRIVE (original Z)
    M569 P4 S1 ; Right Z Drive (Ex1)
    ;M569 P2 S1 ; Drive 2 goes forwards
    M569 P3 S1 ; Extruder Drive 3 goes forwards
    M350 X16 Y16 Z16:16 U16 E16 I1 ; Set 16x microstepping with interpolation
    M92 X160 Y160 Z3200:3200 U3200 E837 ; Set axis steps/mm Set extruder steps/mm
    M566 X500 Y500 Z150 E500 ; Maximum jerk speeds mm/minute
    M201 X1200 Y1200 Z18:18 U18 E800 ; Accelerations (mm/s^2)
    M203 X12000 Y12000 Z120:120 U120 E12000 ; Maximum speeds (mm/min)
    M906 X1200 Y1200 Z1800:1800 E1200 U1800 I30 ; Set motor currents (mA)extruder current just enough will click not strip
    M84 S30 ; Set idle timeout

    ; Motor remapping for dual Z
    M584 X0 Y1 Z2:4 U4 E3 P3 ; Driver 0 For X, 1 for Y, Z=2:4 U=4, Extruder 3

    Still have to do the home and endstops but that where I got lost.
    Now i can add the U endstop but I already have a Z endstoip setup using the IR how do I tell it that I need to use it for the autocompensation first then
    the normal Z probe.

    I have connected the 2 endstops to Z and E1.

  • administrators

    What you actually want to do is auto-levelling, not auto bed compensation (many people make the opposite mistake). You can do it in two ways:

    1. Use two separate Z endstop switches, which is what you appear to have done. In this case the second Z motor temporarily becomes the U axis. The Z endstop switch must be connected to the Z endstop input as usual, and the U endstop must be connected to E0 endstop input. Your Z homing file needs to:
    • split the motors into Z and U and make the U axis visible using M584 Z2 U4 P4 (no need to mention X, Y or E if you already set them up in the M584 command in config.g)
    • home Z and U simultaneously using a G1 S1 UxxxZxxx move
    • restore both motors to Z and hide the U axis using M584 Z2:4 U11 P3
    • if you then want to get an accurate Z height using the Z probe, follow that with a G30 probing move at the centre of the bed
      Similarly for the Z homing section of homeall.g.
    1. Alternatively you can use just one endstop switch for homing (or none - use the Z probe to home Z), then probe 2 or more positions on the bed and have the firmware adjust the Z motors individually. See

  • So when i connect the endstops and put this code in homez.g then it should works?

    ; homez.g
    ; called to home the Z axis
    M584 Z2 U4 P4
    G1 S1 U200Z200
    M584 Z2:4 U11 P3

    ;home z needs to be done with bltouch so then i put
    G91 ; relative positioning
    G1 Z5 F6000 S2 ; lift Z relative to current position
    G90 ; absolute positioning
    G1 X100 Y130 F6000 ; go to mid of the bed
    G30 S1 ; home Z by probing the bed

  • administrators

    Yes that should work, except that you should also put this line in config.g:

    M584 Z2:4 U11 E3 P3

    Also use the same Z homing code in the Z homing section of homez.g, or have homeall.g call homez.g using M98 to do Z homing.

    Connect the U axis endstop switch to the E0 endstop input.


Looks like your connection to Duet3D was lost, please wait while we try to reconnect.