Capacitive Auto-Leveling on TAZ 5


This was my approach of automating the bed leveling of lulzbot taz 5.

I created a small probe holder and used a 12mm capacitive proximity sensor.

I’m using an OMRON E2K-X4ME1 Proximity Sensor, Capacitive, 12mm, NPN, NO it is more expensive than other sensors, but I’m getting super reliable measures and it is working great.

I did not test it using 5V, the rambo board inside TAZ have a spare +24v output, and there are plenty empty pins on the original z-axis cable to pass +24V to the sensor. I’m using an Opto-isolator to connect the sensor to the endstop. I made a small board with proper molex connectors and heatshrinked everything. I prefer using a proper 24V instead of running the sensor on a not “supported” condition, and using a small and cheap Opto-isolator is perfect to protect your printer.

The schematics of the circuit is pretty simple:
I’ll post more details and information tonight.

Hey! I was going to post about mine later - I did a similar mod a couple of weeks ago.

I’m not using a fancy capacitive sensor, just one I found on Amazon. Instead of an optoisolator, I had a spare switching regulator (one of these - I actually have about 20 of them at the moment). that seems to be fast enough at converting the high output of the sensor back down to 5v. I’m using a 12v line for the sensor - partly because I already had it running out to the extruder for a servo for my extruder. I’m still waiting on my nice clean not-a-bunch-of-wires-in-a-proto-board PCB from oshpark, though.

What did you do with the old Z-endstop on yours? Did you make it a Z-Max stop? Drop it entirely? I left mine connected, but an odd thing happens (probably my circuit is too stupid) whenever it triggers - the whole TAZ shuts down. I now keep it in a position that it’ll never be triggered unless the cap sensor fails and the nozzle starts going through the bed - basically a last-ditch failsafe that hopefully won’t cause more problems.

Did you update the firmware for use with the ‘Extended’ G29 code? It’s pretty slick - you can set a maximum number of grid points in firmware, and in Gcode use the P token to chose a lower number if need be (IE, set max points to 8 in firmware, and then use G29 P3 to use a 3-point grid). Maybe that’s just part of the normal FW distribution now, though - my firmware is pretty hacked up and frankensteined, at this point.

Another dumb thing I’d been doing for a while… don’t use a G28 after running G29! I had my start code as:

G28 X0 Y0
G29 P5
G28 X0 Y0

Which, as is obvious to me now, wiped out the vector distortion map for the bed (which is the best part of the whole deal!)

Anyway, overall I’m pretty happy with my setup. My weird extruder (I’m using an E3D Chimera) mount didn’t really have any room for the sensor to exist in the Y axis, so it eats up a bit of my X-axis - but not as much as you’d expect.

Hello mushoo!

Thanks for sharing your experience! I finished the basic hardware yesterday, unfortunately the default firmware still does not support the enhanced G29. I just posted on the development / software forum asking about it.

Anyhow, I’ll port the optimized version of it tonight (that is currently on the development branch of marlin) and update this thread with a link to it.

How did you connect your probe? in parallel with the old one? it is weird that your taz is shutting down when it triggers it. Are you not causing a short circuit? Be careful to not fry your rambo.

I just removed mine entirely, but adding as a max z-endstop is a good idea.

Yeah I’ve got the old endstop in parallel at the moment (I didn’t feel like making it a max endstop, and besides, the z-axis travel is sloooooooooow). It’s probably something goofy, like if the capacitive sensor isn’t triggered, the regulator is putting out 0V on it’s output pin - but the endstop is trying to put 5V there. Shorting 5v to ground isn’t good…

But I’d rather burn out a fuse (well, hopefully that’s all that would happen) than break a glass bed/muck up my extruder/bend my x-axis rods/etc), so I’ll play it a little dangerous for now. Other than me purposefully hitting the endstop, it’s never once gone too low or mis-triggered.

It will, however (and I’m guessing this is a problem with the firmware) not do an initial basic Z homing sometimes - which means it’s just trying to level itself while floating 100mm in the air…

This is my actual start gcode now:

M218 T1 X18 Y0;
G28 X0 Y0;
G29 P5;

That extra G28 X0 Y0 is there because for some odd reason, my printer homes to the center of the bed now. (It’ll home X/Y/Z, then do a fast-move to the center of the bed)

Thanks for sharing! I’m very interested in something like this also. Please keep posting updated information. hopefully we can come to a final stable implementation for TAZ machines.

Your printer is homing in the center of the bed because of the (Safe Homing) feature within the configuration-h section of the marlin firmware. " This feature is meant to avoid Z homing with probe outside the bed area."
you can set it to any location or you can just disable it by commenting that section.

Aha, thanks Rp1030.

It seems like a weird way to do it - it homes X, then Y, then Z (using the capacitive sensor), and only then does it move X/Y to the center of the bed.

It does this by taking the value set as your bed size and dividing each by 2 ex: X:298 / 2 and Y:280 / 2
so it takes the 0 for your X and Y (as calculated by the end stops), adds your bed size values, divides in half, and places your nozzle at the calculated center position :smiley:

Oh no no, I get how it does it. But if it’s supposed to do it to avoid ‘z homing with the probe outside the bed area’ why does it Home Z FIRST, and THEN move to the center of the bed?

WIth me, it homes X and Y, moves to the center, then homes Z

For anyone interested,

I just finished porting lulzbot changes to the marlin software to the latest marlin version, this include the new optimized grid leveling.

more information on here

Video of the probe, with the latest firmware in action:

Video not found.

ohhh, it was missing the last character…

new URL:

Sorry :slight_smile:

Hi All

I’ve managed to integrate this mod in to my Taz 5, so firstly, a big ‘thank you’ to Vitor!!

I only made one small change, which was to wired the mini PCB inside the main enclosure box to keep everything tidy and then used three spare pins on the X-Axis plug to pass through the z-probe wires.

Firmware installed nicely too, and although G28 followed by G29 seem to be doing the right things, the actual print doesn’t seem to be taking it in to account. Here’s my start G-Code:

G91 ; switch to relative positioning
G1 Z10 ; safe raise of z axis to ensure probe doesn’t hit bed clamp
G90 ; switch back to absolute positioning
G28 ; home all axes
G29 ; level print bed

The Z offsets looks sensible (ranging from -0.09 to 0.62), and they are repeatable if I run G28 followed by G29 multiple times (± 0.01).

I’m currently just trying to print a calibration piece:

This is where my problems start though, as the left hand side of the print is too close, and is resulting in a smear of plastic, the right hand side of the print is a millimetre or more too high so the filament is just being dropped on.

Anybody had any similar issues? I have tried a couple of different firmware versions in case it’s a bug in the Z offset map, but they all seem to produce the exact same results.

Whilst printing, I can see the Z-Axis slowly rotating back-and-forth, so it obviously thinks it’s doing what it should.

I know some people have used upgraded anti-backlash nuts, but it looks like this was on a Taz 4 or earlier, and mine is a Taz 5.

Any help or suggestions gratefully received.

Perhaps the capacitive sensor is ‘seeing’ through the PEI sheet to nonuniformities in the adhesive layer?

One way to find out would be to issue “G28 Z” (home Z axis) commands at various X/Y positions above the bed. Then use a couple sheets of paper as calipers between nozzle and bed.

Thanks for suggestions.

I bought a thin sheet of aluminium to sit on the top of my glass bed with enough flex to help remove larger prints. I was going to print some new feet before I used it, but maybe I’ll test the capacitive sensor on that as it’s solid.

I was lead to believe that capacitive sensors wouldn’t be affected by glass though?

The sensor I have (which I think is different from the ones in this thread, though still capacitive - and I’m not using an opto-isolator, I’m using a switching regulator as I had one lying around) definitely doesn’t ‘see’ through the glass. My initial problems were running a G28 after G29, which then reset the calibration. But you’re seeing the z-rods move a bit, so it’s obviously not that.

One other thing I had happen later on, was I started to hear a ‘knocking’ sound whenever the Z-axis would change directions. Took me forever to figure out what was causing it, as it seemed everything was moving correctly. What had happened was that one of the stepper couplers to the rod had shattered, but since it’s made in a spiral, the two disconnected halves of the coupler were still ‘mating,’ there was just a lot of slop in it now as they weren’t truly connected. I ended up swapping out both couplers for bigger stronger ones. I mention all this to say that if one of your couplers isn’t quite tight enough, it can slip, which may present itself as weird Z positioning (especially if it’s just one side that gets out of whack) even while everything looks to be moving normally.

Now, I’ve done a good amount of firmware hacking on my TAZ4, so this gcode may not be too helpful, but here’s my start code:

G28 X0 Y0;
G29 P3;

My unit has G28 set to home the Z axis in the center of the bed, so the G28 X0/Y0 brings it back to front left. I also have modded in some ‘advanced’ g29 commands, which is the P3 part. My default G29 tests at I think 8 or 9 grid points, but the Px command lets me decide to only sense at 3, or 4, or 5 or whatever.

Maybe yours does G28 in the center of the bed too? In which case, maybe it’s getting itself out of whack and thinking it’s calibration points are in a different location than they actually are. Also make sure you’ve got the X/Y offset of the sensor (from T0) calibrated correctly in the firmware.

Glass has a 4.7 dielectric constant, compared to ~1 for air/vacuum. Would expect the adhesive to also have a significant dielectric constant.

So yes, the sensor may be affected by glass and adhesive. Please test the probe accuracy by manually homing the Z-axis at various X/Y positions. I am highly curious as to the results.

@mushoo Interesting to hear about the Z-axis slipping and shattering issues. I will have to take a closer look at mine, similar problems may be present.

Thanks for everyone’s contributions.

Firstly, I have retried my prints using a sheet of aluminium on top of the glass, and the results have been exactly the same, so can rule that out.

I also have the ‘G29 Advanced’ installed, so I can run ‘G29 T n5’ to scan more points and generate a map. Here’s three repeats of running G28 followed by G29 T n5…

******* FIRST RUN ********
RECEIVED: Eqn coefficients: a: 0.01 b: -0.00 d: 0.89
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: planeNormal x: -0.01 y: 0.00 z: 1.00
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

******* SECOND RUN ********
RECEIVED: Eqn coefficients: a: 0.01 b: -0.00 d: 0.88
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: planeNormal x: -0.01 y: 0.00 z: 1.00
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

******* THIRD RUN ********
RECEIVED: Eqn coefficients: a: 0.01 b: -0.00 d: 0.88
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: planeNormal x: -0.01 y: 0.00 z: 1.00
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

There doesn’t seem to be any play in the z couplers that I can see, or feel. I think the clicking is more likely to be a current thing with the z-axis turning so slowly…could be wrong.

Also, I don’t think added an extra ‘G28 X0 Y0’ will make any difference to me. The X and Y seem fine and are reporting correctly on the LCD. If I do it my sensor will crash in to my bed clamp too. :slight_smile:

Any more thoughts?

It’s so close to working, and I know once it is the quality and reliability of my prints will be amazing!