Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Independent lead screw bed levelling

    Scheduled Pinned Locked Moved
    Tuning and tweaking
    3
    16
    1.2k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Gerrardundefined
      Gerrard
      last edited by

      My printer has 4 independent lead screws for Z height - each running off it's own driver - the bed size is about 800x800, so it's not unusual to see 3-5mm difference between screws on opposite corners of the bed (most often after a fault of some kind - but that's a separate discussion)

      I use mesh bed levelling (G29) for the most part, but that really only works if the bed is levelled to a reasonable tolerance to start with - I currently do this by moving the head to each screw location and manually turning the screw, but it's real pain.

      What I want - and what G32 seems to offer is to define the location of the screws, probe a point, then adjust the screws so they're all the same height immediately after performing the G32 routine, and then I would proceed with G29 mesh level. (After all - why would you adjust it with each print if you could just adjust it once?)

      What I think happens - is that the compensation just occurs during the print in a similar way to G29.

      So - Is this correct, and if so, is there a way where I can adjust each motor independently (via macro, manually or other) to pre-level the bed?

      Gerrardundefined 1 Reply Last reply Reply Quote 0
      • Gerrardundefined
        Gerrard @Gerrard
        last edited by

        I just noticed that G0/1 has a H2 parameter, described here as "individual motor mode", but also described in the table on the same page as "Ignoring endstops while moving...."

        I'm assuming the "individual motor mode" is incorrect? If not, how do you use it?

        1 Reply Last reply Reply Quote 0
        • Phaedruxundefined
          Phaedrux Moderator
          last edited by

          See the difference between

          https://duet3d.dozuki.com/Wiki/Using_mesh_bed_compensation#main

          and

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

          Z-Bot CoreXY Build | Thingiverse Profile

          1 Reply Last reply Reply Quote 0
          • Gerrardundefined
            Gerrard
            last edited by

            Thanks - I've read through those in a bit of detail - but what I'm observing isn't what I'm expecting.

            After running G32, I notice that the z axis still moves up and down to compensate - just like it would with G29. What I want is for the compensation to occur at the end of the G32 command, and not during the print.

            Looking at it closer, I noticed that after multiple G32 routines, the results are changing - not quite converging though. I would expect that it's easy to test it, then make all Z values zero...

            I decided to have a crack at solving it with a macro, so I wrote this.

            Caveats - the H Parameter in M558 is intended to capture the maximum tolerance that you are trying to compensate - so you still need to manually get the bed level close, but that's easier than getting it <1mm close.

            Basically the macro just re-assigns the Z axis to only 1 driver at a time, and probes close to the lead screw.

            It seems to work and definitely takes out the big twists - though I don't particularly like the idea of twisting the bed for each probe.

            
            M558 P9 H3              ; set Z probe type to bltouch and the dive height + speeds
            
            M98 P"homeall.g"
            
            G0 X0 Y250 F12000	;MOVE TO FIRST POINT
            M584 Z6			;ASSIGN FIRST MOTOR DRIVER (6) TO ZAXIS
            G30 Z0			;PROBE FIRST POINT
            
            G0 X0 Y650 F12000	;MOVE TO FIRST POINT
            M584 Z5			;ASSIGN FIRST MOTOR DRIVER (5) TO ZAXIS
            G30 Z0			;PROBE FIRST POINT
            
            G0 X800 Y650 F12000	;MOVE TO FIRST POINT
            M584 Z7			;ASSIGN FIRST MOTOR DRIVER (7) TO ZAXIS
            G30 Z0			;PROBE FIRST POINT
            
            G0 X800 Y250 F12000	;MOVE TO FIRST POINT
            M584 Z8			;ASSIGN FIRST MOTOR DRIVER (8) TO ZAXIS
            G30 Z0			;PROBE FIRST POINT
            
            M584 Z5:6:7:8		;RE-ASSIGN TO ALL DRIVERS.
            
            
            1 Reply Last reply Reply Quote 0
            • Vetiundefined
              Veti
              last edited by

              post your config.g and your bed.g

              After running G32, I notice that the z axis still moves up and down to compensate

              G32 does not do that. that means your mesh is still loaded.

              1 Reply Last reply Reply Quote 0
              • Phaedruxundefined
                Phaedrux Moderator
                last edited by

                Post the rest of your config files.
                Do you load the mesh in homeall or bed.g or your slicer start gcode?

                Z-Bot CoreXY Build | Thingiverse Profile

                1 Reply Last reply Reply Quote 0
                • Phaedruxundefined
                  Phaedrux Moderator
                  last edited by

                  I see from your other thtread where you have posted your config that you are loading the heightmap in your config.g file. You shouldn't do that as it applies the heightmap before the bed Z0 position has even been determined.

                  ; Z-Probe
                  M307 H3 A-1 C-1 D-1 ; disable heater on PWM channel for BLTouch
                  M558 P9 H5 F120 T6000 ; set Z probe type to bltouch and the dive height + speeds
                  G31 P500 X-21.6 Y9.4 Z3.2 ; set Z probe trigger value, offset and trigger height - **PREVIOUS Z VALUE = Z1.35
                  M557 X40:800 Y40:760 S78 ; define mesh grid - AS DESIGNED
                  ;M557 X270:530 Y270:530 S52 ; define mesh grid - FOR TESTING ONLY
                  M376 H5 ; Set bed compensation taper (layers to fade out bed compensation)
                  G29 S1

                  Remove the G29 S1 from config.g

                  Z-Bot CoreXY Build | Thingiverse Profile

                  1 Reply Last reply Reply Quote 0
                  • Gerrardundefined
                    Gerrard
                    last edited by

                    bed.g

                    ; bed.g
                    ; called to perform automatic bed compensation via G32
                    ;
                    ; generated by RepRapFirmware Configuration Tool v2.1.8 on Mon Mar 30 2020 11:14:17 GMT+1000 (Australian Eastern Standard Time)
                    
                    M561 ; clear any bed transform
                    ;G28 ; home
                    
                    G30 P0 X0 Y250 Z-99999 ; probe near a leadscrew
                    G30 P1 X0 Y650 Z-99999 ; probe near a leadscrew
                    G30 P2 X800 Y650 Z-99999 ; probe near a leadscrew and calibrate 3 motors
                    G30 P3 X800 Y250 Z-99999 S4
                    
                    ;G29  ; probe the bed and enable compensation
                    

                    config.g

                    ***with G29 S1 removed

                    ; Configuration file for Duet WiFi (firmware version 2.03)
                    ; executed by the firmware on start-up
                    ;
                    ; generated by RepRapFirmware Configuration Tool v2.1.8 on Mon Mar 30 2020 11:14:18 GMT+1000 (Australian Eastern Standard Time)
                    
                    ; General preferences
                    G90                                       ; send absolute coordinates...
                    M83                                       ; ...but relative extruder moves
                    M550 P"Point Zero CoreXY"                 ; set printer name
                    
                    M667 S1                                   ; select CoreXY mode
                    
                    ; Network
                    M552 S1                                   ; enable network
                    M586 P0 S1                                ; enable HTTP
                    M586 P1 S0                                ; disable FTP
                    M586 P2 S0                                ; disable Telnet
                    
                    ; Drives
                    M569 P0 S1                                ; physical drive 0 goes backwards
                    M569 P1 S1                                ; physical drive 1 goes forwards
                    M569 P5 S0                                ; physical drive 5 goes backwards
                    M569 P6 S0
                    M569 P7 S0
                    M569 P8 S0
                    M569 P4 S0                                ; physical drive 3 goes backwards
                    M584 X1 Y0 Z5:6:7:8 E4                    ; set drive mapping
                    M671 X200,400,200,400 Y-60,-60,875,875 S5.0 P2.0	  ; Set location of z leadscrews for independant bed levelling.
                    M350 X16 Y16 Z16 E16 I1                   ; configure microstepping with interpolation 
                    M92 X80.00 Y80.00 Z1600.00 E412.0         ; set steps per mm
                    M566 X600.00 Y600.00 Z20.00 E1200.00      ; set maximum instantaneous speed changes (mm/min)				*** PREVIOUS VALUES X&Y:600 Z12 E900
                    M203 X8000.00 Y8000.00 Z400.00 E1500      ; set maximum speeds (mm/min)
                    M201 X800.00 Y800.00 Z100.00 E600.00      ; set accelerations (mm/s^2)							*** PREVIOUS VALUES X400 Y400.00 Z10.00 E150.00
                    M204 P1200 T4000			  ; print and travel acceleration
                    M906 X1600 Y1600 Z600 E1200 I30           ; set motor currents (mA) and motor idle factor in per cent
                    M84 S30                                   ; Set idle timeout
                    M593 F80				  ; Set Dynamic Acceleration Adjustment
                    M572 D0 S0.05				  ; Set extruder pressure advance
                    M915 P0:1 S7 F1 H200 R3			  ; Set up stall detection
                    
                    
                    ; Axis Limits
                    M208 X0 Y0 Z0 S1                          ; set axis minima
                    M208 X860 Y800 Z750 S0                    ; set axis maxima
                    
                    ; Endstops
                    M574 X1 Y1 S1
                    M574 Z0 S0                          	  ; set active high endstops
                    M591 D0 P5 C3 R5:120 E20.0 S1		  ; Configure Laser filament sensor for extruder drive 0.
                    
                    ; Z-Probe
                    M307 H3 A-1 C-1 D-1                       ; disable heater on PWM channel for BLTouch
                    M558 P9 H5 F120 T12000                     ; set Z probe type to bltouch and the dive height + speeds
                    G31 P500 X-21.6 Y9.4 Z3.2                 ; set Z probe trigger value, offset and trigger height - **PREVIOUS Z VALUE = Z1.35
                    M557 X40:800 Y40:760 S78                  ; define mesh grid - AS DESIGNED
                    ;M557 X270:530 Y270:530 S52               ; define mesh grid - FOR TESTING ONLY
                    M376 H10				  ; Set bed compensation taper (layers to fade out bed compensation)
                    
                    
                    ; Heaters
                    M307 H0 B0 S1.00                          ; disable bang-bang mode for the bed heater and set PWM limit
                    M305 P0 T100000 B4138 R4700               ; set thermistor + ADC parameters for heater 0
                    M143 H0 S120                              ; set temperature limit for heater 0 to 120C
                    M305 P1 T100000 B4138 R4700               ; set thermistor + ADC parameters for heater 1
                    M143 H1 S280                              ; set temperature limit for heater 1 to 280C
                    M305 P2 T100000 B4138 R4700               ; set thermistor + ADC parameters for heater 1
                    M143 H2 S280                              ; set temperature limit for heater 1 to 280C
                    
                    M305 P101 S"Duet 2" T100000 B4725 R4700	  ; Duet 2 Drivers Over Temp Warning
                    M305 P102 S"Duex 5" T100000 B4725 R4700	  ; Duex 5 Drivers Over Temp Warning
                    
                    ; Fans
                    M106 P0 S0 I0 F25000 H1 T45               ; set fan 0 value, PWM signal inversion and frequency. Thermostatic control is turned on
                    M106 P1 S1 I0 F500 H-1                    ; set fan 1 value, PWM signal inversion and frequency. Thermostatic control is turned off
                    
                    ; Tools
                    M563 P0 D0 H1 F0                          ; define tool 0
                    G10 P0 X0 Y0 Z0                           ; set tool 0 axis offsets
                    M563 P1 D0 H2 F0                          ; define tool 1
                    G10 P1 X0 Y20 Z0                          ; set tool 1 axis offsets
                    G10 P1 R0 S0
                    G10 P0 R0 S0                              ; set initial tool 0 active and standby temperatures to 0C
                    
                    ; Custom settings are not defined
                    

                    Now that G29 S1 is removed - should it be added somewhere else?

                    Vetiundefined 1 Reply Last reply Reply Quote 0
                    • Vetiundefined
                      Veti @Gerrard
                      last edited by

                      @Gerrard said in Independent lead screw bed levelling:

                      Now that G29 S1 is removed - should it be added somewhere else?

                      at the start of your slicer g code after the G28

                      M305 P0 T100000 B4138 R4700 ; set thermistor + ADC parameters for heater 0
                      M305 P1 T100000 B4138 R4700 ; set thermistor + ADC parameters for heater 1
                      M305 P2 T100000 B4138 R4700 ; set thermistor + ADC parameters for heater 1

                      Your thermistor config is wrong. find the correct beta value in your thermistor documentation.

                      Gerrardundefined 1 Reply Last reply Reply Quote 0
                      • Gerrardundefined
                        Gerrard @Veti
                        last edited by

                        @Veti said in Independent lead screw bed levelling:

                        at the start of your slicer g code after the G28

                        Done.

                        Your thermistor config is wrong. find the correct beta value in your thermistor documentation.

                        I don't have documentation, and they seem to be working fine.

                        So I ran G32 twice - expecting that Z height would be close to zero after the first time - but it's (almost) exactly the same. So G32 hasn't made any changes to the Z height.

                        I then ran my macro above, followed by G32 (only because I can't report the Z height any other way - that I know of), and the results were much closer - see image below.

                        2020-11-14_16-13-29.png ![alt text](![image url](image url))

                        Vetiundefined 1 Reply Last reply Reply Quote 0
                        • Vetiundefined
                          Veti @Gerrard
                          last edited by

                          @Gerrard
                          what firmware version are you using?

                          that suggest that its not actually adjusting but using the old bed compensation.

                          1 Reply Last reply Reply Quote 0
                          • Phaedruxundefined
                            Phaedrux Moderator
                            last edited by Phaedrux

                            Again from your other thread.
                            M122
                            === Diagnostics ===
                            RepRapFirmware for Duet 2 WiFi/Ethernet version 2.05 running on Duet WiFi 1.02 or later + DueX5

                            However, you're not using the independent lead screw leveling as described in that link, your just using bed.g to probe a list of points and make a fitted plane, which is just a crude for of mesh bed leveling.

                            To do the leveling automatically you need to define the position of the lead screws in your config.g with M671 based on their location relative to 0,0. Then probe close as possible to them in bed.g.

                            Are you sure you have the right coordinates for the lead screws in M671?

                            Are the points probed in the same order as the drivers are listed in M584?

                            It is a good idea to do a single G30 probe at the center of the bed at the end of bed.g to reestablish the Z0 point since the tilting of the bed can change the z height.

                            https://duet3d.dozuki.com/Wiki/Gcode#Section_M671_Define_positions_of_Z_leadscrews_or_bed_levelling_screws

                            Also, it looks like you're setting a P parameter in your M671, which is intended for manual adjustment of a bed leveling bolt.

                            Pnnn Pitch of the bed levelling screws (not used when bed levelling using independently-driven leadscrews). Defaults to 0.5mm which is correct for M3 bed levelling screws.

                            So remove the P2

                            and I don't think your syntax for the M671 command is correct.

                            Your syntax:

                            M671 X200,400,200,400 Y-60,-60,875,875 S5.0 P2.0

                            Example:

                            M671 X-15.0:100.0:215.0 Y220.0:-20.0:220.0 ; Z leadscrews are at (-15,220), (100,-20) and (215,220)

                            The order of your homing and leveling operations should be

                            G28 to home all axis for safe movement
                            G32 to level the bed using bed.g
                            G29 to create a new heightmap

                            Technically you could combine all of that into bed.g itself and then call G32 in your slicer start gcode, but I prefer to leave G28 and G29 out of bed.g to keep it more modular.

                            Z-Bot CoreXY Build | Thingiverse Profile

                            1 Reply Last reply Reply Quote 0
                            • Gerrardundefined
                              Gerrard
                              last edited by

                              There's a few things here to digest, so I hope I've understood your points correctly.

                              @Phaedrux said in Independent lead screw bed levelling:

                              However, you're not using the independent lead screw leveling as described in that link, your just using bed.g to probe a list of points and make a fitted plane, which is just a crude for of mesh bed leveling.

                              This is what I'm observing, but not what I expected.

                              To do the leveling automatically you need to define the position of the lead screws in your config.g with M671 based on their location relative to 0,0. Then probe close as possible to them in bed.g.
                              Isn't this what I've done in my config.g (above)?

                              M671 X200,400,200,400 Y-60,-60,875,875 S5.0   ; Set location of z leadscrews for independant bed levelling.
                              

                              Oh... I think I have the coordinates wrong - some time ago my X and Y were rotated 90deg... my X and Y coordinates should be transposed.
                              My coordinates are: (-60,200), (-60, 400), (875,400), (875,200)

                              I take your point about the P2 Parameter - I've removed that. I misunderstood what was written in the wiki.

                              Are the points probed in the same order as the drivers are listed in M584?

                              No, drivers 5 and 6 are swapped for no particular reason. I'll correct that too.

                              Agree with your order of operations - that's what I have been doing.

                              So, with M671 correctly defined, is bed.g right?

                              1 Reply Last reply Reply Quote 0
                              • Phaedruxundefined
                                Phaedrux Moderator
                                last edited by

                                I still don't think your M671 syntax is correct.

                                M671 X-15.0:100.0:215.0 Y220.0:-20.0:220.0

                                Note the use of : between the points, not commas.

                                Send M98 P"config.g" in the console to check for any syntax errors. See if it complains. But the fact that your screen shot shows an error message indicating that it's doing the old style of plane fitting and not the actual independent correction it would seem it's not detecting your M671 command as valid at all.

                                @Gerrard said in Independent lead screw bed levelling:

                                So, with M671 correctly defined, is bed.g right?

                                That will be up to you to check. The order of the points in bed.g needs to match the order of the motors in M584, otherwise it will try to rip your bed apart by adjusting the wrong motors.

                                Z-Bot CoreXY Build | Thingiverse Profile

                                1 Reply Last reply Reply Quote 1
                                • Gerrardundefined
                                  Gerrard
                                  last edited by

                                  How about that... syntax was the problem!

                                  Thanks for the help

                                  2020-11-14_17-08-11.png

                                  1 Reply Last reply Reply Quote 0
                                  • Phaedruxundefined
                                    Phaedrux Moderator
                                    last edited by

                                    Hazzah! How 'bout that.

                                    I am still curious if running M98 P"config.g" would have shown that as an error.

                                    Z-Bot CoreXY Build | Thingiverse Profile

                                    1 Reply Last reply Reply Quote 0
                                    • First post
                                      Last post
                                    Unless otherwise noted, all forum content is licensed under CC-BY-SA