Welcome to Our Community

Some features disabled for guests. Register Today.

Openbuilds Control - Macro - Homing + G28

Discussion in 'CNC Mills/Routers' started by Eimantas, Mar 16, 2024.

  1. Eimantas

    Eimantas New
    Builder

    Joined:
    Feb 17, 2024
    Messages:
    3
    Likes Received:
    0
    Hello all,

    I am new to this whole CNC thing and would like to clarify some things:

    I have setup homing on my workbee with hard limit switches, this works fine
    I have made (with alot of frustration, only to figure out later that control has spoilboard surfacing wizard) a spoilboard with some fences to keep my workpiece parallel in XY.

    now that i have a set starting point between 2 fences, usually i will only need to set zero on Z axis.
    my next thought is that after homing i could move XY to the set location using G28, something like G28 G91 X162.1 Y-658.31 Z0.0)

    Can i write a macro for this or is there alternative (better) methods to do this?

    Can i implement Z probe action into the macro? is this smart to do?

    the sequence of actions im looking for is : Home -> G28 to my work starting location -> probe Z

    Thanks for any tips!
     
  2. Alex Chambers

    Alex Chambers Master
    Moderator Builder

    Joined:
    Nov 1, 2018
    Messages:
    2,769
    Likes Received:
    1,357
    I avoid using G28 - there is an easier way once you have set a workplace coordinate system (wcs) zero.
    G90
    G53 G0 Z-10
    G0 X0 Y0

    Absolute coordinates
    Raise Z (in machine coordinates system) to just below limit switch
    Move to X zero Y zero in the current wcs.

    Alex.
     
    Peter Van Der Walt likes this.
  3. Eimantas

    Eimantas New
    Builder

    Joined:
    Feb 17, 2024
    Messages:
    3
    Likes Received:
    0
    Thanks for the input Alex!

    I am having some trouble trying to set this up.

    After performing $H my work coordinates seem to behave not exactly as i would expect. i.e


    Sometimes it would set the WCS to -5 , other times it does not (in this example it set YZ to -5 and did not do it on X?)

    when i get this doing a G0 X0 Y0 would just hit the limit switches on both axis (or in this example limit switch on Y and gantry on X) rather than go to the location i want.

    what am i missing here? is the $H supposed to set both machine and work to XYZ-5? if it is resetting the work XYZ to -5 where should i store my actually desired work 0?

    thanks for any support

    br,
    Eimantas
     

    Attached Files:

    #3 Eimantas, Mar 17, 2024
    Last edited: Mar 17, 2024
  4. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    14,868
    Likes Received:
    4,283
    Home (G53 Zeroes) at "at the point the switch triggers". Moving to 0 will retrigger switch... Moving to say G53 G0 Z-5 will stop 5mm short of the switch, ie perfect
     
  5. Alex Chambers

    Alex Chambers Master
    Moderator Builder

    Joined:
    Nov 1, 2018
    Messages:
    2,769
    Likes Received:
    1,357
    $H does not set the WCS, only the MACHINE co-ordinate system (MCS) - see @Peter Van Der Walt 's comment about moves in the MCS.

    G53 switches to the MCS, and is NON-MODAL - it only applies to the line of code it is on.
    A G0 move (without G53 in front of it) will move in the current WCS. So, if you have set a workplace zero in that WCS G0 X0 Y0 will go to that position.

    Are you clicking on any of the set XYZ buttons immeditely after homing? - don't do that - they are for setting the zero point in your WCS, which you do on your workpiece, in exactly the same place as you set the ORIGIN in your cam software.

    Alex.
     
  6. EvanH

    EvanH Well-Known
    Builder

    Joined:
    Nov 3, 2022
    Messages:
    75
    Likes Received:
    43
    The G10 command will set the work coordinate offsets that should remain fixed between machine reboots, and G54 is the normal work coordinate offset mode that GRBL drops back into when an M2 or M30 end-of-programme code is found. Running $# in GRBL will list all the current offsets.

    If you know exactly where the reference point at the corner of the fences is in machine coordinates, and that would never change (e.g. X-456 Y-123), then you could have a macro do:

    G54 G90 G10 L2 X-456 Y-123

    and now running G0 X0 Y0 would take you to the reference point.

    I have a number of reference brackets I use regularly on my machine, but I do have to take them on and off the wasteboard sometimes, and they do not always go back exactly, and the 'reference location' values need to be tweaked. Instead of editing the macro each time I re-check the reference location, I have set the 'zero' positions up in the other reference frames (i.e. G55, G56 and G57 in my case) to the different locations. To use one of the offsets, I have macros setup such as:
    G55 G90
    G53 Z0
    G0 X0 Y0
    G54
    G10 L20 X0 Y0

    That macro switches to the G55 set, moves the spindle all the way up in machine coordinates to preven a crash, and then moves the machine to the reference location. The last command then zeros the G54 set to match the reference position that the machine is now at. That way when I tweak the reference location after reinstalling the fences, I just adjust what is stored in the G55 set and do not have to edit the macro.

    When you click the 'set zero' buttons, most Gcode senders do a G10 L20 command, but some Gcode senders do it with a G92 instead, which is a right pain if you have to reset the machine for any reason as the offset is not permanent ('Candle' is an example of one using G92).

    As for machine zero after homing, check that your $27 setting for the machine homing pulloff is large enough for the homing switches to be cleared. That is, when the machine homes and triggers a switch, it pulls away by the distance set in $27, and only then sets the machine coordinates to zero (i.e machine zero is now $27 away from where the switch first triggered). If $27 is set too small, when you do a G53 X0 Y0 Z0, the machine would run back to a position that triggers a switch and gives an endstop error.

    Actually, a clarification, there are many flavours now of GRBL, and some may record machine zero as the switch-click location, and others record zero after the machine pull-off distance. It depends which one you are using as to what happens. The one I use takes the pull-off into account and therefore 'zero' is a few millimetres clear of the switches and I can do G53 G0 X0 Y0 Z0 safely. The variations in GRBL implementation on the homing pull-off issue even extend to some GRBL codes allow the pull-off of each switch to be defined independently, allowing say a mix of microswitches and inductive sensors to be used that need different pull-offs, through to allowing auto-squaring of dual-drive Y axes to be adjusted in software etc.

    Evan
     
  7. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    14,868
    Likes Received:
    4,283
    We are of course assuming people knocking here for support are running our controllers, our firmware and our software, so our replies will ALWAYS be tailored as such. Ours sets it at trigger point.
    This is the OpenBuilds forum after all :)

    Lets avoid "clarifications" and keep in mind our duty is to support our amazing customers here. Short and to the point and directed at their specific issues, with the knowledge of our products in mind. Thanks
     
  8. Eimantas

    Eimantas New
    Builder

    Joined:
    Feb 17, 2024
    Messages:
    3
    Likes Received:
    0
    I have done extensive testing and the issue is related to start-up.

    The sequence of actions to replicate the issue:

    1.Shutting down machine at WCS 0
    2.Turn off blackbox x32
    3.Turn off Control software
    4.Power up blackbox x32
    5.Reset Blackbox x32 (almost always requires 2-3 resets due to not being detected in CONTROL over wifi)
    6.Turn on Control Software
    7.Connect to Blackbox X32
    Now the coordinates in WCS are no longer 0, but rather offset coordinates displayed
    8.Set XYZ Zero
    9.$H
    end up with WCS X-800 something Y-5 Z-5 just like in the picture in previous post

    Re-doing this second time (manually jogging back to my WCS 0, setzero XYZ and $H), now correctly displays the offset coordinates and i can now perform G0 X0 Y0

    should i be rather doing a g-coded fixed coordinates as per EvanH advice (G54 G90 G10 L2 X-456 Y-123) to be able to do this correctly on start-up?

    thanks!
     
  9. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    14,868
    Likes Received:
    4,283
    Wrong way round. Home first, then set Zero. Machine coordinates are the base coordinates, all the other coordinate systems are "offsets" from machine coordinates

    You setzero while the machine still had NO IDEA where it is. Before homing, but after reset/connection its defaulted MCS-zero to where it was when it came up. Home first. Then setzero.
     
  10. Alex Chambers

    Alex Chambers Master
    Moderator Builder

    Joined:
    Nov 1, 2018
    Messages:
    2,769
    Likes Received:
    1,357
    Exactly as @Peter Van Der Walt said - homing sets the back, right, up corner of the machine's workspace as a reference point (in the MACHINE co-ordinate system) for everything else, and the blackbox X32 will remember how far away from that point on each axis you set the zero position in the WORKPLACE co-ordinate system.

    Alex.
     
    David the swarfer likes this.
  11. David the swarfer

    David the swarfer OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Aug 6, 2013
    Messages:
    3,430
    Likes Received:
    1,907

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice