G92 and Z height question

Using Estlcam for a while now to generate the gcode for my mpcnc (ramps/marlin), I always manually edit the beginning of the gcode to change the G00 to G92 as below:

G90
M03 S24000
G00 X0.0000 Y0.0000 Z0.0000 F2100
G00 Z20.0000 F480

G90
M03 S24000
G92 X0.0000 Y0.0000 Z0.0000 F2100
G00 Z20.0000 F480

Is there a place in Estlcam settings where i can have it done automatically?

Second question, I use a custom Z-probe for homing Z (0.5mm feeler gauge), so i manually lower my Z by 0.5mm after homing and before starting the job, again, is there an entry in the settings for this?

Thanks for your help!

I’m only an occasional EstlCAM user, but, assuming you always use a touch plate to set your Z height to the top of the stock as described, then you can solve both of your problems by putting a G92 X0 Y0 Z0.5 at the your g-code script and leave the G00 alone. You can add edit what gets added to the top of every script by going to Setup->CNC Programs->Texts->Program Start.

If your setting home varies, then things get a bit more complicated. Let me know where you are trigging the Z homing from.

1 Like

Thanks for your reply, basically, I use the Home X/Y command in marlin, then move manually X/Y where I want to start the job, and finally home Z at the top the stock…

1 Like

You say “in marlin.” Are you triggering your homing sequence from the V1 Custom menu on the LCD or elsewhere?

yes, from the V1 custom commands on the lcd controller (I use the SD card)

What I would do is to not put the offset into the EstlCAM start script. Instead you have two choices. If you are comfortable flashing firmware to your board, then you can add the needed code to the V1 Custom menu. If you don’t want to modify the firmware, then simply write a g-code file (text file with a ‘.gcode’ extension) for homing Z and run it like you would any other g-code file on the SD card. The script I run came from Ryan’s store page for his touch plate:

G28 Z       ;  Home Z
G92 Z0.5    ;  Set current offset to 0.5 for Z
G0 Z5 F480  ;  Lift Z to allow touch plate to be removed

Note that if you use this code, you would leave the G00 alone in the g-code generated by EstlCAM so that the bit gets moved to the home position.

If you want to modify the V1 Custom menu to do this same thing, let me know and I’ll show you what line in configuration_adv.h has to be changed to encorporate these three lines of g-code.

thanks, I will try later on today with the .gcode and let you know!
Thank you for your help!

I’m not sure if/how the files on the SD card are sorted for display. If they are sorted by name, the put an underscore or tilda at the front so that the home script always appears at the top of the files list. For example, name your file “_HomeZ.gcode” or “~HomeZ.gcode”.

Where would that be?

Just to be clear, this is a modification to whatever version of Marlin you are running and you have to re-flash the firmware after making the change. In configruation_adv.h, search for this line to identify the section to be modified:

#define CUSTOM_USER_MENUS

This is the menu item to be modified:

  #define USER_DESC_2 "Home Z Axis"
  #define USER_GCODE_2 "G28 Z"

The second line gets changed to:

#define USER_GCODE_2 "G28 Z\nG92 Z0.5\nG0 Z5 F480"

Note that the 0.5 is the thickness of the touch plate, and the “G0 Z5 F480” lifts the bit off the touch plate and is optional.

1 Like

So are you saying the GCode in the beginning of the file should read:
G90
M03 S24000
G00 X0.0000 Y0.0000 Z0.0000 F2100
G00 Z20.0000 F480

G28 Z ; Home Z
G92 Z0.5 ; Set current offset to 0.5 for Z
G0 Z5 F480 ; Lift Z to allow touch plate to be removed

??

This is not right, but the “right” solution will depend on your personal approach and the tools/software you are using, and which machine you are using (Lowrider or MPCNC). I would suggest the following:

First, separate out the homing commands so they are executed before your file is run. This includes Z. The Z homing code in your g-code snippet will only work for the Primo/MPCNC, and it assumes you are using the touch plate that V1 sells, which is 0.5mm thick. You can attach the Z homing code to a custom button in Repeteir-Host (don’t use the home Z button) or put it in a file on the SD card, or, if you are comfortable modifying Marlin firmware, it is very simple to modify the custom menu in the V1 maintained versions of the Marlin firmware.

Once you have that done, your process can be:

  • Home X and Y of your machine. This homing is available from the screen, if you have one, and Repetier-Host, and other places.
  • Electronically navigate so the router is over whatever surface you are using as a Z reference for your job. In the beginning, I suggest you use the top of the stock as your reference, and it must match whatever you specified in your CAM. The other common reference is the top of the spoil board.
  • Home Z using the code you list and a touch plate.
  • Electronically navigate so your XY is over the position you want to use as the origin/home for the job. That is a position you specify in CAM, and is typically the front left corner. Note that, if needed, it is okay to raise Z.
  • Start your job.

If you use this process, there should not be a G92 in your file.

Comments on your code.

G00 X0.0000 Y0.0000 Z0.0000 F2100

This line is wrong to execute before homing. It is unnecessary if you follow the process I outlined, and it moves the Z axis too fast, which can result in lost steps. Assuming a 4-start lead screw, I’d keep the Z movement under 480, especially given this is a one-time move.