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

It’s alive! I spent a couples days prototyping different placement and techniques.

tl;dr: it works even better than I hoped. Total cost was ~$35.

I ended up screwing the VL6180 sensor on the bottom of the bracket which holds the Z-motor. Then, I super glued a piece of white glossy plastic (cut out from a blank white electrical face-plate) to the “trigger” on the Rigid (the clasp you pull out to release the Z-axis so the router can be removed). Both planes (sensor & target) are thus solidly attached. The glossy white plastic provides a very good target for the TOF sensor (highly reflective).

Right now, the sensor data just goes through an Arduino Nano before being fed into the Raspberry Pi controller. The data is read by Node RED via serial (USB), smoothed, and then piped into a Home Assistant sensor. No fancy automations yet. When I change bits, I just push the router in to touch the bit to the stock as I am replacing the router and take note of the mm reading from the sensor. This is much quicker than manually zeroing, and requires no extra hardware (touchplate). Then, any time I need to re-zero, I can move the Z until the sensor reads the same original value and then “save Z.” This can even be done remotely.

I suspect the easiest way to automate this would be to simply implement a touch probe. I believe it’s just a matter of closing the circuit on AUX4 when the sensor reaches the original value…

But I wish I could just tell Maslow / Web Control what the actual distance is, without moving/probing the Z axis at all. For example, I wish I could send a command to Web Control that says “the current Z value is actually +3mm” and have it set the zero value based upon this information. @madgrizzle any thoughts on this? I’m happy to implement it, but would appreciate any tips or words of caution if I’m totally off the rails here.

1 Like