Welcome! Log In Create A New Profile


Unified Bed Leveling - What am I doing wrong?

Posted by joaoabs 
Unified Bed Leveling - What am I doing wrong?
October 03, 2019 12:31PM

Trying to get my first decent print in my newly built hypercube-alike printer.
Since it has a big bed (300 x 300) I'm using UBL (Unified bed leveling). I'm using a bltouch clone as Z sensor.
I've set an offset of X40 Y4 from the extruder to the bltouch tip.

Following the information from [marlinfw.org] this is what I did:

- Flashed the firmware and reset the board
- Issued M502 and M500
- G28 to home XY
- G29 P1 - The printer starts probing some areas but in a disordered way. Instead of doing sequential points it's traveling back and forth which makes the whole process to take longer. Also, the LCD mention that x/100 points are tested but it seems only 64 are tested (it stops at 64/100).
- G29 P3 T - I do it a couple of times, I have no idea how many times I have to do it neither why.
- G29 T - I get the values below

Recv: Recv: Bed Topography Report:
Recv:     (  1,280)                                                              (295,280)
Recv:         0       1       2       3       4       5       6       7       8       9
Recv:  9 |   .     -1.232  -1.232  -0.932  -0.671  -0.364  -0.050  +0.271  +0.610  +0.949
Recv:    |
Recv:  8 |   .     -1.102  -1.102  -0.824  -0.530  -0.245  +0.031  +0.329  +0.644  +0.959
Recv:    |
Recv:  7 |   .     -0.970  -0.970  -0.704  -0.381  -0.162  +0.100  +0.386  +0.669  +0.951
Recv:    |
Recv:  6 |   .     -0.850  -0.850  -0.591  -0.321  -0.054  +0.189  +0.443  +0.720  +0.997
Recv:    |
Recv:  5 |   .     -0.706  -0.706  -0.436  -0.181  +0.053  +0.279  +0.526  +0.812  +1.099
Recv:    |
Recv:  4 |   .     -0.565  -0.565  -0.289  -0.050  +0.204  +0.408  +0.664  +0.894  +1.124
Recv:    |
Recv:  3 |   .     -0.346  -0.346  -0.139  +0.124  +0.370  +0.578  +0.799  +1.024  +1.249
Recv:    |
Recv:  2 |   .     -0.210  -0.210  +0.044  +0.296  +0.501  +0.709  +0.954  +1.139  +1.324
Recv:    |
Recv:  1 |   .     -0.049  -0.049  +0.201  +0.416  +0.661  +0.880  +1.076  +1.265  +1.454
Recv:    |
Recv:  0 |   .    [+0.113] +0.113  +0.359  +0.536  +0.821  +1.051  +1.199  +1.391  +1.584
Recv:         0       1       2       3       4       5       6       7       8       9
Recv:     (  1,  1)                                                              (295,  1)
Recv: ok
Recv:  T:2

- G29 S1 - to store the vaules in eeprom
- G29 F 10.0 - Not sure I understand what this is for (would it be that there will be no more bed leveling compensation from 10mm high onwards?)
- G29 A - to activate UBL
- M500 to save settings in eeprom
- reset the board
- G28 to home XY
- G29 T to see the values from above - Confirm they are there and not zero
- Load a test file to print.
- The result of first layer :

As it can be seen, something is wrong with the bed leveling. It's too high on the right and too low on the left.
I confirmed that the Z axis move as the extruder travels around, so it is supposedly doing his stuff, but likely to be using the wrong values....

Any idea of what am I doing wrong?


Edited 1 time(s). Last edit at 10/03/2019 01:15PM by joaoabs.
Re: UBL - What am I doing wrong?
October 03, 2019 12:59PM
Let's get some things out of the way.
- Are you homing with the probe or do you also have a Z endstop?
- If you are homing with the probe, do you have Z_SAFE_HOMING set so it homes with the probe in the center of the bed?
- The behavior you're seeing from G29 P1 is normal. The probing pattern should be an expanding circle from wherever the probe was when you started probing. This is done so in case the bed is very unlevel you have a chance to stop the probing before you end up scratching the bed. If you're using Z_SAFE_HOMING it should be an expanding pattern from the middle of the bed (where the probe ended up after homing).
- The probing stopped after 64 points because the some of the grid points are not reachable by the probe. This is OK - UBL can handle that.
- The unreachable points can be filled with G29 P3. Keep running G29 P3 until a G29 T no longer shows any points without values (i.e. displaying as ".").
- Save the mesh with G29 S1
- Make sure that your start gcode loads and activates the mesh - you need a G29 L1 to load the mesh, and a G29 A to activate it.

Now to the main issue - the mesh appearing to be low on one side vs. the other. This is a classic sign of a twisted X axis. On a printer that has an X axis as two parallel rods one on top of the other, it means that on one end the rods are not exactly above each other but rather one of the rods is a little in front or behind the other rods as seen from above. It doesn't take a lot to see this. Then if your probe's Y offset from the nozzle is not 0, the Z distance from the tip of the nozzle to the probe trigger point will be different from one side to the other of the printer.

Here's a write up I did for this in the Marlin GitHub:


Imagine the following with the standard 2-rod X axis (this is what my AM8 has):

On the left side of the bed the lower rod is slightly more towards the back of the printer than the upper rod (in my case this is about 0.5mm)
On the right side of the bed, the upper and lower rods are exactly aligned (as they should be).
The rods are around 38mm apart - this makes the amount of twist asin(0.5 / 38) = 0.75 degrees.
This results in a twisted X axis. The nozzle on most i3-style machines is a few cm in front of the plane of the rods - in my case around 30mm. This means that the nozzle will be around sin(0.75) * 30mm = 0.4mm closer to the bed on the left side than on the right, assuming the bed is actually perfectly flat.

Now in my case my sensor has a Y_PROBE_OFFSET_FROM_EXTRUDER of -40. So the probe is 40mm in front of the nozzle, or 70mm in front of the plane of the rods. Let's pretend my X_PROBE_OFFSET_FROM_EXTRUDER is 0. Then on the left side of the bed the sensor will be sin(0.75) * 70mm = 0.91mm closer to the bed - a difference of 0.5mm between the amount the nozzle changed vs the amount the sensor changed. So the bed leveling system thinks the bed is 0.5mm higher on the left side than the right side.

The larger your Y_PROBE_OFFSET_FROM_EXTRUDER, the more noticeable this effect will be.

Either you have to fix the twisted X axis mechanically, or manually tweak the mesh with G29 P4 until it works for you. When I had this problem, I did the latter. I initialized the mesh to all 0s with G29 P0, then used G26 to print a test pattern and edited the points of the mesh manually until I got a good result from G26. When I later upgraded my X axis to use a linear rail the twist was eliminated so the results from probing could be used directly.

Edited 1 time(s). Last edit at 10/03/2019 01:00PM by MMcLure.
Re: Unified Bed Leveling - What am I doing wrong?
October 04, 2019 07:38PM

@MMcLure thanks for getting back.

Answering your questions:
a) Yes, I'm using the bltouch for homing - There is no other sensor/switch.
b) Yes, I'm using the secure home so after the X/Y homing the head goes to the center of the bed to probe Z.
c) OK, G29 P1 behavior is normal. Got it.
d) OK, the grid points that aren't reachable by the probe will result in the G29 T output as " . " and the G29 P3 fills it.
e) G29 S1 saves it and M500 makes it persistent. However, if I handle any of the Z steppers I need to re-run all of this again. (ex: When taking out a print with a spatula the bed moves when Z don't have holding torque - This is an hypercube, so the bed is hold by two steppers and goes down as the print goes)
f) OK, I need a G29 L1 to load the mesh, and a G29 A to activate it in the beginning of my gcode. Got it.

Now, regarding the issue, I was doing some measurements and I'm not sure it would be that reason. I took some pictures:

x axis alignment right: [photos.app.goo.gl]
x axis alignment left: [photos.app.goo.gl]

This is a hypercube - CoreXY printer where the Y bars are fixed and the X bars travel along it.
The upper and lower X axis bars can be aligned but it can be the case the right and left Y axis bars aren't. Maybe the left hand side one is below? Well, it don't seem, by looking at the level of the X axis: [photos.app.goo.gl]

The distance from the X axis bars plane and the hotend is around 35mm: [photos.app.goo.gl] and the distance between the hotend and the probe is roughly X40mm Y4mm: [photos.app.goo.gl]

I'm out of ideas, could it be something wrong in this configuration?

#define X_PROBE_OFFSET_FROM_EXTRUDER 40  // X offset: -left  +right  [of the nozzle]
#define Y_PROBE_OFFSET_FROM_EXTRUDER 4  // Y offset: -front +behind [the nozzle]
#define Z_PROBE_OFFSET_FROM_EXTRUDER -2.62   // Z offset: -below +above  [the nozzle]

Thanks again
Re: Unified Bed Leveling - What am I doing wrong?
October 07, 2019 02:05PM
Do you have two separate Z motors moving the bed? If so, you need to make sure that there's a repeatable way to get the Z motors "synced" - otherwise any sort of pressure on the bed when the steppers are disabled can cause a tilt that the leveling system is unaware of. On my Prusa-style printer I use a couple of printed jigs to make sure that both sides of my X axis are at the same height before starting a print - before I did that it was impossible to get good results.In your case it seems like some jigs may be useful to ensure that your bed is level each time.
Re: Unified Bed Leveling - What am I doing wrong?
October 08, 2019 07:58AM
Well, something must be definitely wrong as I'm unable to get a decent print. It simply doesn't go beyond the 3rd layer without messing up the previous layers.

Indeed the sync between Z steppers must be related, although I've tried several times a complete bed leveling routine followed immediately by a print, so no time to pressure the bed. However, sometimes the printer makes a noise when moving Z axis as the bed would be if it wasn't totally horizontal (I'm sure it would loose some steps there).

Sorry for my dumb question, but what is a jig in this context? I'm not a native English speaker and couldn't get any clarification from googling it. smiling smiley

I'll re-align the Z axis (unscrew the bolts, take the threaded rod, move freely the bed up and down and screw the bolts back). Maybe it would help?

By the way, what does it do the "Z_STEPPER_AUTO_ALIGN" option? I tried it and it seemed it was using the Z probe to align the height between Z steppers but it doesn't seem to work and I've found contradictory information online.
Re: Unified Bed Leveling - What am I doing wrong?
October 08, 2019 12:40PM
A jig is a tool used to align things. For example, if you're putting together a bicycle frame, you could use a jig that's designed to hold all the parts in alignment while you weld them together.

In my case, the jigs are just two PLA blocks about 1.5x1.5x10cm - I put one under each end of the X axis and manually turn the Z leadscrews until the axis hits the blocks on both sides. Then I carefully pull out the blocks horizontally so the axis doesn't move while I pull them out. This ensures that the X axis is in exactly the same position every time. I used the jigs before probing to create my UBL mesh, and then I use them before each print to ensure that the X axis is aligned the same as it was when the mesh was created.

If you have separate stepper drivers running each Z axis motor (instead of the more common setup of simply connecting both Z motors to the same driver in serial or parallel) you can use Z_STEPPER_AUTO_ALIGN to try to level the axis - I know there have been several problems/fixes involving this recently, so your results may vary.
Sorry, only registered users may post in this forum.

Click here to login