# Automatic bed levelling using 2 or 3 Z motors

• I plan to add to my delta a set of new 3 carriages attached to the hotbed via 3 ball joints and use 3 motors of my due5x to move each carriage to allow bed leveling.

Do you consider this set up to allow 3 motor bed level in deltas?
or what setup are you thinking to allow 3 motor bed level in deltas?

With a delta, the problem is that unless you probe well out between the towers, you can't tell by probing whether height errors are caused by towers being out of position combined with incorrect homing switch offsets, or a tilted bed.

If you can probe far enough out, then you can use 8-factor auto calibration to measure the bed tilt. Having measured it, you can correct it mechanically, or let the firmware compensate for it.

• My twopence worth. Assuming you have 3 screws arranged in a triangle say, front left, rear centre, front right and call them points A, B and C. You only need to adjust points B and C with respect to A. So you could home at point A, rather than the centre of the bed, then move to and adjust points B and C.

As other have said, if you have a bed that moves in Z, there has to be an offset between the screw and the probe point (unless the screw came up through a hole in the bed but even then , you'd be probing the top of the screw and not the bed). So adjusting point B or C would have a small effect on point A. The two ways I can see of dealing with that would be either to input the X and Y offset from the probe point with respect to the screw/motor (the pivot point) at A. Then employ some clever maths to correct the adjustment required at points B and C which will be something like the ratio of probe point A to the pivot point compared to probe point B to the same pivot point. Or, as has been mentioned, do a one or two iterations which would probably be a lot simpler.

Ian

• I can't see why you would ever need 3 or 4 motor adjustment. One fixed height mount and two adjustable height mounts can level any bed.

Some type of iterative process should cover all bases for corexy and cartesian. Deltas are a different case. To make a half decent one the precision in the build presupposes a level bed, since levelling the bed mechanically is very minor compared to everything else that has to be done right. Come to think of it this idea has more application in a cheap mass market consumer printer where a mechanically level bed is either impractical for transportation or expensive in terms of hardware and where some cheap actuator could be used on the 2 adjustable supports maybe those highly geared Chinese micro stepper motors.

• If the bed moves in Z, ideally you need 3 screws to raise and lower it whilst keeping it level - hence 3 motors (or as I do, 1 motor and a continuous belt between the 3 screws) but I agree, you only need adjust 2 of them with respect to the 3rd. I'm with you in that it is a feature that I personally won't use but it's been requested and voted as one of things other users want so….........

• In the case of my large H-bot, I have a fixed bed with the XYZ carriage suspended on 8mm lead screws at 4 corner posts. I originally planned to use a belt drive for multiple screws but adapting 4 motors to the 4 screws is a much simpler overall design given the ability to sync all four motors at power up as DC42 described a while back. In a 4 motor example where the Z carriage is relatively level to begin with, leveling two adjacent corners at each narrow end of the carriage rectangle, and then leveling the carriage end to end along the long dimension seems to me as the simplest case. Will that be practically doable?

• If the gantry is sufficiently flexible (as any large enough gantry is sure to be), then you could extend the technique I suggested to 4 independent motors.

• If the gantry is sufficiently flexible (as any large enough gantry is sure to be), then you could extend the technique I suggested to 4 independent motors.

Ok, good to know…thanks. I'm thinking I will want to home the Z carriage at the top of travel on power up or power loss to prevent crashing into anything on the print bed. Then follow your instructions to probe the bed and 4 corners to level the carriage before beginning a print. Sorry if this is basic stuff to most of you but this will be the first attempt at initializing a printer build for me. Thanks.

• If this works great you will sell a lot of deux boards I have 3 screw setup but I was thinking to use belt and one motor. I'd change my design if this works good tho so hope someone with a 3screw setup can run a test

• If this works great you will sell a lot of deux boards I have 3 screw setup but I was thinking to use belt and one motor. I'd change my design if this works good tho so hope someone with a 3screw setup can run a test

I kind of went in the opposite direction. That is to say I designed my printer to use 3 Z motors for when this feature became available but initially had to use a single motor and continuous belt between the 3 screws. I levelled the bed once, then again after about 2 weeks but that was about 6 or 7 months ago and since then, I've never had to make any adjustment, so I'll be sticking with this arrangement. So it might be worth starting with a single motor and see how it goes before committing to the 2 extra motors.

• I just don't get it

You type the following code in the first message of this thread

`````` Use M584 Z2:3:4 to assign 3  motors to the Z axis
- Home Z at bed centre using the Z probe
- Send M584 Z2 to enable just the first Z motor
- Send G91 and G1 Z1 to drop the corner or edge of the bed driven by the first motor by 1mm
- Move the probe to be close to the first Z motor, then probe again
- Send M584 Z3 to enable just the second Z motor
- Send G91 and G1 Z1 to drop the corner or edge of the bed driven by the second motor by 1mm
- Move the probe to be close to the second Z motor, then probe again
- Repeat these 3 steps for the 3rd Z motor
- Send M584 Z2:3:4 to enable all 3 motors again
- Do a final probe at bed centre to fine-tune the Z height

``````

So you first attach (in my case with 3 steppers) the 3 z steppers to Z, E0 and E1 with M584 Z2:3:4 and you home the Z with all 3 steppers enabled in the center of your buildplate

THEN you let 1 corner lower 1mm while disabling the other 2 z steppers

While this should work (somehow), that means that if a customer begins with a perfectly level z plate, this technique is going to tear the 3 corners out of sync by 1mm one after the other. That places unneeded load on the system, because you want to make your system as rigid as possible and then you instruct software to do movements which hurt your bearings (maybe not much, but it does hurt. I even don't know if for example ball screws will even tolerate that amount)

What I understand under auto-leveling is more like this

A) Enable 3 outputs for Z with M584 Z2:3:4
B) Move XY to center of the printbed
C) Home Z on the center of the bed
D) Move the bed down for example by 10mm (Which theoretically allows the bed corners to be 10mm off, which is insane, you can also do 5mm instead because that amount of bad leveling is easy to see with the naked eye)
E) Now go to a position as close as possible to the first Z motor leadscrew and home on Z at that position (STILL WITH ALL 3 MOTORS enabled)
F) Go up (lowering the plate) again to the starting position before before probing Z at that location (or 5mm, you get my point)
G) Now do the same with the 2 other leadscrew positions, so move the gantry as close as possible to the leadscrew and home that Z position (while having all 3 z steppers still enabled and moving too)

Using that method you register the relative distance needed to home Z on the different locations (to be honest, the center location is even not needed)

Now suppose that I have 3 screws for Z (one left front, one right front and 1 back center)

If my test would register these offsets to home correctly

Z1: 7.24mm
Z2: 8.12mm
Z3: 7.80mm

Then that means Z1 is too high and Z2 too low

(7.24 + 8.12 + 7.80) / 3 = 7.72 mm

That means that you need to make Z1, Z2 and Z3 move

Z1 by 7.24-7.72 = -0.48mm
Z2 by 8.12-7.72 = +0.4mm
Z3 by 7.80-7.72 = +0,08mm

Using this technique, you should already have a lot better bed level, but… this is indeed not the end. Because we don't measure/probe at the exact leadscrew location, you will need to do this a couple of times after eachother. The offsets will always become a lot smaller until the offsets will be within a predefined acceptable level (for example 0.02mm , but maybe you even want smaller level, it also depends on the accuracy of your level sensor).

I'm pretty sure that after 3 to 5 iterations this would mean an almost perfectly leveled printbed.

1 Advantage is that if the bed is already level when you start this leveling procedure, then the bed is never taken out of level by the procedure and you don't "tear" the bearings or whatever guidesystems 1mm out of sync. I know people who use linear ball guides and these just don't accept that kind of tear on them. Ballscrews also don't like it. A bed that was allready level, will also finish leveling very quickly because after the first probing the system would already detect all 3 points to be perfectly level and the procedure would stop.

So.... in my opinion it would be very handy to have a routine which lets Z motors level using some sort of gcode/mcode call where you can specify the needed locations to home the 3 points (or 2 if you happen to have only 2 screws like the bigbox) + the distance to go up/down and the requested tolerance you need before the routine may stop itself and call it DONE.

I don't think this can be done using just a macro (correct me if wrong). It should however be quite simple to implement in software , but you need to be able to record the 3 z offsets measured in the probing, then calculate their average and the deviation from it, then move the Z motors according to that deviation and repeat the routine until the needed tolerance is met.

People could then use this routine to 100% surely level the plate (because multiple Z motors can and will go out of sync when the printer is not powered) and after that you could do a mesh bed leveling and be absolutely sure of the best possible setup of your Z buildplate.

A little demo of this can be seen in the following video: https://www.youtube.com/watch?v=76bUTPKNloM

What do you think about that ?

Kind regards ,
Bart

• My twopence worth. If the bed is rigid and won't allow 1mm of movement in a corner, then it doesn't need automatic bed levelling with 3 motors. Level it manually, drive the 3 screws with a single motor and a continuous belt - job done. But that isn't what this thread is about. People have requested automatic bed levelling as a firmware "wish" so presumably those people have machines where the bed isn't that rigid and/or they have designed their printers to allow some flexing at the carriage/bed mount. It's not difficult to do.

• This thread is called automatic bed leveling using 2 or 3 z motors so my post is totally relevant. The main goal of my post was to illustrate that that 1 mm out of sync is not needed and does in any case (rigid or not) make more stress than needed. Thats because it does the whole thing even if a bed was allready level. And even the most rigid machines may need some leveling, even if it is only to take 0.1mm of uneven leveling away. That can be done easily in auto leveling.
Regarding connecting 3 axes with 1 belt, that is a possibility to not go out of sync, but if this technique is used then you can't use auto leveling and belts can also stretch over time… . That is why my post here is totally relevant. Even the most expensive cnc machinery with 2 or more motors which should run in sync use some kind or techniques to sync these motors, and mostly it is not by belts.

• I didn't say that you post was irrelevant. In fact if you re-read it, I didn't use the word at all. David started this thread as an example of what he was thinking of doing and asking for feedback. Various people have put forward suggestions, as have you. No need to rant.

• I agree that it's better to move the whole bed when probing all the points and make the correction at the end. The purpose of my post was to point out that it may be possible to do this type of bed levelling already without any firmware changes.

• Deckingman, I also didn't mean to rant or whatever. Sorry if it came over like that. We all want to build the most perfect solutions possible, thats all.

David, I still don't really understand how it would be possible with current firmware. I don't know the firmware as good as you of course , but the demo code you gave above (with all 3 motors on or not) it capable of detecting the z probe distance at for example 3 points.

So suppose you probe the bed at 3 places with these gcode commands. What then? I guess you need to calculate the offsets manually and have to adjust each z motor individually to level ?

Using that technique, I would guess that a leveling is these steps

1. With all 3 motors on, lower the z bed for example 10mm
2. position probe closest zo z1 motor and do a homing on Z with all 3 motors on . (take note of the distance needed to home)
3. Set Z bed down again and move probe to the position closest to z2 screw
4. probe again and take note of the distance there.
5. do the same for Z3 motor.

But then….

After that you have the 3 offsets. I guess then you have to calculate the average of the 3 offsets manually by yourself and then 1 by one enable the Z motors and set them to the calculated offset position ?

This process should be repeated a couple of times, so as far as I understand at this point, this is not fully automated and required me to take note of offsets, calculate averages and position individual z motors multiple times by hand ?

Or is there some kind of scripting language or system implemented on the duet which enables me to program this to be happening automatically ?

Bart

• Hi Bart,

No problem. I think the idea that David is putting forward is this. Probe the bed in the centre. i.e. enable all 3 motors then home the bed to the trigger height - for the sake of argument, lets say it's 2mm. Then move close to one of the screws, disable the other 2 Z motors then using just the one motor, drop the bed by 1mm (to ensure that it is below the trigger height, then probe the bed at this point - i.e using just one motor adjust the bed back to the trigger height of 2mm. If the bed was level to start with, this would be the same position, otherwise it will be adjusted. Repeat this process for the other two screws. A second iteration might be necessary but after that, in theory the bed should be level as long as the motors remain in sync (and nobody turns one of the screws when the machine is switched off).

So there aren't any offsets to remember and a macro could be created which would run this process automatically.

HTH

Ian

• That could indeed work. It will end up with a leveled bed.

Only negative I see is that on an allready leveled bed this is moving 1 z motor while others are not moving, so producing tear on the axis which is unneeded.

I do agree that most systems will not see a lot of problems in this. It is just something that bothers me a bit, but its not the end of the world.

I plan on leveling my 326x326x8mm aluplate (pei coated) with 3 T8x1 leadscrews (like you use too on your corexy) and then mount the plate RIGID onto the frame that connects to the 3 nuts. I don't plan on implementing leveling screws between the z stage and the buildplate itself since technically speaking this solution should be able to level the plate to 0,01mm anyway and thereafter you can do a mesh bed leveling to factor out al unevenness.

I still think engineeringwise the best option is to probe the 3 points with all motors on, then calculate offsets and reposition the motors. An already leveled bed will need no adjustments and leveling procedure will be very fast and even on a unleveled bed (which we make this calibration for) the out of sync movements which are more or less harmful for the guide system will only move the least possible (calculated) offset.

PS. While I have your attention. On your printer what do you use for guiding your Z table so it can't have horizontal wiggle room? I see wheels. Are these special types ? I plan un using 16mm precision shaft and LMF16UU bearings.

• I still think engineeringwise the best option is to probe the 3 points with all motors on, then calculate offsets and reposition the motors. An already leveled bed will need no adjustments and leveling procedure will be very fast and even on a unleveled bed (which we make this calibration for) the out of sync movements which are more or less harmful for the guide system will only move the least possible (calculated) offset.

I already agreed with you, see my previous post.

• Yes I understood that David. It was more an answer to Ian actually.

Is something like this planned to be implemented in firmware anytime soon ?

I would make a difference on which boards I have to buy for my build. Normally I would buy a duet wifi, connect X, Y, Extruder1 and Extruder 2 to the duet wifi and then map the z drive on expansion header to do my own stuff with it.

If it is working in firmware, then I will need to buy at least an extra duex-2 so I can hook the X and Y + the 3 Z motors to die duet wifi and then the 2 extruder motors to the expansion board. At east that is what I think I have read that it is best to have 1 axis on the same board, so for 3 z motors that would possibly be my best bet?

• It doesn't make any difference whether you have the 3 Z motors on one of the boards or split between them.

Looks like your connection to Duet3D was lost, please wait while we try to reconnect.