3 Lead Screw Bed Correction (Idiot Check ;-) )



  • Hi All,

    Finally migrated the works machine from Duet 0.6 to Duet Ethernet with Duex5 and a Panel Due. One of the main objectives for this was to enable the three lead screw control in order to automate the set up procedure.

    I've rewired and commissioned the new electronics and checked that my machine coordinates put the head in logical positions in relation to the bed. In addition I've following the steps on the following link to try and get the correction working.

    Have I missed anything obvious? When I view the height map I see an upward slope on the front to the back of the machine?

    https://duet3d.dozuki.com/Wiki/Bed_levelling_using_multiple_independent_Z_motors#How_it_works

    Firmware: 2.0(RTOS)RC1 (2018-05-02b1)
    Web Interface: 1.21.1-RC1
    Machine: 300x300 spauda thingverse
    https://www.thingiverse.com/thing:1001065
    (Modified with third lead screw, relocated original screws, and front of elevator additional wheel guides for the z-axis)

    Critical bits in the config:
    M667 S1 ; Select CoreXY mode
    M208 X0 Y-5.0 Z-10 S1 ; Set axis minima
    M208 X325 Y300 Z299 S0 ; Set axis maxima
    M584 X0 Y1 Z2:5:6 E3 ; Driver 0 controls the X motor, 1 controls Y, 2 and 3 control Z motors, 4 and 5 control E motors.
    M671 X150:-52:352 Y442:50:50 S1 ; Z leadscrews are at (150,441), (-51,50) and (351,50). Max correction 1mm
    M574 X1 Y2 Z2 S1 ; Define active high microswitches
    M558 P4 X0 Y0 Z0 H10 I0 F500 T6000 ; Use switch on E0 for z probing. Not used for homing. Normally closed (I1 = NO).
    G31 X-24.7 Y4 Z20.445 ; sets offset for probe.
    M556 S74.5 X0 Y-0.5 Z-0.5 ; Set orthogonal axis compensation parameters
    M557 X0:297.3 Y2:284 S29.73:28.2 ; Define mesh grid

    My bed.g
    ; Probe the bed near lead screws.
    G30 P0 X150 Y300 H0 Z-99999 ; probe near a leadscrew
    G30 P1 X0 Y50 H0 Z-99999 ; probe near a leadscrew
    G30 P2 X300 Y50 H0 Z-99999 S3 ; probe near a leadscrew and calibrate 3 motors
    G1 X150 Y150 F2000

    My INIT Macro
    M98 P"/sys/homeall.g"
    M98 P"/macros/RunScrewSet"
    M98 P"/macros/BedProbe"

    /macros/RunScrewSet
    G29 S1 P"0:/sys/zeroheightmap.csv" ; Removed bed probe correction.
    G32
    G29 S1 P"0:/sys/heightmap.csv" ; Reloads bed probe correction.

    /macros/BedProbe
    G29 S1 P"0:/sys/zeroheightmap.csv"
    M557 X0:297.3 Y2:284 S29.73:28.2 ; Define mesh grid.
    G1 Z30 F3000 ; Move hot end.
    M98 P"/macros/Centre"
    G29 S0 P"0:/sys/heightmap.csv" ; Run bed probe.
    G1 Z30 F3000 ; Move hot end.
    M98 P"/macros/Centre"

    Notes:
    The centre macro just moves the head to the centre of the build area.
    The zeroheightmap.csv just loads a zeroed out height map. I was concerned that M561 would wipe the orthogonal correction as well as the height map. I guess a better approach may be to use M561 then reload the configuration file at the end.


  • administrators

    M561 and G29 S2 do not affect orthogonal axis correction.

    You may need to run G31 more than once to get the bed sufficiently level, because the mathematical model used assumes perfect gimballed joints between the leadscrews and the bed.



  • @dc42 Thanks for the hints. So does M561 and loading a zeroed height map achieve the same thing?

    You mean run repeated G32? Is there any way to recall the offset settings currently being used, or is it a nudge and forget sort of correction? I understand if it is the latter as in theory this is correcting for an arbitrary loss in position when the motors aren't being driven.



  • Added two more G32 calls to my bed screw calculation and got the following result:

    Maximum deviations: -0.097 / 0.070 mm
    Mean error: -0.003 mm
    RMS error: 0.040 mm

    Happy with that for no faffing about! 🙂



  • I'd like to jump in on this...seems like the right subject for me :).

    My understanding is that G32 just runs bed.g (if it exists, because that's what the documentation says. Since there's a convenient button for it, I've set it up like this:

    ; bed.g
    ; called to perform automatic bed compensation via G32
    ;

    ; Clear any bed transform
    M561
    G29 S2 ; clear compensation (again?)

    G91 ; relative mode
    G1 Z4 ; move Z up 4mm for clearance
    G90 ; absolute mode
    G1 X35 ; get to starting location more quickly
    G1 Y60 ; get to starting location more quickly
    M280 P3 S160 I1 ; clear any alarm
    M401 ; M98 Pdeployprobe.g
    G29
    M402 ; M98 Pretractprobe.g

    Elsewhere in config.g, I have set up my leadscrews:
    M584 X0 Y1 Z2:4 E3 ; Map drives (as above)
    M671 X160:160 Y35:357 ; approximate position in Y of the Z screws (6/2/2018)

    ...and a BLTouch:
    ; BL Touch
    M307 H3 A-1 C-1 D-1 ; reserve pin 8 (Heater 3 PWM) for BL Touch
    M558 P9 X0 Y0 Z1 H3 F200 T3600 R1 ; type 9 (was 5 prior to 1.21), use for Z, Feed rate 200 mm/min,
    ; dive Height 4mm, Travel speed 3600 mm/min, wait 1s (R) before dive
    G31 X-8 Y-41 Z1.66 C0 S0 P25. ; this Z has me using a +0.15mm Z offset in Slic3r for PETG
    M557 X30:240 Y30:240 S105 ; coarse 3x3

    Now, this works fine from the perspective of giving me a grid, but it does not lead the controller to make any improvements in the plane using the leadscrews. I end up doing that myself. And prints are good.

    I'd like the board to straighten out things in the Y plane. I know it can do so. I know I'm missing something, but I have no idea what it is. Help? Thanks!


  • administrators

    @doctrucker said in 3 Lead Screw Bed Correction (Idiot Check 😉 ):

    @dc42 Thanks for the hints. So does M561 and loading a zeroed height map achieve the same thing?

    Very nearly. If you load a height map of all zeros, the firmware will still segment the moves into chunks that are about the same length as the grid spacing.

    You mean run repeated G32? Is there any way to recall the offset settings currently being used, or is it a nudge and forget sort of correction? I understand if it is the latter as in theory this is correcting for an arbitrary loss in position when the motors aren't being driven.

    Yes I mean run repeated G32. If you find that each time you run G32 it under-corrects (i.e. each time you run G32 it corrects by smaller amount in the same direction as previously), then you can use the M671 F parameter ("fudge factor") to over-correct intentionally, for faster convergence.



  • Answering my own question, it appears that bed adjustment is only triggered off a G30 with an S parameter, and only using G30 probes.

    So as best I can tell, best practice would be to probe with G30 some number of times (4-5?), using an S parameter on the last to kick off adjustment of screws, followed by a more thorough mesh compensation run.

    Did I get it right?


  • administrators

    @paralepsis said in 3 Lead Screw Bed Correction (Idiot Check 😉 ):

    Answering my own question, it appears that bed adjustment is only triggered off a G30 with an S parameter, and only using G30 probes.

    So as best I can tell, best practice would be to probe with G30 some number of times (4-5?), using an S parameter on the last to kick off adjustment of screws, followed by a more thorough mesh compensation run.

    Did I get it right?

    Yes. Depending on how well your printer is built and the size of the print, you may not need mesh bed compensation. I use it all the time on my SCARA printer, but hardly ever on my Cartesian and Delta printers.


Locked
 

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