Using ZMIN input for the Z_PROBE for G38

First MPCNC build, doing this for my neighbor. He wants a ZMAX home in case he accidentally tells the tool to home during recovery and doesn’t want the tool diving into the work. Makes sense. Also wants to use a contact probe for finding the work top surface. Still good, I’ve done similar things with 3D printers.
I’ve build multiple 3D printers using MEGA\RAMPS+Marlin, first CNC using that combo. Using the Rambo1.4 board and downloaded the firmware for dual endstops.

Made a part to attach to the Z axis to hit a switch when at the Z_MAX position.
Added:
USE_ZMAX_PLUG
Z_HOME_DIR 1
Z_MAX_POS 40
Z now homes to max and sets the Z position to +40. Awesome.

Added:
FIX_MOUNTED_PROBE
G38_PROBE_TARGET
Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN
Left USE_ZMIN_PLUG enabled

Tried G38.2 z0, Z moves down to 0 and stops and never senses the probe. (I’m closing the probe circuit by hand)
M119 indicates the ZMIN probe is working correctly and changing states.

(insert a TON of undocumented changes adding and removing comments to try to get the ZMIN and ZMAX to work correctly (like disabling USE_ZMIN_PLUG, mostly resulting in compiler errors- none of them will work)

Decided to try using a different input for the probe besides ZMIN.
Having a hard time finding an open pin on the Rambo1.4 board, or at least anything that is documented about spare pins.

Using M43 W I, I verify that the ZMIN pin is PIN10.

(insert a TON MORE undocumented changes adding and removing comments to disable ZMIN so I can use the pin- nothing works)

In the end, the following changes DID work, but they shouldn’t have.

USE_ZMIN_PLUG
removed Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN
Z_MIN_PROBE_PIN 10

Leaving the ZMIN pin enabled and trying to use its PIN10 input SHOULD have given me a compiler error for trying to use a protected pin. Somehow it did not, and this combination actually allows the Z axis to home to ZMAX and G38 to probe to ZMIN. Note that with this change, the ZMIN and Z_PROBE are triggered together using M119.

So is there a better way to do this? I kind of stumbled onto it because all the “normal” ways of doing this with Marlin (Which I have done on 3D printers just fine) didn’t work. Although I wasn’t using G38 to probe the bed, G29 was used for bed mapping. Maybe it’s a problem with the G38 routine?

Hope this makes sense and is answerable.
Thanks.

Dont know if this helps or not, but I just got my MPCNC up and running with ramps 1.4 w/lcd, downloaded dual endstop config, and plugged z probe into Z min S and gnd. Worked great out of the box. no changes.

oh sure, just rub it in! :smiley: Sorry, it didn’t really help. The firmware is designed to work out of the box with just theZMIN endstop connected to the probe, so it should have worked for you and I’m glad it did! There is somehow some firmware confusion when the ZMAX is added to the mix and G38 is used. I am assuming that you are homing z down to the probe so when the home is done Z is the top of the work?

1 Like

This is similar to my experience, in particular Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN is bad. It does not work for G38 on the zmin pin as the name would imply, and you have to disable that option and manually set probe to the ZMIN pin, which seems backwards.

Marlin is internally confused about probing, I think because the history is around bed leveling and not the CNC use case of G38 style probing.

1 Like

Didn’t mean to tease ya. Was just stating my situation worked for z probing whatever level the metal tab is sitting on. Not sure I understand the desire to home at 40+.

Well, if it’s not just me but it’s just bad coding, then I guess I’ll be thankful I got it to work at all. I spent WAY too many hours on it. Couldn’t find anything helpful on the web. I guess it pays to be stubborn! Thanks for the confirmation.

Oh no, it’s fine! I was just being snarky, it’s cool. :slight_smile:
Just to explain what I want:
When I home to ZMAX and set the Z position to +40, that then allows me to enable soft endstops for Z minimum at 0. When I command Z down from home (+40), it can’t go past 0, which is the top of my spoilboard. This also allows me to finish a cut with one bit, go back to home on all 3 axes, change the bit, re-find Z0 with the probe, then start the next cut with all my coordinates the same. I am building this for me neighbor and I want it to be as fool-proof as possible.

2 Likes