Automatic Triple Z Bed Leveling



  • Hello,
    can any of you tell me whether the Gcode for the automatic Triple Z Levling is correct. I have adapted the code from the Duet documentation to my needs. The printer measures all 3 points and corrects the deviation. Then it is 0.000mm. If I understand the code correctly, the printer should measure all 3 points again if the deviation is greater than 0.03mm. How can I test it?

    while true
    if iterations = 5
    abort "Zu viele Autokalibrierungsversuche"
    G30 P0 X10 Y25 Z-99999
    if result != 0
    continue
    G30 P1 X142 Y295 Z-99999
    if result != 0
    continue
    G30 P2 X280 Y25 Z-99999 S3
    if result != 0
    continue
    if move.calibration.final.deviation <= 0.03
    break
    echo "Kalibrierung wiederholen, weil Abweichung zu hoch ist (" ^ move.calibration.final.deviation ^ "mm)" ; end loop
    echo "Automatische Kalibrierung erfolgreich, Abweichung", move.calibration.final.deviation ^ "mm"
    G1 X30 Y0 F10000 ; Druckkopf zur Seite bewegen



  • Here are my bed levelling macros.
    from a brief look over, your <= should be >= for the deviation
    bed.g

    M671 X-130:400 Y150:150 S10
    
    if !move.axes[0].homed || !move.axes[1].homed	; If the printer hasn't been homed, home it
    	G28 XY	; home y and x
    ;
    M98 P"0:/sys/homez.g"			; home z
    ;
    M561							; clear any bed transform
    ;M558 P9 H5 F120 T24000			; increase dive height
    M98 P"bed_twoscrews.g"		; perform bed tramming
    echo "Bed Traming Cycle: 1 - Difference was " ^ move.calibration.initial.deviation ^ "mm"
    ;
    while move.calibration.initial.deviation >= 0.01		; perform additional tramming if previous deviation was over 0.01mm
      if iterations = 5
        abort "Too many auto tramming attempts"
      M98 P"bed_twoscrews.g"		; perform bed tramming
      echo "Bed Traming Cycle: " ^ iterations + 2 ^ " - Difference was " ^ move.calibration.initial.deviation ^ "mm"
      continue
    ;
    G28 Z							; home z
    

    bed_twoscrews.g

    G30 P0 X0 Y150 Z-99999         							; Probe near front left leadscrew
    G30 P1 X230 Y150 Z-99999 S2       							; Probe near front right leadscrew
    


  • Thanks,

    how many runs does your Printer needs until the deviation is in the Range?



  • @gringo both of mine that run this script usually do it one or two times.
    You need to make sure the order you declare your z axis in M584 is the then the same order that your M671 declares the screw locations. Your 3 probe points then need to be on that same order too.



  • Could you Post your homez.g please



  • @gringo
    I'm not at home at the moment but it's something along the lines of

    G1 H2 Z5
    G1 X160 Y160 ; move to the middle of the bed
    M558 F300
    G30
    M558 F60
    G30
    


  • Thanks a lot.

    I have modified your bed.g and now it works.


Log in to reply