Capacitive Auto-Leveling on TAZ 5

First, testing the probe accuracy by manually homing the Z-axis at various X/Y positions may provide some insights into how much the sensor is failing, where it is failing, or at least rule out mechanical/firmware glitches.

Second, the sensor and extruder nozzle are not in the same X/Y position. If the materials are sufficiently deformed, or the firmware does not account for this, that may result in the extruder nozzle positioning at a different Z-height.

Third, you may want to try grounding that aluminum sheet - otherwise it may not have any significant effect on the capacitive probe.

EDIT: Just checked the Marlin firmware configuration. Does not seem to include any compensation for the X/Y positional difference between sensor and extruder. So “warping” is a likely cause. Personally, I have found the corner-leveling mechanisms can exert sufficient force to bend the glass.

Please try unbolting the ‘tabs’ holding the glass to the corner-leveling mechanisms. Just let the bed rest gently on its own, and see if the natural flatness of the glass fixes things.

Hi mirage

Thanks for thoughts.

  1. I’ve just manually checked the bed and sensor so, ran G28 which home to 2mm above centre (X & Y) of bed. Then I manually positioned the sensor over the same points that get automatically probed and checked them. Here’s results:

Y / X | 32 | 147 | 262

285 | -1.7 | -0.2 | +0.8

170 | -1.0 | 0 | +0.9

55 | -0.5 | +0.3 | +0.9

These seem to match up pretty well with (± 0.1).

  1. I’m pretty sure my probe offsets are correct. Probe is directly in front of extruder in X axis (0 offset), is 32mm in front of extruder in Y axis (-32), and there is a 2mm gap between the extruder and the bed when the Z axis is homed in the centre of the print bed (-2).

  2. As for grounding, would clipping the aluminium to a radiator pipe or similar be enough? I assume you’re just trying to ensure it has discharged any static electricity?

I am suggesting the manual homing procedure at a variety of positions across the bed to rule out any mechanical issues. During homing, the only motion is directly downward until the stopping point is reached, whereas leveling involves a lot more complicated X/Y/Z moves that could be causing problems.

I am of course assuming the sensor is wired in place of the Z-axis limit switch, and can be used as a homing device anywhere on the bed.

Consider the following G-Code.

G28

G0 X275 Y275
G28 Z

G0 X25 Y225
G28 Z

Grounding the foil can be accomplished by electrically connecting it to the same power supply rail as the sensor. Ideally, through a high-value capacitor (~1uF), to maintain DC isolation for safety. This will allow the foil to serve as a capacitor plate, in the same circuit as the sensor.

OK, well I’ve manually checked various spots on the bed using the example code you supplied including the four corners. All of them were spot on, which is 2mm off due to probe offset. When the Z axis was moved 2mm down it held a sheet of paper firmly but was still able to be gently moved.

Appreciate the ideas but what exactly is grounding the plate supposed to achieve? The sensor is supposed to be able to detect over glass, wood, plastic, even liquids and the results I’m getting now over aluminium are the same as I was over the glass bed directly. It’s the same places which are high and low when printing. Other people are using the same sensor over glass without issues, so I can’t believe I need to go to all this extra trouble?

Ok, so sounds like the Z-axis is aligning perfectly to the bed when homed at various positions. Which suggests the sensor itself is accurate.

Next thing I would suspect is mechanical issues, either warping or repeatability. If the following G-Code results in spot-on alignment, then warping is the most likely candidate.

G28

G0 X150 Y150
G28 Z

G0 X275 Y275
G0 Z 6
G0 Z 4
G0 Z 5
G0 Z 4
G0 Z 7

G0 X25 Y25
G0 Z 6
G0 Z 4
G0 Z 5
G0 Z 4
G0 Z 7

G0 X150 Y150
G0 Z0
G0 Z0.1
G0 Z0

This homes the machine, moves to center, homes Z, jogs it around, then brings it back to center. If Z is still precisely aligned, then X/Y/Z backlash is likely not the problem.

Grounding the plate makes it part of the same circuit as the probe’s concentric capacitive sensing plates. More intuitively, it will serve as an actual electrical shield, just like a metal enclosure, guaranteeing the sensor does not ‘see’ beyond that surface. However, since you have already verified accurate alignment using the manual G-Code I provided, I am guessing that is not the problem after all.

can’t believe I need to go to all this extra trouble?

Sorry, but as with any complex machine, any of several problems could be responsible for misalignment. Basic debugging is to establish what works, to narrow down the possibilities.

Sorry if I came across ungrateful, I just meant I couldn’t see why I’d need the extra electronics when other people have got the levelling working on the same printer using the same sensor without them. My mod was completely based on Vitor’s setup with only one change as to where my PCB was stored.

Just so I understand, what are you suggesting could be warped/warping?

Several things could be warped, but the glass is most likely, especially if you have a factory-built Taz.

Glass is naturally flat, but those corner brackets can easily exert enough pressure to bend the glass if adjusted improperly. Quickest way to check would be to unscrew the tabs holding the glass down, so it just rests in place by gravity alone.

No offense taken by the way. Just have patience, check everything, and I am sure we can get this working. Feel free to give me a call, and I will be on IRC later today.

Thanks for bearing with me and for the kind phone call offer. I’m in the UK so might be a bit pricey. iRC might be an option, although I’ll need to find client for Mac.

Glass isn’t clamped down, although has been, so warping is possible. It was factory built. I’m pretty sure the supporting aluminium plate isn’t straight. I was struggling to find enough adjustment in the supplied levelling feet (running out of thread and spring adjustment) to get things perfectly flat which is why I started down the auto levelling route.

The aluminium sheet I’m using now is flat and is just sitting on top of the glass with the brackets just pushing against the sides of the sheet, rather than clamped on top.

I have tried to jolt z axis motor using controls…various amounts from 0.1mm to 1mm up and down but it doesn’t seem to affect things. It might be slightly tighter to the paper afterwards, but marginal.

Couple of questions. I thought the G29 creating a 3d map of the bed. I currently scan 9 points by default but have tried 25 too. Surely this should work even if the plate was warped?

Secondly, if the z-axis was suffering from backlash wouldn’t it affect the whole bed once it started performing it’s second or third outline?

My thinking is that the sensor is slightly offset from the extruder, and if the bed is warped badly enough, the measurement error could be significant. Even with 25 measurement points, the the auto-leveling system might not work if the Z-height at some places is higher than the extruder, but lower in others. Similarly backlash might be a somewhat random problem.

So far, we seem to have ruled out backlash and sensor accuracy. However, if you were running out of adjustment height in the corner brackets during leveling, that suggests unusually severe misalignment in the machine, which can manifest as warping. Similarly, your first post mentions a left-to-right shift in Z-axis height, even with auto-leveling, which is also consistent with warping.

At HacDC, I have access to a Taz5, which needed only minimal adjustment for exact alignment across the entire bed. By contrast, my Taz3 Y-axis has been mounted with a slight twist, which caused uncorrectable errors upwards of 3mm, which I solved with steel shims, 3/16" aluminum plate, 25mm M3 screws, and heavy-duty springs.

I think it’s a good bet something about your machine is not simply not square, and solving that will likely enable the auto-leveling system to function perfectly.

Try manually leveling the bed again. If you find alignment is better when the glass is slightly bent, or when one diagonal (eg. top-right to bottom-left) must be raised higher than another (eg. top-left to bottom-right), then that problem must be addressed.

The Taz 3 and Taz 5 Y axis mounting blocks are different. The ones that were on the 3 will actually allow a few mm worth of up and down travel even with the allignment screws tight if you aren’t careful with them. The 4/5 variant of that mounting block does not have that issue

Right, but the point is the Taz5 should not need to bottom-out the leveling brackets during manual leveling. That’s not normal.

Astek777, did you manage to get this working?

Hey Mirage

Not fixed yet, the saga continues. :frowning:

Been doing lots of testing, checking, waiting for replacement bits etc. Here’s what’s been done so far now:

  1. Checked lots of measurements to ensure X/Y bars are parallel and level. They seem pretty good.

  2. Tried a number of different firmwares including the latest Dev version of Marlin. No change from that.

  3. Made contact with Roxy on 3DPrintboard who seems to know quite a bit about the auto-bed-levelling routine to try and find out a little more about how it works.

  4. Tried some of the different bed levelling options:

4.1 Auto Bed Levelling
More testing with the auto-bed-levelling routine. Repeatability tests:

******* FIRST RUN ********
RECEIVED: Eqn coefficients: a: 0.01 b: -0.00 d: 0.89
RECEIVED:
RECEIVED: Bed Height Topography:
RECEIVED: --1.61390 --0.90640 --0.21327 +0.44360 +0.99610
RECEIVED: --1.32577 --0.66765 --0.06640 +0.48798 +0.97235
RECEIVED: --1.07202 --0.44702 +0.06423 +0.53923 +0.94985
RECEIVED: --0.85202 --0.27327 +0.18798 +0.61548 +0.99423
RECEIVED: --0.67702 --0.14577 +0.26923 +0.70360 +1.03673
RECEIVED:
RECEIVED: planeNormal x: -0.01 y: 0.00 z: 1.00
RECEIVED:
RECEIVED:
RECEIVED: Bed Level Correction Matrix:
RECEIVED: 0.999958 0.000000 0.009196
RECEIVED: 0.000020 0.999998 -0.002187
RECEIVED: -0.009196 0.002187 0.999955
RECEIVED: ok

******* SECOND RUN ********
RECEIVED: Eqn coefficients: a: 0.01 b: -0.00 d: 0.88
RECEIVED:
RECEIVED: Bed Height Topography:
RECEIVED: --1.61460 --0.90898 --0.22023 +0.44415 +1.00790
RECEIVED: --1.33210 --0.67273 --0.06773 +0.48540 +0.97602
RECEIVED: --1.07460 --0.45835 +0.06727 +0.54352 +0.95040
RECEIVED: --0.84960 --0.27273 +0.19102 +0.61477 +1.00227
RECEIVED: --0.67273 --0.14210 +0.27165 +0.70165 +1.03040
RECEIVED:
RECEIVED: planeNormal x: -0.01 y: 0.00 z: 1.00
RECEIVED:
RECEIVED:
RECEIVED: Bed Level Correction Matrix:
RECEIVED: 0.999958 0.000000 0.009216
RECEIVED: 0.000020 0.999998 -0.002196
RECEIVED: -0.009216 0.002196 0.999955
RECEIVED: ok

******* THIRD RUN ********
RECEIVED: Eqn coefficients: a: 0.01 b: -0.00 d: 0.88
RECEIVED:
RECEIVED: Bed Height Topography:
RECEIVED: --1.62077 --0.91577 --0.21203 +0.44672 +1.01423
RECEIVED: --1.33452 --0.67515 --0.06953 +0.48735 +0.97860
RECEIVED: --1.07515 --0.45390 +0.05860 +0.53860 +0.94423
RECEIVED: --0.85015 --0.27015 +0.18672 +0.60422 +1.00860
RECEIVED: --0.66453 --0.13703 +0.26860 +0.70047 +1.04172
RECEIVED:
RECEIVED: planeNormal x: -0.01 y: 0.00 z: 1.00
RECEIVED:
RECEIVED:
RECEIVED: Bed Level Correction Matrix:
RECEIVED: 0.999957 0.000000 0.009226
RECEIVED: 0.000020 0.999998 -0.002206
RECEIVED: -0.009226 0.002206 0.999955
RECEIVED: ok

…and some M48 tests for repeat accuracy…

M48 x32 y23
RECEIVED: Mean: 2.164063
RECEIVED: Standard Deviation: 0.002223
RECEIVED:
RECEIVED: ok
SENT: M105
SENT: M105
RECEIVED: echo:endstops hit: Z:2.16
endstops hit: Z:2.16

M48 x262 y23
RECEIVED: Mean: 3.819562
RECEIVED: Standard Deviation: 0.001582
RECEIVED:
RECEIVED: ok
SENT: M105
SENT: M105
RECEIVED: echo:endstops hit: Z:3.82
endstops hit: Z:3.82

M48 x262 y253
RECEIVED: Mean: 3.848125
RECEIVED: Standard Deviation: 0.001452
RECEIVED:
RECEIVED: ok
SENT: M105
SENT: M105
SENT: M105
RECEIVED: echo:endstops hit: Z:3.85
endstops hit: Z:3.85

M48 x32 y253
RECEIVED: Mean: 1.183125
RECEIVED: Standard Deviation: 0.001768
RECEIVED:
RECEIVED: ok
SENT: M105
SENT: M105
RECEIVED: echo:endstops hit: Z:1.18
endstops hit: Z:1.18

M48 x149 y172 (X/Y Safe Home Position - Centre of Bed)
RECEIVED: Mean: 2.000750
RECEIVED: Standard Deviation: 0.002634
RECEIVED:
RECEIVED: ok
SENT: M105
RECEIVED: echo:endstops hit: Z:2.00
endstops hit: Z:2.00

4.2 Three Non-Linear Points
Didn’t seem to help, but I might try rotating the points around just to see whether that affects anything.

4.3. Manual Mesh Levelling
This actually provided pretty good results so may be an option for the minute. I did this using a simple 2x2 grid (points as close to corners of bed as possible). The Z offset on this was pretty accurate across the whole of the bed. I took this to prove that my bed itself if pretty flat, even if the plane is angled. There is some talk about the introduction of auto mesh levelling, but this could be some way off.


So…not quite sure where to go from here?! Auto-bed-levelling is still seems to be doing the correct thing, but the left hand side is always too low (especially front left), and right hand side is always a bit high.

Mesh leveling succeeding, auto leveling failing. Definitely consistent with some tiny bit of twisting on the machine.

HackADay once featured a non-firmware based autoleveling setup, IIRC using a modified version of pronterface, which looked much more sophisticated. That might solve your problems.

EDIT: http://hackaday.com/2012/04/23/automated-bed-leveling-with-our-3d-printer/

EDIT2: Looks like this is still under development. Guess we just need the firmware to support automatic mesh leveling. Should be simple, I’ll look into this after assembling my Taz_Mega.

EDIT3: As a workaround, you could wire the capacitive sensor to a buzzer, then follow the manual leveling procedure rather easily.

What other measurements should I be taking/checking? I guess it’s good that it’s constantly inconsistent in the same places. :wink:

Actually, you already have some interesting data.

RECEIVED: Bed Height Topography:
RECEIVED: --1.61390 --0.90640 --0.21327 +0.44360 +0.99610
RECEIVED: --1.32577 --0.66765 --0.06640 +0.48798 +0.97235
RECEIVED: --1.07202 --0.44702 +0.06423 +0.53923 +0.94985
RECEIVED: --0.85202 --0.27327 +0.18798 +0.61548 +0.99423
RECEIVED: --0.67702 --0.14577 +0.26923 +0.70360 +1.03673
RECEIVED:
RECEIVED: planeNormal x: -0.01 y: 0.00 z: 1.00
RECEIVED:
RECEIVED:
RECEIVED: Bed Level Correction Matrix:
RECEIVED: 0.999958 0.000000 0.009196
RECEIVED: 0.000020 0.999998 -0.002187
RECEIVED: -0.009196 0.002187 0.999955
RECEIVED: ok

First, the “Topography” range is -1.613 to +1.036, while the “Correction Matrix” range is only -0.009 to 0.999. Looks like the firmware is clipping the maximum correction values to ~1mm.

Second, the high spot in both the “Topography” and “Correction” matrix moves from the bottom-left to top-right corner. The bed is definitely twisted, by as much as 2.6mm.

Third, the measurements differ by more than 0.5mm from one sampling point to the next in a 5x5 sampling grid. That’s actually quite severe.

Using your capacitive sensor as a manual position indicator (using a buzzer) in mesh leveling mode with at least a 10x10 grid may allow you to bring the alignment error to less than 0.25mm. However, it would probably be easier to level the table better first. If you can bring the entire table within 0.75mm of the nozzle position, the existing auto-leveling feature may work fine.

Hi Mirage

These figures were produced when I removed the springs from my Taz 5 feet to secure them solid. As you said, a couple of millimeters out. I did try again to get the bed as level as possible. Here were the results to that:

Here’s the ‘G29 V4 T n5’ response you wanted to see:

RECEIVED: Roxy’s Enhanced G29 Auto_Bed_Leveling Code V1.81:
RECEIVED: Full support at http://3dprintboard.com

RECEIVED: Bed x: 32.00 y: 23.00 z: 0.83
RECEIVED: Bed x: 89.00 y: 23.00 z: 0.96
RECEIVED: Bed x: 146.00 y: 23.00 z: 0.99
RECEIVED: Bed x: 203.00 y: 23.00 z: 0.95
RECEIVED: Bed x: 260.00 y: 23.00 z: 0.82

RECEIVED: Bed x: 32.00 y: 80.00 z: 0.82
RECEIVED: Bed x: 89.00 y: 80.00 z: 0.82
RECEIVED: Bed x: 146.00 y: 80.00 z: 0.94
RECEIVED: Bed x: 203.00 y: 80.00 z: 0.89
RECEIVED: Bed x: 260.00 y: 80.00 z: 0.82

RECEIVED: Bed x: 32.00 y: 137.00 z: 0.70
RECEIVED: Bed x: 89.00 y: 137.00 z: 0.70
RECEIVED: Bed x: 146.00 y: 137.00 z: 0.89
RECEIVED: Bed x: 203.00 y: 137.00 z: 0.77
RECEIVED: Bed x: 260.00 y: 137.00 z: 0.80

RECEIVED: Bed x: 32.00 y: 194.00 z: 0.61
RECEIVED: Bed x: 89.00 y: 194.00 z: 0.70
RECEIVED: Bed x: 146.00 y: 194.00 z: 0.80
RECEIVED: Bed x: 203.00 y: 194.00 z: 0.80
RECEIVED: Bed x: 260.00 y: 194.00 z: 0.80

RECEIVED: Bed x: 32.00 y: 251.00 z: 0.38
RECEIVED: Bed x: 89.00 y: 251.00 z: 0.61
RECEIVED: Bed x: 146.00 y: 251.00 z: 0.74
RECEIVED: Bed x: 203.00 y: 251.00 z: 0.80
RECEIVED: Bed x: 260.00 y: 251.00 z: 0.74

RECEIVED: Eqn coefficients: a: 0.00 b: -0.00 d: 0.85
RECEIVED: Mean of sampled points: 0.787550
RECEIVED:
RECEIVED: Bed Height Topography:
RECEIVED: --0.40880 --0.17317 --0.04692 +0.01433 --0.05067
RECEIVED: --0.17755 --0.08380 +0.01370 +0.01120 +0.00870
RECEIVED: --0.08567 --0.08567 +0.10308 --0.01880 +0.01683
RECEIVED: +0.03620 +0.02808 +0.15558 +0.10245 +0.03308
RECEIVED: +0.04745 +0.16870 +0.19933 +0.16245 +0.02995
RECEIVED:
RECEIVED: planeNormal x: -0.00 y: 0.00 z: 1.00
RECEIVED:
RECEIVED:
RECEIVED: Bed Level Correction Matrix:
RECEIVED: 1.000000 0.000000 0.000586
RECEIVED: 0.000001 0.999999 -0.001098
RECEIVED: -0.000586 0.001098 0.999999
RECEIVED: ok

This was based on a 5x5 grid. While it was like this I was getting better prints with auto-bed-levelling off than when it was on.

The places where it was out, and the amounts it was out by was almost identical to when the bed was very wonky.

Thanks, this is very interesting!

RECEIVED: Bed Height Topography:
RECEIVED: --0.40880 --0.17317 --0.04692 +0.01433 --0.05067
RECEIVED: --0.17755 --0.08380 +0.01370 +0.01120 +0.00870
RECEIVED: --0.08567 --0.08567 +0.10308 --0.01880 +0.01683
RECEIVED: +0.03620 +0.02808 +0.15558 +0.10245 +0.03308
RECEIVED: +0.04745 +0.16870 +0.19933 +0.16245 +0.02995
RECEIVED:
RECEIVED: planeNormal x: -0.00 y: 0.00 z: 1.00
RECEIVED:
RECEIVED:
RECEIVED: Bed Level Correction Matrix:
RECEIVED: 1.000000 0.000000 0.000586
RECEIVED: 0.000001 0.999999 -0.001098
RECEIVED: -0.000586 0.001098 0.999999

So, the “Topography” measured varies from --0.40880 to +0.19933 (~=0.6mm) while the “Correction Matrix” still varies from -0.001098 to 1.000000 (~=1.0mm) . Also, the actual twisting is strongly toward the mid-left, while correction matrix shows a perfectly centered twisting motion.

These results closely match an existing bug report against the Marlin firmware (https://github.com/MarlinFirmware/Marlin/issues/1690). Apparently, the autoleveling mechanism provides wildly inaccurate results, even when twisting is controlled to <0.3mm. The developers seem to have concluded the printers still need better alignment, rather than better firmware. :unamused:

Ultimately, it is not surprising you are getting better results with manual leveling. However, mesh leveling should be able to correct the remaining 0.6mm error easily. Without removing the springs, please try using the mesh leveling utility again.

Thanks for analysing those figures for me.

I can get a rough idea of how the bed is lying from the figures, but what is the ‘twist’ that you keep referring to? Do you mean because the Z axis is out the X/Y are also affected which produces a slight rotation? What on the printer is likely to be causing it?

Also, do you think the mesh levelling is a better option for me than 3 point auto levelling? Assuming I can pick the right three points aren’t I defining the plane to use exactly?

Thanks for bearing with me on this.

The two Y-axis rails are not parallel in the Z dimension. In an exaggerated case, the two rails would look like an “X” when viewed from the side of the printer.

As the bed slides in the Y-dimension (front to back), it will rotate around the XZ plane. So, although the glass surface and X-axis may be highly flat, the bed will not ‘appear’ flat from the probe’s perspective, as the bed is moving along a distorted frame.

Specifically, the topography measurements show the bottom left corner is slightly lower than the others. In fact, this means the top left part of the linear rails is a bit too low, because that is where the bed’s bearings are positioned during this readout. All assuming the number “–0.40880” represents the bottom-left position on the bed of course (ie. ~ X0, Y300).

Because this distortion is not linear, it cannot be treated as a plane. Any kind of alignment at three points is insufficient, and any algorithm that assumes a flat plane will not work.

Thus, two solutions are left. Maintaining the Y-axis to better than 0.6mm should be possible, though it may take some work. In fact, I have always wondered how tightly Aleph Objects is controlling this parameter at the factory. However, mesh leveling is a much easier approach, especially with an automatic probe.

By the way, try watching the bed closely at eye level while moving it (Y-axis travel). You should clearly see the left side moving up and down slightly, especially for parts that have not been adjusted.