Suggestion for a simpler, less error prone, way of bed levelling

I'm not sure where to put this as it is just a suggestion rather than a wish. Also, I'm coming from a position where my bed is mechanically flat and level and stays that way, so I don't use any form of firmware compensation or adjustment aids. But this thread https://forum.duet3d.com/topic/28753/themosthelpfulpostyoullreadtoday got me thinking and I looked at M671 which seemed to me to be overly complicated. Also using a least squares fit method suggests an overly complex algorithm is at work. But I could be wrong.........
All that's really needed is the spacing between the bed attachment points  or manual screw levelling points (which will effectively be the pivot points) and the spacing between the probe points. We don't need worry about referencing those attachment points or probe points to an origin, nor do we need to know what the probe offset is relative to any point in space.
So if we wanted to level the bed from left to right, we probe somewhere near the left hand edge and measure the Z height. Then we move somewhere near the right hand edge and measure measure the height again. This gives us the slope. So say the distance between probe points is 300mm and the difference in height is 0.3mm, then we know that the slope is 0.3mm per 300mm. Then if the difference between pivot points (attachment points or manual levelling screws) is 400mm, the adjustment required for the right hand screw would be 0.3/300x400 = 0.4mm. Which gives us the same slope (0.1mm in 100mm). Assuming we have the optimum number of attachment points ( that's 3), then for levelling front to back, we only need the distance between a line passing through the left and right attachment points to the opposite attachment point. If we use lead screws for adjustment, and the attachment arm is rigid, then the adjustment needed at the attachment point and screw will be the same. i.e. moving the lead screw nut 0.4mm will result in the attachment point moving 0.4mm).
If we have one more than the optimum number of attachment points, we would need to know the distance between each pair of attachment points (although front left to rear left ought to be the same as front right to rear right but seeing how some people build machines, that might not be the case)). But then again, more than 3 points defines a shape other than a plane so trying to level it becomes a pointless exercise.
It seems to me to be a simple solution rather than using least squares algorithms and messing about with the position of all things with respect to some origin, but have I missed something?

@deckingman said in Suggestion for a simpler, less error prone, way of bed levelling:
bed is mechanically flat and level ... so I don't use any form of firmware compensation
I have tried tool plate aluminum and 3rd party bed upgrades and they all, to date, require Mesh Bed Compensation to get the first layer to stick.
What is you secret?
It seems to me to be a simple solution rather than using least squares algorithms and messing about with the position of all things with respect to some origin, but have I missed something?
So in essence you would treat one point as the reference and make the other two match that?
Or did I fail to understand.. again.
Thanks.
Frederick

In a perfect world... it would work.
But I can't even be 100% sure my two front screws are exactly parallel to the Xaxis, which would add some error to the equation.
Furthermore the bed's tilt at the beginning of adjustment causes wrong height numbers.
So, in the end you have to probe all points two ore more times, which doesn't make things faster, than they are now.IMHO, the current method is foolproof and I don't care about some extra milliseconds CPU time it probably takes to calculate the least square method.

@o_lampe said in Suggestion for a simpler, less error prone, way of bed levelling:
...........................
IMHO, the current method is foolproof and I don't care about some extra milliseconds CPU time it probably takes to calculate the least square method.Well I know you always like to argue with anything I post, which is one of the reasons why I don't bother wasting much time trying to help others on these forums any more.
But for the record, and if you had bothered to read my post properly, this has absolutely nothing to do with saving any milliseconds of processing time but is more about reducing the possibilities for people to make errors. Whether that be the probe offset relative to the nozzle, the adjustment positions relative to some origin, confusion about pivot points, attachment points, and screw positions or any of the other myriad of related post topics which crop up frequently. So the current method is far from fool proof as evidenced by the number of posts on this topic.
None of the things I just mentioned actually matter if you simplify the methodology and associated algorithm. All you need is the distance between the pivot points (bed attachment points or adjustment screws depending on how the plate is fitted and adjusted).

@fcwilt said in Suggestion for a simpler, less error prone, way of bed levelling:
@deckingman said in Suggestion for a simpler, less error prone, way of bed levelling:
bed is mechanically flat and level ... so I don't use any form of firmware compensation
I have tried tool plate aluminum and 3rd party bed upgrades and they all, to date, require Mesh Bed Compensation to get the first layer to stick.
What is you secret?
The usual suspect in that case is that the frame is twisted. You can think of the bed as being a plane  hence we use (or should use) 3 screws or attachment points because 3 points define a plane. So we can level that plane but level it with reference to what? If you have X and Y running on members at the top of the frame, then it will be level with respect to those top members. But what if the frame isn't perfectly square? You have level plane but levelled with respect to a twisted frame, so the height of the nozzle above the bed, will only be correct at the 3 attachment points and might be different at other points on the bed (because the height of the nozzle is affected by the frame member that the gantry runs on and not just the position of the bed).
Assuming we have 3 lead screws, then the bed plane needs to be level with respect to a plane defined by the attachment points of those 3 screws, and the XY hot end gantry also needs to form a plane which is parallel to those other two. Levelling just the bed, without reference to the hot end XY plane only works if the frame is perfectly square. And remember that if you want to do edge to edge printing as I can do, then the frame members have to be square and parallel within about 0.1mm from end to end. Not many people bother to check and adjust that.
I actually did a YouTube video on it some time back with an explanation of how to measure and adjust the frame if necessary. The logic applies to whatever method you use to level the bed. https://www.youtube.com/watch?v=H9O1r46Izn8&t=2s
So in essence you would treat one point as the reference and make the other two match that?
Or did I fail to understand.. again.
That's exactly right and is no different to the current method. You always adjust two points with reference to a third.

I will be watching the video.
Bear with me if I use the wrong terms here.
I have always assumed (bad thing to do, I know) that to print 0.1mm layers you would seek 0.005mm (5% of layer height) nozzletobed accuracy over the desired printing area.
Given the many possible things getting in the way of achieving that accuracy, it seemed impossible that I could achieve construction to that sort of precision. At least, given the skills and the tools I have.
I did have one printer where the X gantry rode on two linear guide rails making up the Y axis. It was clear the two guide rails were not lying in the same plane. I resorted to creating 4 point heightmaps and adjusting the relevant frame pieces over and over striving to get the guide rails lined up.
It was a frustrating trialanderror process but eventually I got decent results  decent meaning I got fed up trying to do better.
I would imagine a good machine shop would have the skills and equipment and would know how to quickly and properly make the needed adjustments to the frame.
Thanks for your contributions to us all.
Frederick

@deckingman the CRITICAL requirement for bed leveling is maintaining a symmatric pattern of probe points to Zpoints (either leadscrews or adjusters).
If your coordiantes are not sympathetic the math will not yield good results.
On a machine with 4 screws/levelers, its easy to see the concentric outlines offset from each other relative to the bed center.
On a 3screws machine its a little bit harder. Here is an exaggerated picture that I think illustrates the point.

I watched the video and it made perfect sense.
I used to think it would require some sort of "outside" reference like a granite surface plate to get everything adjusted correctly.
I am going to try your approach and see what state my printers are in.
One thing you didn't mention in detail was the flatness of the bed itself.
My supplier of tool plate specs it as flat with 0.015" which works out to 0.381mm  not very flat. Another supplier has flatter stuff if you get 0.5" thick or better but even then it is spec'd at 0.005" which works out to 0.127mm  better but still varying by more than one layer height for 0.1mm layer height printing.
So just how flat is your bed and how did you achieve it?
Thanks.
Frederick

@sinned6915 said in Suggestion for a simpler, less error prone, way of bed levelling:
@deckingman the CRITICAL requirement for bed leveling is maintaining a symmatric pattern of probe points to Zpoints (either leadscrews or adjusters).
If your coordiantes are not sympathetic the math will not yield good results.
On a machine with 4 screws/levelers, its easy to see the concentric outlines offset from each other relative to the bed center.
On a 3screws machine its a little bit harder. Here is an exaggerated picture that I think illustrates the point.
I'd have to disagree somewhat. Firstly, only 3 points define a plane  any more than that defines some sort of curved surface. So, as I said in my opening post, if you have more than the optimum number (3) of attachment/adjustment points you would be trying to level a curved surface, not a plane which is a pointless exercise. Regarding probe points, if you watch my video that I posted a link to for @fcwilt , you'll see why you should always probe XY in a straight line across the centre of the bed in the Y direction, and front to back in a straight line across the centre of the bed in the X direction. This will negate the effect that a slope in the Y direction would have when measuring left to right and the effect that a slope in the X direction would have when measuring from front to back. It should go without saying that a straight line between left/right adjustment points should be parallel with X axis and the Y adjuster should be at right angles to that line and ideally, at the centre of that line.

The point I'm trying to make here is that to level a plane such as a build plate simply requires determining the slope of that plane from left to right and from front to back then ensuring that any adjustment will compensate for that slope. It largely doesn't matter what the distance between measurement points is except that the further they are apart the less likely the measurement error. It also doesn't matter where in space those measurement points are in respect to the bed plate, the printer frame, the nozzle or anything else. We just need to determine the slope of the line. Then we need to adjust one of the screws such that a line drawn between pivot points has the same magnitude slope (but in the opposite direction). It doesn't matter how far apart those pivot points are, or where they are with respect to the probe, the nozzle, the edge of the build plate or anything else. But I thought it would go without saying that, a line drawn between pivot points should be parallel with the line between probe points.
To determine the slope of a straight line is a simple calculation, so I'm confused as to why it is necessary to use a least squares curve fit algorithm.

@fcwilt said in Suggestion for a simpler, less error prone, way of bed levelling:
@deckingman
........................So just how flat is your bed and how did you achieve it?
I just used "Ecocast" from these people https://www.aluminiumwarehouse.co.uk/aluminiumplatecuttoorder/. I have no idea what the flatness tolerance is  they don't say. But I do have a precision straight edge similar to this https://www.axminstertools.com/veritasaluminiumstraightedge610mm24701278 which is machined flat to a tolerance of 0.075mm over the entire length which I used to check it with. I couldn't see daylight anywhere so that's good enough for me. Had it been bowed in any way, I'd have used shims between the plate and frame such that tightening the fixing bolts would pull or push it into shape as necessary. In the event, I didn't have to bother.
Having said all that, I've never tried printing edge to edge at 0.1mm layer height. I can't think why I'd ever want to do a first layer like that on a bed that's 400mm square. But almost edge to edge at 0.3mm layer height works just fine without any ripples or curling so 0.1mm might also work. This is a video from 5 years ago and much has changed on the printer, but the bed is the same. https://www.youtube.com/watch?v=U733PMTou7M

@deckingman I agree with your point of simplicity to the defining the plane. I do not agree with the suppposition that the lines connecting the points of adjustment have to be parallel to the axis of motion. Look at Delta printer's for example.
Appliction of least squares is done when you have an overdefined system mathematically. It's a mathematical method that can be used to fit a curve, or a line, or a plane to a bunch of data points.
With 3 points and 3 degrees of freedom, it reduces to 1 exact solution. Your intersecting lines is an appropriate analogy and can proably be constructed to prove it.
I think the bigger issue is that most people don't understand/don't remember/can't visialize the geometric discussion we are trying to make. Just blindly throwing in some coordinates will not make for a corrected plane.
My point is the ideal probing locations should mimic the relative positions of the adjusting elements. Think similar triangles.

@fcwilt said in My supplier of tool plate specs it as flat with 0.015" which works out to 0.381mm  not very flat. Another supplier has flatter stuff if you get 0.5" thick or better but even then it is spec'd at 0.005" which works out to 0.127mm  better but still varying by more than one layer height for 0.1mm layer height printing.
I have checked mine on a surface plate and its out 0.2 over 500mm in one direction. It looks like segment of a cylinder. The surface plate is 3' square and AA grade.

Thank you for that link about your bed material.
I never thought about printing a thicker first layer just to get things started.
Frederick

@deckingman I agree that your suggested method would work.
However, if you probe 3 points on a bed with 3 attachment points, then the least squares calculation gives exactly the same result as your suggested method. You method requires the attachment points (or at least, the spacing between them) to be known, so I don't see that it is any simpler. The calculation is certainly simpler, however RRF includes a leastsquares solver for delta printer calibration anyway.
The use of a leastsquares solver gives you the chance to probe more points then attachment points, which for those of us who don't have a bad as flat as yours (or who have a gantry that sags a little) allows leastsquares "averaging" to be done, so that the result is less sensitive to deviations from flatness at particular points.

@sinned6915 said in Suggestion for a simpler, less error prone, way of bed levelling:
I have checked mine on a surface plate and its out 0.2 over 500mm in one direction. It looks like segment of a cylinder. The surface plate is 3' square and AA grade.
My granite surface plate is only 300mm by 300mm  not really big enough for any but my smallest bed.
I just checked my heightmaps and they all show mostly a gentle curve from "left to right" but basically flat from "front to back".
So you observation about a "cylinder" is consistent with what I see here.
Thanks.
Frederick

@dc42 said in Suggestion for a simpler, less error prone, way of bed levelling:
@deckingman I agree that your suggested method would work.
However, if you probe 3 points on a bed with 3 attachment points, then the least squares calculation gives exactly the same result as your suggested method. You method requires the attachment points (or at least, the spacing between them) to be known, so I don't see that it is any simpler. The calculation is certainly simpler, however RRF includes a leastsquares solver for delta printer calibration anyway.
The use of a leastsquares solver gives you the chance to probe more points then attachment points, which for those of us who don't have a bad as flat as yours (or who have a gantry that sags a little) allows leastsquares "averaging" to be done, so that the result is less sensitive to deviations from flatness at particular points.
I think that's the nub of it. If you probe more than two points in one direction (which ideally should be close to the extremities of the bed), then you are no longer looking at whether the plate is level, but also trying to compensate for some unknown curvature or flatness. In simple terms, a saucer is level if one can fill it with a fluid and that fluid will not spill over the rim at any one point. For the purpose of levelling (as opposed to flatness compensation), the shape of the indentation and the position of the indentation within the rim, is irrelevant. If the rim is the same height all around, then it's level. Once it's level, then you can worry about whether it's flat but to try and do both at the same time is bound to lead to problems. But I can see I'm flogging a dead horse here so I'll just bugger off.

@deckingman said in Suggestion for a simpler, less error prone, way of bed levelling:
In simple terms, a saucer is level if one can fill it with a fluid and that fluid will not spill over the rim at any one point. For the purpose of levelling (as opposed to flatness compensation), the shape of the indentation and the position of the indentation within the rim, is irrelevant. If the rim is the same height all around, then it's level. Once it's level, then you can worry about whether it's flat but to try and do both at the same time is bound to lead to problems.
Two comments:
 There would be nothing to stop you probing several points around the rim, and ignoring the interior.
 I think the more realistic case for us is that the rim isn't level. As we're not actually trying to contain a liquid, I think it's reasonable to probe several points uniformly distributed around the rim, and do a leastsquares fit to define a plane that deviates from the probed points on the rim as little as possible.
It's fair to say that if RRF did not already have a leastsquares solver in it, I would have implemented a simpler system that constrains you to probe the same number of points as you have bed mounting points. Having the least squares solver already allowed me to implement a more general scheme, that is equivalent to the simpler scheme when you have that number of probe points.
Do you find the present scheme unsatisfactory, and if so, in what way? Your title suggests that the current method is errorprone: in what way?

I have a few observations that may be relevant.

cast tooling plate is manufactured in large sheets (like 8' x 4' or larger). It is milled in that size and the flatness spec is applied over the entire sheet. Smaller pieces, cut from those large sheets, like we use for bed plates, will be flatter than the limits that apply to the large sheet. I have used 300x300 mm cast tooling plate beds, 1/4" and 8mm thick, in 4 printers and found it always flat enough to print edge to edge in a 0.2 mm layer  never tried thinner as I never had a reason to do so.

I have seen many recently designed printers using cast tooling plate beds with heaters that are smaller than the bed plate by a wide margin. I don't know why they do that maybe to save a few $ on the heater. I suspect that leads to bowing when the plate is heated because the cooler edges won't expand as much as the central portion of the plate. Probing multiple points and doing a least squares fit would help to minimize the variation in the first layer thickness on a bowed plate. I "probe" nine points with a piece of paper between the nozzle and bed when I use the manual bed leveling assistant, typically about once a year when I check the tram of the bed.

I use 300x300 mm heaters on 300x300 mm bed plates. Here is a thermal image of the uninsulated 8mm plate in my corexy machine:
The minimum point in the UL corner is about 7C below the center of the bed. If there were a 20 or 30 mm unheated margin around the plate what would the temperature difference be? How much would the plate bow? Maybe there's a simulator on the web somewhere that could provide an estimate.
 I have seen forum posts in which people claim their cast tooling plate beds were bent in shipping. I have never seen any mention of the truck tire tracks on the package that would be surely be there if the bed really were bent in shipping.


Some of my cast tool plates are nice and flat, others not so much.
The first four I got were good, got unlucky on the last one.
But I still have to use Mesh Bed Compensation.
I don't yet understand how others can manage without it.
Frederick