My Pressure Advance Calibration
-
I wrote some GCode to calibrate pressure advance. I wasn't satisfied with how uncertain I was in reading the other ones I found. They usually try various PA values as a sort of gradient, which sounds fine until you have other artifacts confusing the issue. It also requires some effort to convert the measured height into a k value in many cases.
But what most lacked entirely is a "normal" reference adjacent to each test value. I produced this reference by first laying down some lines at a very slow, steady speed, then putting the test lines right next to it. The picture doesn't quite show how much easier this is to read; I think I succeeded in what I was trying to do. Once removed from the bed, you can try various lighting, including back lighting.
Features:
Only 2 layers, so it doesn't take long. Raft, so it's not sensitive to initial nozzle height. Controlled by variables set at the beginning of the code. PA test values separated by configurable space, so you can read just by counting bands. Configurable number of lines in each band. Configurable for machines with multiple tools. Configurable speeds, temperatures, retraction, layer height & width, bed position, and of course, k values for PA.
Pictured is eSun Fire Engine Red PETG on an E3DV6 (my secondary hot end) at 243°, k values from 0.05 (bottom) to 0.25 (top), increasing 0.01 each band. The bottom of each band is 4 lines at 1,200mm/min. The top of each band is 4 lines of 35mm on each side at 1,200mm/min sandwiching 70mm at 6,000mm/min in the center.
In my experience you can use something like this to find the general value, then do another print with fewer bands and more lines per band to confirm the best k value. My best band on this is the 8th from the bottom, so I'm using k=0.12.This code uses RFF 3.x meta-commands, so it's for Duet hardware. Further, RFF 3.3 and earlier have a bug which doesn't end the lifetime of local variables when a job ends or gets canceled, so you have to do an M999, an emergency stop, or cycle the power between attempts. This will be fixed in RFF 3.4, which has been in beta for several weeks, so it should be out soon.
Please consider this "copylefted".
; set variables var StartX = 50 var StartY = 50 var LinesPerTest = 4 var LinesBetweenTests = 4 var TempBed = 74 var TempTool = 243 var ToolNum = 1 var Width = 0.48 var Height = 0.25 var Retract = 1 var Prime = 7.9 ; Before Raft var PALow = 0.05 var PAHigh = 0.25 var PAIncrement = 0.01 var SpeedRaft = 2000 var SpeedSlow = 1200 var SpeedFast = 6000 var SpeedTravelXY = 9000 var SpeedTravelZ = 1200 var SpeedRetract = 4500 ; Calculated and Utility Variables var TestCount = 1 + floor((var.PAHigh - var.PALow) / var.PAIncrement + 0.5) var FilFactor = var.Width * var.Height / (pi * 1.75 * 1.75 / 4) var PA = var.PALow - var.PAIncrement var Dist = 0 ; PREPARE ;M42 P1 S1 ; Lights Bright T{var.ToolNum} M82 ; Extruder Absolute Mode ; Heat Bed and set Hot Ends to Standby M400 M117 "Heat" M140 S{var.TempBed} ; set Bed Temp M568 P{var.ToolNum} S{var.TempTool} A2 ; set Tool Temp M116 H{var.ToolNum + 1} S1 ; Wait for temp G4 S12 ; Delay to Allow for Overshoot M116 H{var.ToolNum + 1} S1 ; Wait for Recovery M116 H0 S1 ; Wait for Bed M400 M117 "Home" G28 ; BEGIN RAFT M400 M117 "Raft" ; Go to StartX + Width, StartY G90 ; Absolute G92 E0 G0 E{-var.Retract} F{var.SpeedRetract} G1 X{var.StartX + var.Width} Y{var.StartY} F{var.SpeedTravelXY} G1 Z{var.Height} F{var.SpeedTravelZ} G91 ; Relative ; Prime G0 E{var.Prime} F{var.SpeedRetract} G92 E0 var RaftLineCount = floor((floor(139 / var.Width) - 1) / 3) + 1 set var.Dist = (2 * var.TestCount * var.LinesPerTest + var.LinesBetweenTests * (var.TestCount - 1)) * var.Width while iterations < var.RaftLineCount ; Draw Raft Line G0 Y{var.Dist} E{abs(var.Dist) * var.FilFactor} F{var.SpeedRaft} G92 E0 ; Break here if last time if iterations + 1 >= var.RaftLineCount break ; Move Over G0 X{3 * var.Width} E{3 * var.Width * var.FilFactor} F{var.SpeedRaft} G92 E0 set var.Dist = -var.Dist G0 E{-var.Retract} F{var.SpeedRetract} ; Retract ; BEGIN TEST PATTERN M400 M117 "Test Pattern" ; Go to StartX, StartY G90 ; Absolute G1 Z{2 * var.Height} F{var.SpeedTravelZ} G1 X{var.StartX} Y{var.StartY} F{var.SpeedTravelXY} G91 ; Relative while iterations < var.TestCount ; set PA set var.PA = var.PA + var.PAIncrement M572 D{var.ToolNum} S{var.PA} echo "PA=",{var.PA} ; Draw Reference Lines while iterations < var.LinesPerTest G0 E0 F{var.SpeedRetract} ; Unretract G0 X140 F{var.SpeedSlow} E{140 * var.FilFactor} G92 E0 G0 E{-var.Retract} F{var.SpeedRetract} ; Retract G1 Y{var.Width} F{var.SpeedTravelXY} G1 X-140 F{var.SpeedTravelXY} ; Draw Test Lines while iterations < var.LinesPerTest G0 E0 F{var.SpeedRetract} ; Unretract G0 X35 F{var.SpeedSlow} E{35 * var.FilFactor} G0 X70 F{var.SpeedFast} E{105 * var.FilFactor} G0 X35 F{var.SpeedSlow} E{140 * var.FilFactor} G92 E0 G0 E{-var.Retract} F{var.SpeedRetract} ; Retract G1 Y{var.Width} F{var.SpeedTravelXY} G1 X-140 F{var.SpeedTravelXY} ; Move to start of next comparison G1 Y{var.LinesBetweenTests * var.Width} F{var.SpeedTravelXY} ; Finish up M400 M117 "Done" G1 Z10 F{var.SpeedTravelZ} G90 ; Absolute G1 X10 Y280 F{var.SpeedTravelXY} G0 E0 F{var.SpeedRetract} ; Unretract
-
@donstauffer That's very impressive! Probably the best method I've seen so far for calibrating pressure advance. I must give this a try when I get my printer put back together. Thanks for sharing.
-
Hi,
i am very interested in adjust my pressure in advance... and this method looks promissing....
But....
How i can use it? I see its mandatory use FW3.x
I see the gcode has variables.... i never have used....
-
@peirof Yes, you have to have firmware 3.x installed. All you need to do is copy the code to a file (I suggest a .gcode extension) and edit the values to the right of the equals sign. So for example, if you use an extrusion width of 0.44 instead of my 0.48, just change var Width = 0.48 to var Width = 0.44.
StartX & StartY set the front left corner's position on your bed. LinesPerTest controls the Y height of each band so you can make it larger (more lines) to see it better; be aware that the bands have double this many lines in them, because there are this many reference lines, and then this many test lines PALow and PAHigh are the starting and ending pressure advance k values to test, and PAIncrement is the amount to change the k value for each band as it moves back (up in the picture). Together these 3 variables control the Y height of the bands. LinesBetweenTests controls the blank space between the bands.
It's up to you to make sure the combination of lines, spaces between bands, and number of bands created by PALow, PAHigh and PAIncrement don't run out of bed space if they start at (StartX, StartY). Each line is "Width" wide (in the Y direction). So the way I have it set up, the print will be 21 bands (PA 0.05 to 0.25 by 0.01 increments) and each of those 21 bands will be 8 lines (4 reference and 4 test), for a total of 168 lines of bands. Between the bands will be a total of 20 spaces of 4 lines, for a total of 80 lines of space. The grand total is 248 lines, each of which is 0.48mm wide, for a total Y height of about 119mm. So my print went from Y=50 to Y = 169.
The lines are 140mm long (in the X direction). So my print went from X=50 to X=190.
TempBed sets your bed temperature and TempTool sets your hot end temperature. ToolNum would be 0 for most people; I was using my secondary hot end. Height is your layer height. Retract is retraction distance; Prime is how much to prime the hot end with filament before starting to print the raft.
The speeds are probably OK as they are; they're in mm/min. The idea is to have a much faster SpeedFast than SpeedSlow, and compare the results to the reference lines in the band, which print at SpeedSlow. You can set the retraction speed, but for this, you're probably OK leaving it alone.
Once the file looks good just upload and print it just as you would with a file your slicer produced. Alternatively, you can upload it as is without printing it and then edit it in the web interface, then print it.
Does that help?
-
This looks really good. Thanks for sharing. I'm going to give it a try.
Do I need to disable the PA setting in my config.g or will the script set it as the gcode runs?
-
Very interesting.
Can you post a closeup of what you are seeing which tells you what row is the best?
Thanks.
Frederick
-
@donstauffer tried your Code and works perfectly!!!!!
Thank you!
-
@fcwilt Essentially there are two areas along the test lines where the speed is changing. When PA is too low, the one on the left looks too thinly extruded. When PA is too high, the one on the right looks too thinly extruded. Where PA is perfect, the best lines in the band look exactly the same as the reference lines.
-
Hi, what a great tool. I only have one question. I have a Delta printer and I have to set the starting point to X-70 and Y-70. Unfortunately, after the printer has been driven into the home, I only get error messages and the printer stops.
Error: in GCode file line 129 column 9: M117: string too long Cancelled printing file 0:/gcodes/pat.gcode, print time was 0h 3m Error: G0/G1: target position not reachable from current position Error: in GCode file line 115 column 9: M117: string too long
I then tried it with starting point y0 and x0, it starts to print but of course the print does not fit on the bed. Could this be a problem with the negative values?
Maybe you still have an Idea wath i could try elsegreetings Phil
-
@flipps The line that moves the carriage into position for the raft is:
G1 X{var.StartX + var.Width} Y{var.StartY} F{var.SpeedTravelXY}
The line to move into position for the second layer is similar:
G1 X{var.StartX} Y{var.StartY} F{var.SpeedTravelXY}
I don't see anything in the documentation of the G1 command that says it can't be negative, and I think I've even done it in the past.
Documentation for that error message says:
"Usually this means you have a delta printer and your homedelta has a move to position the print head at center. However, it can't reach that point because it would require moving one of the carriages up further than it physically could. The solution is to lower the print head first in Z and then command it to center in X Y."
This seems to suggest that reversing the moves for X & Y with the move for Z might work.
-
@flipps said in My Pressure Advance Calibration:
Error: G0/G1: target position not reachable from current position
On a delta that typically means that the head is very high, close to the homed position, so that movement to the specified XY position isn't possible unless you lower the effector somewhat first.
Error: in GCode file line 115 column 9: M117: string too long
That's a known bug in RRF 3.3. It's fixed in the 3.4beta series, or you can workaround it by using M400 before M117.
-
@dc42 @DonStauffer I added
G1 Z10
before the line
G1 X{var.StartX + var.Width} Y{var.StartY} F{var.SpeedTravelXY}
This workes perfect
Thank you -
Just tried running this.
RRF 3.3.0 and get this messageError: floor((floor(139 / var.Width) - 1) / 3) + 1Expression nesting too deep of PA.g
Is this because I am not running the Beta?
I am not a coder, so not competent in code!My file
PA.gRegards,
Paul