Mesh bed level compensation problem

  • I have had a problem with mesh bed level compensation that cropped over over the last day or so. Essentially it does not seem as though it is compensating enough, or correctly. The height map generated looks about right, but the layers on the back of the bed are consistently more squished, and the ones on the front don't stick. This issue is present across all 3 of our prototype printers with identical hardware and firmware versions and config. I have tried both black buildtak and pei to see if it was an issue with the surface reflectivity and got the exact same results.

    The z motors do rotate during printing moves which indicates mesh compensation is active, but they do not seem to be moving as much as they need to.

    My only thought at this point is perhaps the probe is too offset from the nozzle, but given the bed being very flat I would think that this should not cause much of an issue. I have manually made sure the bed is at worst no more than +-.25mm out of level, which as I understand it mesh compensation should be able to account for.

    Thank you in advance for your time/advice.


    • CoreXY
    • IR probe offset from nozzle X-25 Y25
    • X and Y home to max
    • Build plate is machined aluminum and is very flat.


    M291 P"Bed level compensation in progress..." R"Bed Leveling" S1 T0
    G1 Z5 F3000
    M98 P/sys/homez.g
    M98 P/sys/homex.g
    M98 P/sys/homey.g
    G1 X25 Y25 F 4000 ; move to first probe point
    M561 ; clear any stored bed leveling info
    G1 X-12.5 Y0 Z5 F4000
    M292 P0

    z-probe and probe grid config located in config.g
    M558 P1 H5 F120 T6000 ; Set Z probe type to unmodulated and the dive height + speeds
    G31 P500 X-25 Y25 Z1.65 ; Set Z probe trigger value, offset and trigger height
    M557 X0:200 Y25:200 S87.5 ; Define mesh grid

  • Moderator

    For reference, but I'm sure you've seen it.

    Does the G30 S-1 give different results at different XY locations on the bed?

    How are you confirming +-.25mm out of level?

    If you send the nozzle to Z0 at various locations along the bed does it just touch, or is there a gap?

    Have you checked for repeatability of the Z axis? If you send it to Z10, Z0, Z100, Z0, several times does it end up back at Z0? If not, Is there binding? Lost steps? Acceleration too high?

  • G30 S-1 does give different results at different locations.

    We placed a sheet of paper on the print bed and jogged the z axis until the paper was just barley pined in place by the nozzle. This was done if four corners and we never had to jog more that +-.25mm to get this to happen.

    After auto-leveling the nozzle touches in the back two corners but not in the front two. The z-axis is moving during these moves so compensation is active.

    As far as I tell the z-axis has no repeatability issues.

    I have tried reducing the z acceleration and jerk to see if that changed anything with no noticeable difference.

    I also tried wiring the z motors in parallel to see if that changed anything as they are low current motors and parallel is supposed to be better for low current motors on the Duet.

    It almost seems like the bed leveling is the reverse of what it should be back to front.

  • @phaedrux Okay, after more testing, it appears that after bed probing has been done via G29 and M557 bed level compensation is active as the Z motors move during XY movement. Further, with level compensation active the z probe measures different z heights at each of the 4 corners of the bed. It should read the same hight when level compensation is active, no?

    If a single point is probed multiple times the z probe gives a very repeatable height value. Even if I probe another point and come back to that first point the z probe measures a height that is within .01mm or better.

    I have tried intentionally making the bed out of level in both the X and Y directions to see if this affected the level compensation results. The hight map shows the change. However, when printing I get the exact same results. It's like the level compensation is working perfectly, but leveling to a plane that is not level. In other words no matter what I do the nozzle is further from the bed in the front than in the back.

  • Moderator

    @jckray is there a mechanical aspect to your probe mount that could explain why the trigger height varies with XY position?

  • @phaedrux

    I've done a lot more testing and am still experiencing the issue. It seems I have gotten a slight improvement by repositioning the probe from X-25 Y25 to X-29 Y0. I cannot get the probe any closer in the x-direction due to the design of the tool head.

    My latest theory has been that there is some tilt in the tool head front to back and that the till is different when probing the front versus the back of the bed. Centering the probe on the head in the y-direction seems to show slight improvement adding some credibility to the theory. However, the tool head is pretty rigid and I find it hard to believe that it is moving enough to cause a 200um or so error in the probe measurements from the front of the bed to the back.

    Other things I have tried include

    • probing with the interior lighting on and off (no change)
    • shrinking the probed area (no change)
    • 4 point and 9 point mesh leveling (no change)
    • rotating the probe 90 degrees to align parallel with the x-axis instead of the y-axis. (no change)

    The result is always too close to the bed in the back and too far in the front. I will continue to test and update this thread with my findings. If anyone has any theories or ideas of things to test, please let me know.

  • Moderator

    As a test, switch your probe type to use manual Z positioning and do a manageable size grid. This way you can see what a heightmap looks like when using the nozzle itself as a probe. Depending on how stable your bed geometry is, you may be able to just save and load this manual heightmap and it could stay valid for quite a long time. Then the probe could just be used for homing Z.

  • @phaedrux Did the manual level and compared to what I got with the IR probe. The manual level produced a pretty good first layer. I ran the leveling with the probe a couple times to make sure the results were not varying by more than the expected amount (~10um). In theory, the delta between a manual probe and a IR probe at each point should be the same if both are being done accurately. i.e. if point one is manually probed and gives a value of A and IR probed is A+B, then the other points should have the same difference of B. I did not get this. I should probably repeat the test more times to be sure, but I found that the delta of the manual vs IR between the two back points and the two front points was on average 76um. This is in line with what I am seeing when running a print, however, the variance front to back seems like more than ~76um.

    Here are the grids that I got
    IR #1
    -1.669, -2.078
    -1.224, -1.518

    IR #2
    -1.672, -2.097
    -1.217, -1.504

    Manual #1
    -1.800, -2.240
    -1.140, -1.460

    Delta Manual and IR #1
    0.131, 0.162
    0.084, 0.058

    Not sure this can really be too conclusive as the manual level has a large human error factor and I have not conducted enough trials. However, since the manual probe did yield a good first layer and the IR probe did not, it does seem that there is an issue with the Ir probe measuring the correct height.

    My company is planning on selling this printer and would like to avoid manual leveling, which is why I would like to get to the bottom of this IR probe issue.

    Hopefully, that's not too confusing, its the end of the day and I'm tired so probably not being the most articulate.

  • Moderator

    Agreed that manual probing is not a viable solution. Though I'm not really sure how best to proceed. @dc42 any ideas?

  • administrators

    Which IR probe are you using, the Escher3D one (sold by Duet3D) or something else? What is the bed surface?

    I suggest you measure the trigger height of the IR probe separately at all 4 points. Also at each point, with the nozzle just touching the bed use feeler gauges to measure the height of the IR sensor above the bed. That will tell you whether varying tilt is a significant factor.

    Also I suggest you try probing a larger grid e.g. 10x10 and show us the height map. That will give us an idea of the overall shape of the bed/gantry plane, and the variability of the IR probe trigger height.

  • @dc42

    I'm using the IR probe sold by Duet3d

    My bed is 205mm x 205mm so I am already probing the largest grid I can considering the probe offset from the nozzle.

    Measuring the trigger height at each of the 4 points yielded these results.

    Point 1 ( X5 Y5) = 1.627
    Point 2 (X170 Y5) = 1.665
    Point 3 (X170 Y200 = 1.625
    Point 4 (X35 Y200) = 1.599

    I measured the trigger height at each point 3 times to make sure the probe was measuring a consistent result, which it was doing within a 5um or so. These results seem pretty good as the 66um variance between the highest and lowest trigger value could easily be accounted for by human error when jogging the nozzle to just touching the bed.

    I don't have a set of feeler gauges on hand but have ordered some. How much does the probe have to be tilted for it to significantly affect the results? Yes, there is a small amount of play in my tool head, but overall it is pretty good for a 3D printer. I have a hard time believing the slight tilt if any of the head would cause such a noticeable problem.

    I also ran G29 and got the flowing height map

    RepRapFirmware height map file v2 generated at 2019-00-03 11:17, mean error -1.855, deviation 0.331
    -2.010, -2.317
    -1.468, -1.625

    I then jogged the z-axis until the nozzle just gripped a sheet of paper at one point then move the nozzle to other points on the bed to see if the z-axis would need to adjust to continue gripping the paper. It did by up to 120um. Level compensation was active during this test as I could see the z lead screw rotating as I moved the tool head around in x and y.

    I'm pretty baffled at this point.

  • Moderator

    Can you redo your G29 with less spacing between points so you get more than just 4?

    And can you post a screen shot of the resulting height map image from the DWC?

  • @phaedrux @dc42

    Here is a 25 point grid. Bed is 6mm machined aluminum, with a spring steel print surface magnetically attached. The spring steel print surface has a sheet of PEI laminated to it. I have also been testing black BuildTak with identical results to the PEI.

    0_1546545439971_Screenshot (20).png

    and here is the data set

    RepRapFirmware height map file v2 generated at 2019-00-03 11:53, mean error 0.123, deviation 0.247
    -0.045, -0.016, -0.106, -0.228, -0.346
    0.092, -0.011, -0.034, -0.114, -0.218
    0.213, 0.209, 0.117, 0.019, -0.108
    0.421, 0.302, 0.329, 0.188, 0.074
    0.553, 0.479, 0.431, 0.487, 0.397

    Here is a picture of the build plate and te tool head. You can also see the IR probe mounted on the left side of the tool head. Tought it might be usful to have a visual of the hardware. I can provide more pictures if needed.


  • @Phaedrux @dc42

    I decided to go back and try an old form of bed probing I used to use and it worked perfectly. I have copied the code below. I have no idea why G29 is not working, but this is. Any ideas? Also, I really appreciate all the help both of you have been providing!

    ; Probe the bed at 4 points
    G1 F2000
    G30 P0 X5 Y5 H0 Z-9999
    G30 P1 X5 Y200 H0 Z-9999
    G30 P2 X175 Y200 H0 Z-9999
    G30 P3 X175 Y5 H0 Z-9999 S

  • administrators

    @jckray said in Mesh bed level compensation problem:

    @Phaedrux @dc42

    I decided to go back and try an old form of bed probing I used to use and it worked perfectly. I have copied the code below. I have no idea why G29 is not working, but this is. Any ideas? Also, I really appreciate all the help both of you have been providing!

    ; Probe the bed at 4 points
    G1 F2000
    G30 P0 X5 Y5 H0 Z-9999
    G30 P1 X5 Y200 H0 Z-9999
    G30 P2 X175 Y200 H0 Z-9999
    G30 P3 X175 Y5 H0 Z-9999 S

    As you are not using H parameters, G29 mesh probing with a 2x2 grid designed to probe at exactly the same 4 points should give the same results.

  • @dc42
    H parameters for G30, or for drive height in M558 probe config?

  • @dc42 I understand what you mean my H parameters now. The only difference between this script and the G29 is G29 has the 4 points probed counterclockwise starting in the front left corner when this script that does work has it clockwise starting in the front left.

  • administrators

    @jckray said in Mesh bed level compensation problem:

    @dc42 I understand what you mean my H parameters now. The only difference between this script and the G29 is G29 has the 4 points probed counterclockwise starting in the front left corner when this script that does work has it clockwise starting in the front left.

    The order of probing shouldn't matter unless you have significant backlash in the mechanics. In your photo, I presume it is the X axis that runs in a smooth rod from left to right. Could it be that the linear bearing is a loose fit on the rail, so that the print head tilts left or right depending on whether the belt last pulled the head to the left or right?

    You can check this using a script similar to the following:

    G1 X90 Y100 Z5 F6000
    G30 P0 X100 Y100
    G1 X90
    G30 P1 X100 Y100
    G1 X90
    G30 P2 X100 Y100
    G1 X90
    G30 P3 X100 Y100
    G1 X90
    G30 P4 X100 Y100
    G1 X90
    G30 P5 X100 Y100 S0

    I have assumed you want to probe at X100 Y100 in this example. You can use up to 32 G30 probe points, just use the next P number each time and put S0 on the last one. After probing, the firmware will print out the average and the deviation. Then run a similar script with all instances of X90 replaced by X110 so that the point is approached from the other direction, and compare the results. Then repeat using movements in Y instead of X.

Log in to reply