Maslow Home Maslow Community Garden Newsletter

How to auto-zero the z-axis using a high-precision distance sensor?

I’ve read the writeups on zeroing the z-axis using a simple piece of metal to detect when the bit touches home. I find it too cumbersome to stop and zero; I’d rather do it fully automatic.

Folks have shown the VL6180x to have sub-mm accuracy. Rather than just automatic zeroing, I’m wondering if there’s a way to provide consistent feedback to the Maslow sensor as to the distance.

For example: I could easily build a small Arduino device that fed a constant stream of mm distance data to one of the AUX ports on the Maslow’s shield. What I don’t know much about is: how would I integrate with Maslow/gcode to make use of this data? Firmware change, I suppose?

What could be done by simply tweaking the existing probe concept is having the metal sheet mounted on a servo on the sled, and slide it into place when you want to zero. You could measure very accurately the distance from the top of the metal sheet to the bottom on the sled, and simply offset the zero you get from the procedure with this value. Not sure I’m explaining it properly; let me know if you want more details.

1 Like

That would work for auto-zeroing, yes, but it would not add the benefit I describe later in the post of having a constant feedback mechanism. I could inform the Maslow exactly how far plunged it was, even as it cut. This would prevent the need to re-zero in the first place, preventing any drift whatsoever in the z-axis.

I also am not a huge fan of adding a whole servo to move a metal plate to zero the z-axis. It feels like the wrong solution to the problem, when distance sensors that can measure at such high accuracy exist for $14. I mean, if nothing else, I could design a small Arduino for $20 in total parts that would close the AUX1 circuit exactly when the router hits 0mm. And then the auto re zero can happen while the router is still spinning and without moving any parts around…

But that’s basically like converting a float to a bool :stuck_out_tongue:

Yeah, I get your point. Where would you mount the sensor, though? What’s of interest is the distance between the bit and the workpiece, not the router and the workpiece. Unless the sensor you have in mind measures a gap from the side?

On top of the whole router itself, pointing straight down at one of the semi-reflective pieces of blue metal attached to the sled (especially good for light-based range-finding). Since the whole router moves and the sled doesn’t, it seems pretty easy. I’ve got most of the parts laid out already, though I don’t have the sensor yet.

1 Like

Here’s the Adafruit sensor part sheet, and a video of it working: https://www.adafruit.com/product/3316

This doesn’t solve the main issue you’re trying to solve when using the metal-plate method. The hard part in z-axis zeroing is accurately measuring the length of bit that sticks out from your router. The distance between the router and the workpiece is irrelevant, and accurate measurement of your z-movement is already taken by the encoders on the Z motor.

The distance between the router and the workpiece is irrelevant

Huh? That’s the exact definition of z-depth. Maybe you have a different router? On the Rigid, as I mentioned, “the whole router moves” aka the router and the bit are one piece. If you grab the top of the Rigid router and pull away from the board 1mm, you just lifted the bit 1mm away from the material.

So the height of the router from the workspace is (after subtracting a constant value to account for the distance of the sensor) the exact amount of distance (positive or negative) between the router tip and the board.

Yes, but we don’t really care about the router’s position, we care about the bit’s position. They move together, yes, but their relative offset will change on every tool change. That’s the problem the touch plate is trying to solve.

Ah. I haven’t dealt with many bit changes yet. But it seems to me that calibrating once when you change the bit and then having a “perfect” z-axis until you change the bit again is vastly preferable. I mean, it makes sense to me to calibrate when I change bits, and I’ve got my hands in there anyways. The problem I’m trying to solve for is the 99% of the rest of the time when I want a perfect z-axis without any fear of slippage or drift. This is a big problem on the Rigid btw… I’ve mostly fixed it but I still get a mm of drift or so per 30-60m.

Plus, this solution isn’t mutually exclusive to the touchplate. The secondary small Arduino running the zeroer could automatically find zero using this exact technique during the bit change, updating its constant offset value for the sensor distance… best of both worlds, no?

Actually, it’s not even that hard now that I think about it.

During a bit change, you have to take the router out. When you put it back in, before turning on the machine, just press the tip of the bit against the material. Then press a button on the zeroer which saves the current distance. Bam, new zero for the new bit without any extra steps or hassle.

Yeah, that would probably work with the default Ridgid Z-axis. I think Meticulous Z-axis (or similar) users leave it in, though. I’ll see how well it works once I’ve built mine, for now I’m still adjusting manually on my small Makita palm router.

Sigh, yeah. I’ve been debating how much to invest in the Z-axis given that I pre-ordered the M2. Seems like building the Meticulous would be redundant, at the very least…

I had already ordered all the parts to build a C-channel based Z-axis from AliExpress a few days before they announced the M2. From the looks of it, I’ll end up with a similar machine to the M2 (minus the electronics). Now if only the boat from China was a bit faster…

1 Like

@zaneclaes build it up and sell it to someone who wants to upgrade

This thread was a Fun read… maybe you could do a torque/current measurement off of the z motor and have it drive the bit into something that won’t dull the bit to set your zero, though that might not be as precise as you like.

I have a trip to Microcenter planned for this week, where they sell the sensor… I think I’ll do so :wink:

Even if the M2 never falls out of z-calibration, it might still make a better auto-zero than using metal. Plus, I plan to build it with a 0.96" OLED on top that shows the current z-depth, which I think might actually be useful as the sled is going for quick visual confirmation (I frequently ask myself “what depth is it on right now?”)

I have a 5" (former touch screen) as a command line display on my rpi that shows current sled position, home position, and z depth, and elapsed time. the 1" oled would be interesting to have on the router. I have a couple of them… hmm interesting idea. I wonder how much power one could bleed off of the z motor and not cause it to malfunciton?

1 Like

Ah, cool. I have one of these ESP32 boards with integrated OLED sitting unused. It also has a built-in button I can use a “zero” trigger. With the screen active but no sensor attached, I’m showing 5v @ 0.06amps. Assuming the sensor doesn’t draw too much, I doubt this should be a problem for the motor’s 5v to handle.

You should be able to pull from that five volts without issue. It’s supplied by the Arduino so anything that works hooked up to an Arduino should work. The encoders draw almost no power.

do you know the wire colors for the encoder?