Trying to figure out dual-z motors with independent drivers



  • I've got a very modified Ender 3 with dual z motors. For a few weeks now I've just been running both motors in series but just last night moved the second motor over to E4:

    M584 X0 Y1 Z2:4 E3                             ; set drive mapping
    

    I'm having trouble understanding the relationship between the axis limits defined with M208, and the X/Y coordinates I specify in the M671 command. Currently my axis limits are:

    M208 X0:210 Y0:210 
    

    And M671:

    M671 X-20:220 Y0:0 S0.5
    

    My assumption is that the X/Y settings in M671 are the offsets to where the Z acme rods are, in reference to the X/Y locations specified with M208. So for instance with M672 X-20, the X-20 would be 20mm BEFORE X0. Is this correct?

    My config files are attached:
    config(4).g
    bed.g
    homeall.g
    homez.g


  • Moderator

    I think your assumption is correct based on the description here: https://duet3d.dozuki.com/Wiki/Bed_levelling_using_multiple_independent_Z_motors

    Is it working?

    Looking at your files, one thing I might change is that you have the leveling portion in your homez and homeall. I would probably leave the leveling bit in bed.g and use G32 to call the leveling when needed. You should probably also home the Z axis via the probe in the center of the bed before and after the leveling bit.



  • You've basically got it but as Phaedrux said, you should put the leveling bit in bed.g
    Then you just call G32 from your slicer start G code.

    Here are my settings (not an ender, so screw placement is different)
    Note: I am using conditional G code where possible so it should work as it will be in relation to your grid settings etc.
    Use at own risk etc....

    In config.g

    M584 X0 Y1 Z2:4 E3												; two Z motors connected to driver outputs Z and E1
    M671 X-65:255 Y65:65 S5.5 ; leadscrews at left (connected to Z) and right (connected to E1) of X axis
    

    In bed.g (Note: The max it can adjust is the S parameter in your M671)
    I have mine set to 5.5mm for testing, but that's a bit extreme

    ; bed.g
    ; called to perform automatic bed compensation via G32
    ; requires two independent Z lead screw motors to be configured
    ; https://duet3d.dozuki.com/Wiki/Bed_levelling_using_multiple_independent_Z_motors
    ; uses conditional G Code for portability (requires Reprap Firmware version 3 or higher)
    ; Z Mesh probe area must be properly defined in M557 https://duet3d.dozuki.com/Wiki/Gcode#Section_M557_Set_Z_probe_point_or_define_probing_grid
    ; Note: The maximum amount of correction possible is defined in M671 (S parameter) https://duet3d.dozuki.com/Wiki/Gcode#Section_M671_Define_positions_of_Z_leadscrews_or_bed_levelling_screws
    
    
    M561 ; clear any bed transform
    M280 P0 S160 I1 ; Reset BL Touch
    M280 P0 S80 ; retract BLTouch
    ; If the printer hasn't been homed, home it
    if !move.axes[0].homed || !move.axes[1].homed || !move.axes[2].homed
      G28
    ; Probe the bed and do auto leveling
    while true
      if iterations = 5
        abort "Too many auto calibration attempts"
      ;probe at XMin mesh probe point and midway of Y mesh area 
      G30 P0 X{move.compensation.probeGrid.xMin} Y{((move.compensation.probeGrid.yMax-move.compensation.probeGrid.yMin)/2)+move.compensation.probeGrid.yMin} Z-99999
      if result != 0
        continue
      ;probe at X Max mesh probe point and midway of Y mesh area
      G30 P1 X{move.compensation.probeGrid.xMax} Y{move.axes[1].machinePosition} Z-99999 S2
      if result != 0
        continue
      ;set maximum probe deviation allowed between the two points
      if (move.calibration.initial.deviation <= 0.02)
        break
      ; if deviation between the two points is too high, repeat the test after Z axis has been adjusted. 
      echo "Repeating calibration because deviation is too high " ^ move.calibration.initial.deviation ^ "mm"
    ; end loop
    G28; Home all again just to be sure
    G29 S1 ; Reload bed compensation mesh
    

    In Home Z (again, it will take into account your offsets and grid settings)

    ; homez.g
    ; called to home the Z axis
    ;
    ; generated by RepRapFirmware Configuration Tool v2.1.4 on Sat Jan 04 2020 09:46:45 GMT+1000 (Australian Eastern Standard Time)
    G91                 ; relative positioning
    M280 P0 S160 I1 ; Reset BL Touch
    M280 P0 S80 ; retract BLTouch
    G1 H2 Z5 F6000      ; lift Z relative to current position
    G90                     ; absolute positioning
    G1 H2 X{(move.compensation.probeGrid.xMax/2) - sensors.probes[0].offsets[0]} F6000 
    G1 H2 Y{(move.compensation.probeGrid.yMax - move.compensation.probeGrid.yMin)/2 + move.compensation.probeGrid.yMin} F6000
    G30                 ; home Z by probing the bed
    
    ; Uncomment the following lines to lift Z after probing
    ;G91                ; relative positioning
    ;G1 H2 Z5 F100      ; lift Z relative to current position
    ;G90                ; absolute positioning
    

    and in homeall.g

    ; homeall.g
    ; called to home all axes
    ;
    ; generated by RepRapFirmware Configuration Tool v2.1.4 on Sat Jan 04 2020 09:46:45 GMT+1000 (Australian Eastern Standard Time)
    G91                     ; relative positioning
    M280 P0 S160 I1 ; Reset BL Touch
    M280 P0 S80 ; retract BLTouch
    M561 ; clear any bed transform
    G1 H2 Z5 F6000          ; lift Z relative to current position
    G1 H1 X-205 Y-205 F1800 ; move quickly to X and Y axis endstops and stop there (first pass)
    G1 H2 X5 Y5 F6000       ; go back a few mm
    G1 H1 X-205 Y-205 F360  ; move slowly to X and Y axis endstops once more (second pass)
    G90                     ; absolute positioning
    G1 X{(move.compensation.probeGrid.xMax/2) - sensors.probes[0].offsets[0]} F6000 
    G1 Y{(move.compensation.probeGrid.yMax - move.compensation.probeGrid.yMin)/2 + move.compensation.probeGrid.yMin} F6000
    G30                     ; home Z by probing the bed
    


  • Awesome guys.. Thank you. That's one thing I love about 3d printing, I never stop learning new things.

    It was mostly working, I was just trying to be certain I understood what was going on. I think I'll need to remeasure the distance from Xmin/Xmax to the screw centers, I just took a very rough measurement the first time. How accurate should these measurements be?


  • Moderator

    @jrsphoto said in Trying to figure out dual-z motors with independent drivers:

    How accurate should these measurements be?

    The more accurate the better, but the end result won't matter all that much because you'll likely need to run the leveling a couple times anyway since the probe can't actually probe on the lead screw location.



  • I have an anycubic Chiron running the type of setup you are talking about.

    for M671 i have the following

    M671 X-40:440 Y200:200 S2 ; Lead screws position at right and left of the X axis

    I also run a "X axis" levelling macro which has the following

    note, I get the script to carry out the same operation twice as the more you do it the better it gets i.e less deviation. I have the G32 command written into the start script of my slicer and I also get the slicer to load the mesh map.

    ; bed.g
    ; Called by G32
    ;
    G28 ; Carry out homing sequence
    G30 P0 X10 Y200 Z-99999 ; Probe near a lead screw, half way along the Y axis (1st motor)
    G30 P1 X386 Y200 Z-99999 S2 ; Probe near a lead screw and calibrate 2 motors (2nd motor)
    G30 P0 X10 Y200 Z-99999 ; Probe near a lead screw, half way along the Y axis (1st motor)
    G30 P1 X386 Y200 Z-99999 S2 ; Probe near a lead screw and calibrate 2 motors (2nd motor)
    G1 X27 Y102 F7000 ; Move the head to the front left corner



  • Its it best if my G30 probing locations are equidistant from X center? Just wondering as with my probe on the left side of the extruder, I can probe the far left edge of my bed.



  • @jrsphoto said in Trying to figure out dual-z motors with independent drivers:

    Its it best if my G30 probing locations are equidistant from X center? Just wondering as with my probe on the left side of the extruder, I can probe the far left edge of my bed.

    As Far as I know everything appears to take it's cue from zero , and that makes logical sense to me, with zero being the datum point hence the M671 stating (in my case) X-40:440 Y200:200 S2

    As for probing, i just planted the probe at the points I could reach (minimum & maximum) of X10,Y200 and X386,Y200


  • administrators

    @jrsphoto said in Trying to figure out dual-z motors with independent drivers:

    Its it best if my G30 probing locations are equidistant from X center? Just wondering as with my probe on the left side of the extruder, I can probe the far left edge of my bed.

    If the bed is flat, it doesn't matter. In theory the probe points can be anywhere you like, but the more area of the bed that the probe points enclose, the better.


Log in to reply