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

    Pressure advance Tuning like Klipper

    Scheduled Pinned Locked Moved
    Tuning and tweaking
    11
    15
    1.6k
    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.
    • Vetiundefined
      Veti
      last edited by Veti

      I liked to way that klipper does the pressure advance tuning, so i worked out how to do the same for the duet.

      the steps are the same as the klipper guide with the follow differences.
      https://github.com/KevinOConnor/klipper/blob/master/docs/Pressure_Advance.md

      Setting the acceleration is done via

      M201 X500 Y500
      

      instead of the TUNING_TOWER COMMAND we use a prusaslicer feature.
      In the Printer settings for custom g-code we set the After layer change g-code to

      M572 D0 S{layer_z*0.005}
      

      or for boden

      M572 D0 S{layer_z*0.02}
      
      zaptaundefined 1 Reply Last reply Reply Quote 4
      • PCRundefined
        PCR
        last edited by

        Thank you!!!

        1 Reply Last reply Reply Quote 0
        • nick9one1undefined
          nick9one1
          last edited by

          A slight addition to this is how to include the starting pressure advance.

          Once you have used the original 'after layer change' code to get a rough idea of where the sweet spot is you can use the gcode below.

          For my printer the sweet spot was about 0.5. So I printed again, starting at 0.4 and up to 0.65

          M572 D0 S{(layer_z*0.005)+0.4}
          
          1 Reply Last reply Reply Quote 0
          • gringoundefined
            gringo
            last edited by

            Do both Lines come into the Slicer in the Custom GCode before Layer Change?

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

              @gringo

              only the M572, the M201 you can execute before print starts manually

              1 Reply Last reply Reply Quote 0
              • zaptaundefined
                zapta @Veti
                last edited by

                @Veti said in Pressure advance Tuning like Klipper:

                M572 D0 S{layer_z*0.005}

                Is there a way to have an expression that will set it up in 'bands' rather than gradual on every layer? May be easier to determine the best value.

                OwenDundefined 1 Reply Last reply Reply Quote 0
                • OwenDundefined
                  OwenD @zapta
                  last edited by OwenD

                  @zapta said in Pressure advance Tuning like Klipper:

                  @Veti said in Pressure advance Tuning like Klipper:

                  M572 D0 S{layer_z*0.005}

                  Is there a way to have an expression that will set it up in 'bands' rather than gradual on every layer? May be easier to determine the best value.

                  You could use something

                  If mod(layer_z,5)==0
                       M572 D0 S{layer_z*0.005}
                  

                  This would only increment every 5 layers.
                  Note this is untested and Prusa slicer can get funny about if statements in its gcode sections as it trys to evaluate them itself using its own rules
                  You may have to wrap the whole expression in curly brackets or something

                  EDIT: actually I think I recall prusa slicer won't allow indenting in the layer gcode so this may not work

                  EDIT
                  A quick search revealed something like this should work in prusa slicer... again untested

                  {if layer_z % 5 == 0}M572 D0 S{layer_z*0.005}{endif}
                  
                  zaptaundefined 1 Reply Last reply Reply Quote 0
                  • zaptaundefined
                    zapta @OwenD
                    last edited by zapta

                    @OwenD said in Pressure advance Tuning like Klipper:

                    {if layer_z % 5 == 0}M572 D0 S{layer_z*0.005}{endif}

                    Mathematically this seems right. You may want to multiply 0,005 by 5 to have the same range (5 layers per band). Bands make it easier to identify the best value.

                    May be worth replacing the gcode in https://duet3d.dozuki.com/Wiki/Pressure_advance with a simplified one along these lines.

                    1 Reply Last reply Reply Quote 0
                    • OwenDundefined
                      OwenD
                      last edited by

                      actually mod() won't work as layer_z is a floating point number.
                      It would work with layer_num but that makes determining the value used at a specific height different to the example.

                      1 Reply Last reply Reply Quote 0
                      • oliofundefined
                        oliof
                        last edited by

                        In RRF, metacommand function mod works with floats, so use if mod(floor(move.axes.2.machinePosition), 5.0) maybe? Untested.

                        <>RatRig V-Minion Fly Super5Pro RRF<> V-Core 3.1 IDEX k*****r <> RatRig V-Minion SKR 2 Marlin<>

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

                          if you actually print with the gradual change, its a lot easier to determine where the optimal line is as its a gradual change. and using the calipers gives you an easy way to calculate the right value.

                          1 Reply Last reply Reply Quote 0
                          • 3dMLundefined
                            3dML
                            last edited by 3dML

                            @Veti
                            Create a macro and call it at layer change. Much easier to update the macro instead of slicing the file for every change.
                            You can call macros from the macro folder using the full file location similar to

                            M98 P"0:/macros/Calibrate Things"
                            

                            Put something similar to this in the macro. Again this particular code is untested.

                            If mod(layer_z,5)==0
                                 M572 D0 S{layer_z*0.005}
                                 echo {move.axes[2].userPosition} ; change 2 in axes[2] to the z axis for your machine
                                 echo {layer_z*0.005}
                            

                            This will report the the z height and the PA value every time it changes.

                            1 Reply Last reply Reply Quote 1
                            • littlehobbyshopundefined
                              littlehobbyshop
                              last edited by littlehobbyshop

                              Adding to what @3dML said...

                              This macro has been tested and works nicely, change tool no./layer height/increment value to suit. It also covers the case where you want to start from a value other than 0, simply change the first M572 parameter.

                              ;Increase pressure advance by 0.005 every 5 layers
                              if job.layer == 0
                              	M572 D0 S0 ; starting value
                              	echo "Layer " ^ job.layer ^ " started"
                              	echo "Pressure advance reset to " ^ {move.extruders[0].pressureAdvance + 0.000}
                              elif mod(job.layer, 5) == 0 ; no. of layers
                              	M572 D0 S{move.extruders[0].pressureAdvance + 0.005} ; increment
                              	echo "Layer " ^ job.layer ^ " started"
                              	echo "Pressure advance = " ^ {move.extruders[0].pressureAdvance + 0.000}
                              

                              Interestingly the "+ 0.000" is required to force the console to print 3 decimal places, otherwise it rounds down to 2.

                              BLV MGN Cube w/Hemera, K8200, Sunlu S8

                              dc42undefined 1 Reply Last reply Reply Quote 2
                              • SIamundefined
                                SIam
                                last edited by SIam

                                small update for the macro the first layer is not == 0 rather == null

                                it seems that the prusaslicer execute the macro first on the 1 layer so the pa value will never resets to 0

                                ;Increase pressure advance by 0.005 every 5 layers
                                
                                if job.layer == 1
                                
                                	M572 D0 S0 ; starting value
                                
                                	echo "Layer " ^ job.layer ^ " started"
                                
                                	echo "Pressure advance reset to " ^ {move.extruders[0].pressureAdvance + 0.000}
                                
                                elif mod(job.layer, 5) == 0 ; no. of layers
                                
                                	M572 D0 S{move.extruders[0].pressureAdvance + 0.020} ; increment
                                
                                	echo "Layer " ^ job.layer ^ " started"
                                
                                	echo "Pressure advance = " ^ {move.extruders[0].pressureAdvance + 0.000}
                                

                                Hypercube-Evolution-Hybrid, Piezo Orion, Orbiter
                                Duet WiFi 1.02 or later + DueX5
                                RepRapFirmware for Duet 2 WiFi/Ethernet 3.4.0beta4 (2021-09-27 11:30:36)
                                Duet WiFi Server: 1.26
                                Duet Web Control 3.4.0beta4 (2021-09-27)

                                1 Reply Last reply Reply Quote 1
                                • dc42undefined
                                  dc42 administrators @littlehobbyshop
                                  last edited by

                                  @littlehobbyshop said in Pressure advance Tuning like Klipper:

                                  Interestingly the "+ 0.000" is required to force the console to print 3 decimal places, otherwise it rounds down to 2.

                                  That's because each object model value has its own default number of decimal places, which for pressure advance is 2. If you can show that a difference of less than 0.01 in pressure advance has a measurable effect, I will increase that to 3.

                                  Duet WiFi hardware designer and firmware engineer
                                  Please do not ask me for Duet support via PM or email, use the forum
                                  http://www.escher3d.com, https://miscsolutions.wordpress.com

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