CNC Wasteboard Height/Offset Macro

  • Hello I'm new here, and also in the process of setting up a duet to use with a CNC machine. At the moment I've wired up various components and getting to know the platform. I've normally used GRBL but interesting to see what I can so with a Duet.

    I have a particular workflow I'd like to create. This includes using macros to set the x and y datum position, and waste-board height/offset, to name a few. This is to allow me to work with a CNC machine in a particular way - where I set up the CAM so that the wasetboard is 0, and not the top of the material that’s being cut. I prefer this method because it means I can manually change between bits more easily.

    I’ve managed to make a simple x y datum macro to manually jog to the bed position (imagine with a v bit in the collet) and perform a G10 P2 L20 X0 Y0 command – setting that location in G55 WCS. I use the G54 WCS like a non-modal machine position as I can’t access G53.

    That code looks like this:
    G54 ; select G54 WCS
    M291 X1,Y1,Z1 P"Jog spindle so tool touches corner of wasteboard." 1R "Warning" S3 ;
    G10 P2 L20 X0 Y0 ; set G55 X and Y to 0
    M500 ; save

    I now want to create a macro where I jog the spindle with a bit to a surfaced wasteboared to set it’s height or offset – and for that to be relational to probing onto a stationary probe switch. The probe button being to the side of and below the surface of the wasteboard.

    I’ve already written a macro to move the tool head to a known position along the x and y in G54, where I could perform a M585 probe cycle onto a stationary switch. On my GRBL controller I would normally worked out the offset manually and execute a G10 command, but I’m hoping to automate this with the duet.

    So this is where I’m getting a bit stuck – as I’m not sure how to do this as I’m struggling to imagine this with all my components laid out on a table.

    I thought I could use the G60 S0 command to save the location of the wasteboard in G54, and after probing maybe loading the z coordinates in G55 via a G10 L2 command but using slotted memory in that way doesn’t seem to be enabled. I've also managed to confuse myself.

    My next step is to wire everything up to my CNC machine so I can better imagine what's going on but I was wondering if anyone had done something similar, can imagine a work around or had any suggestions?

    Thanks in advance.

  • administrators

    @educatingsavvas said in CNC Wasteboard Height/Offset Macro:

    I use the G54 WCS like a non-modal machine position as I can’t access G53.

    Why are you unable to access G53?

    Currently, with RRF you can use probing to set the Z offset of the current tool, but not the Z coordinate of the current workplace coordinate offset - which is what I think you are looking to do. Am I right?

  • @educatingsavvas said in CNC Wasteboard Height/Offset Macro:

    That code looks like this:
    G54 ; select G54 WCS
    M291 X1,Y1,Z1 P"Jog spindle so tool touches corner of wasteboard." 1R "Warning" S3 ;
    G10 P2 L20 X0 Y0 ; set G55 X and Y to 0
    M500 ; save

    Hiya thanks for writing back. Sorry I've realised what I've done - there is an offset on the config-override.g - G10 L2 P1 X200.00 Y200.00 Z200.00. I'm not sure how I've done this but I assumed after homing G53 is automatically set to zero on all axes. So when I wrote G53 Z-1 in the pause file, I assumed because it didn't move (and I don't see in the gui, I couldn't use them). I'm going to assume this offset happened while I was using the z probe terminal on the board with a G30 command, to an unused endstop with M585.

    Is there a way of removing these offsets?

  • administrators

    G53 does not take any parameters. From the NIST GCode standard:

    You can make straight moves in the absolute machine coordinate system by using G53 with either G0 or G1. See Section 3.5.12


    G53 G1 X10 Y20 Z30 ; move to X=10 Y=20 Z=30 in machine coordinates

    G53 affects the remainder of the line of GCode that you use it in. It causes all axis coordinates in the following commands to be interpreted as machine coordinates. It also causes tool offsets not to be applied (I implemented this at the request of other CNC users).

  • @dc42 said in CNC Wasteboard Height/Offset Macro:

    G53 G1 X10 Y20 Z30

    Yes I understand - I think I'm not describing my problem correctly but I can use G53 but there's an offset I can't seem to get rid off.

    The machine coordinate x0 y0 and z0 are not where my homing switches are triggered.

    When the controller reset the head position read -200, -200, -200.

    This is my home z macro.

    ; homez.g
    ; called to home the Z axis

    M581 Z S-1 T2 C0 ; disable trigger for endstop Z
    G21 ; Set units to mm
    G91 ; relative positioning
    G0 H1 Z100 ; move quickly to Z axis endstop and stop there (first pass)
    G0 Z-10 ; go back a few mm
    G1 H1 Z40 F200 ; move slowly to Z axis endstop once more (second pass)
    G10 L20 P1 Z0 ; Set G54 to Z0
    G0 H0 Z-1 ; Stand off from proximity sensors.
    G90 ; absolute positioning
    g4 P1000 ; Dwell
    M581 Z S1 T2 C0 ; enable trigger for endstop Z

    After I perform this homing cycle my G54 WCS reads -1, if I write G53 G1 Z0 it moves to -200.

    If at that new position I then write G10 P1 L20 Z0 followed by M500, I check the config-overide.g file and the offset is removed, but when I reset the controller the same behaviour happens as above.

  • I changed the G10 to G92 in the homing macros, and had another look at my soft lim'ts in the config file, and I seemed to have got everything working. G53 and G54 are the same locations.

    BTW I've attached a link to a PDF for setting up a professional machines wasteboard offset as an example of what I wanted to achieve:

    Thanks again for your time.

Log in to reply