Where to set touchplate thickness in Marlin firmware?

I am trying to find something CNC-related in configuration.h but have not found it yet. It all seems to be about printers and bed probes, not CNC with a touchplate. I have made a touchplate that is 3.09mm thick and wish to enter this offset so that when I home Z, the machine zeros the Z axis to the bottom of the touchplate, and then moves up a few mm.
I have seen in this forum some Gcode commands to do this, but also a mention that it can be set in firmware without finding where exactly to set that. If you know, please reply to this. THANKS!
PS - Perhaps there should be a Marlin category in the Software/Firmware section of this forum?

1 Like

I believe that people do this with the custom menu in Marlin. They set up the “home Z” script as follows:
; set relative coordinates
G91
; home Z to the touchplate
G28 Z
; Set the workspace coordinates to the top of the touchplate
G92 Z3.09
; lift the spindle 5mm
G00 Z5
; set absolute coordinates
G90

https://marlinfw.org/docs/gcode/M851.html lists a procedure to follow to find the offsets and the directives in the firmware to set them as well as the gcode command (M851) that can be used to set them in the eeprom.

Thanks, Dan and Tom. The magic line in the firmware is claimed to be for (v2.x)
#define NOZZLE_TO_PROBE_OFFSET { 10, 10, 0 }
according to that guide on using M851. I found it at line 991 of Configuration.h in my version.
That helps to translate 3D printerese into CNC routerese:
probe offset == touchplate thickness

There’s also:
#define Z_PROBE_OFFSET_RANGE_MIN -20
#define Z_PROBE_OFFSET_RANGE_MAX 20

I have not tried the touchplate out yet…We will see if it works!

2 Likes

These are to set the range of variation a person is allowed to set through a screen. As mentioned above and elsewhere, in the 3d printer world (where marlin is primarily used) most people set the x&y offsets in the firmware and leave the z offset at 0. They then adjust it via gcode or the lcd interface after they tram and level the bed. Those settings are there so that Public printers can be set to limit the options on the screen to ensure someone does not set the z offset wrong and damage the printer (as setting the probe offset wrong can cause the hotend to crash into the build plate).

For cnc you would want to leave the x and y axis at 0 and adjust the z to the probe plate thickness.

Just figured I would add that info incase you jadent figured it out on your own or someone else uses this thread in the future.

Problem not quite solved yet:
I edited the Configuration.h to
#define NOZZLE_TO_PROBE_OFFSET { 10, 10, 3.09 }
and re-flashed the RAMPS board
but that does not seem to have any effect.
The Home Z just homes Z zero to the surface of the touchplate.

Then I tried issuing M851 command in Repetier Host,
"echo: Unknown command: “M851 Z3.09”

Any advice on how to get this touchplate thickness setting to work and to stick?

One, why are you defining a 10mm offset in X and Y? I would have put the Configuration.h value to:
#define NOZZLE_TO_PROBE_OFFSET { 0, 0, 3.09 }

Two, are you sure that you aren’t being overridden in the storage (M500)?

Try sending M502 This should reset any values saved on-board back to the values definied in the firmware. Be sure to follow this with M500, or else the saved values will come back next boot.

Thanks, Dan.

I have a 10mm offset for X and Y because I was getting problems with X zero or Y zero being moved when the tool got too close (touching) the limits of travel. This was happening without missing steps or throwing any errors, and the offset fixed it.

I will try your theory that I am being overridden by the EEPROM values tomorrow (It’s late here in Ireland). Thanks for the suggestion! This situation of the EEPROM and the firmware code battling each other for primacy is new to me.

The default mpcnc firmware doesn’t thing the Z is a probe. It thinks it is an endstop. So the probe offset won’t have an affect. The LR firmware might let you use that offset.

@stevempotter

So you would need to define the z probe uses z min line before the probe offset would work.

I still can’t get the touchplate zeroing working properly.
I have uncommented
846 #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN
and
849 #define USE_PROBE_FOR_Z_HOMING
and set
991 #define NOZZLE_TO_PROBE_OFFSET { 0, 0, 3.09 }
yet it still has Z zero set to 0 at the top of the touchplate after Z homing.
And Command M851 is still not recognized.
I have used M502 and M500 after each firmware change.

What else am I missing?

GOT IT WORKING!!!
It required to choose a probe type, so I uncommented
893 #define NOZZLE_AS_PROBE
and
1391 #define Z_SAFE_HOMING
and the Z parameter sign needed to be negative in:
991 #define NOZZLE_TO_PROBE_OFFSET { 0, 0, -3.09 }

One problem I thought was the firmware but was a Repetier Host problem: It won’t allow you to move Z to a negative value after Z homing using the arrow interface. You need to use G codes.

I wish there were a setting in Repetier Host that made it more CNC-friendly, and stopped using the word ‘print’ and ‘printer’ after you selected it!

3 Likes

I was going to suggest using FIXED_PROBE, but you beat me to it.

I’m guessing it shows up as Zprobe in M119?

You can run cncjs as a desktop application instead of RH. Or change the language to french and then just pretend it says “cut”. :confused:

1 Like

I had to figure out how to turn this off, because it wanted to only do homing in the middle of the “print area”. I had to find the correct SanityCheck.h file and comment out the check for using safe homing when using a bed probe. Then it would compile with Z_SAFE_HOMING commented out.
Now I can set Z zero anywhere, which is important because the best place to set Z zero depends on the shape of the workpiece and the nature of the project.

2 Likes

Does anyone know where you define how much to move the Z after homing?

Once it touches my plate, it stays there. So I have to switch menus to jog the Z up 1mm so i can pull out the touch plate as it has small ridges.

I think the best is to make a short gcode script for this. Just probe, set Z, then move up.

Line 1116 in Configuration.h
#define Z_AFTER_HOMING 10 // (mm) Height to move to after homing Z

1 Like

Hi Folks,
I have used the existing Z end stop using a touch probe and set the following:
#define MANUAL_Z_HOME_POS 18.3 ; measurement as a result of testing the exact height of my probe plate from 0 which gives offset
#define Z_AFTER_HOMING 10 ; lifts tool up 10mm from zeroed position - this lets you remove the touch plate. System knows you are 10mm from zero
Seems to work fine!
I would be interested in views as to why this may not be a good idea as it seems to be a bit too simple!

1 Like

Simple is good. If it works reliably, stick with it.

There’s a lot of complexity in the Marlin config files because folks have come up with a lot of ways to solve particular problems. There’s no reason to engage additional elements of that complexity if simplicity gets you the results you need.

1 Like

Actually, It may have been this line that I also edited:
1368 #define Z_PROBE_END_SCRIPT "G1 Z10 F12000"