Welcome to Our Community

Some features disabled for guests. Register Today.

GCode sends my Z axis beyond my limit switch - Fusion 360

Discussion in 'CNC Mills/Routers' started by Lee Morse, Feb 6, 2024.

  1. Lee Morse

    Lee Morse New
    Builder

    Joined:
    Dec 7, 2023
    Messages:
    19
    Likes Received:
    1
    Hi All,
    My first build, so am pretty inexperienced. I have just tried sending my first GCode to my machine, but within a few commands the job halts. At first I thought it might be interference from the sindle, so I removed all spindle commands (M3 etc) to try to narrow it down. It still stops at the same place. It appears that the generated GCode is sending my Z axis beyond the limit switch. I get an ALARM 1.

    I have a 1m x 1m Ultimatebee with HY VFD and an xPro V5. I am using Fusion360 to model etc and am using CNCjs.

    I have set-up a machine in Fusion360 where: Capabilities are set to milling only, Kiematics X, Y and Z home position is set to -2.5mm (that is the coordinate that CNCjs tells me once the machine has homed to the limit switches - X far right, Y back of machine, Z top of travel). Raid feed rate = 2800mm/min, max feedrate = 3200mm/min. Range is set to limited, I put minimum to -2.5 (which for some reason is copied into Maximum - doesn't feel right, but if I change this then the min. is updated to this new number, so I left both at -2.5mm). Post processing is Grbl / grbl 2.

    In Fusion360 in MANUFACTURE my setup is as follows: I select my machine (as described above). I set the WCS origin to be on the model body at the back left (close to my machine Home position - which works out to be X -20mm Y -20mm Z -100mm. In my hole milling process (I am just tring to mill a series of screw holes) I have Clearance Height to 10mm above Retract Height, Retract Height is 5mm above Stock Top, Top Height is set to Hole Top, and Bottom Height set to Bottom of Hole.

    Settings in my xPro V5:

    $0=10
    $1 = 255
    $2=0
    $3=2
    $4=0
    $5=0
    $6=1
    $10=1
    $11=0.01
    $12=0.002
    $13=0
    $20=0
    $21=1
    $23=0
    $24=200.00
    $25=1400.00
    $26=250.00
    $27=2.5
    $30=24000
    $31=5000
    $32=0
    $100=320
    $101=3200
    $102=800
    $103=200
    $104=100
    $105=100
    $110=3200
    $111=3200
    $112=3200
    $113=1000
    $114=1000
    $115=1000
    $130=770
    $131=785
    $132=$150

    Here is the start of the GCode:
    (1001)
    (Machine)
    ( vendor: SPAM)
    ( model: Ultimatebee 1000x1000)
    ( description: Generic 3-axis)
    (T3 D=6 CR=0 - ZMIN=-8 - flat end mill)
    G90 G94
    G17
    G21
    (When using Fusion for Personal Use, the feedrate of rapid)
    (moves is reduced to match the feedrate of cutting moves,)
    (which can increase machining time. Unrestricted rapid moves)
    (are available with a Fusion Subscription.)
    G28 G91 Z0
    G90


    G17 G90 G94
    G54
    G0 X-0.25 Y-0.6
    Z15
    G1 Z10 F1000
    Z0.6
    G18 G2 X0.35 Z0 I0.6 K0
    G1 X0.65
    G17 G3 X1.25 Y0 I0 J0.6
    X-1.25 Y0 Z-0.5 I-1.25 J0
    X1.25 Y0 Z-1 I1.25 J0
    X-1.25 Y0 Z-1.5 I-1.25 J0
    X1.25 Y0 Z-2 I1.25 J0
    X-1.25 Y0 Z-2.5 I-1.25 J0
    X1.25 Y0 Z-3 I1.25 J0
    X-1.25 Y0 Z-3.5 I-1.25 J0
    X1.25 Y0 Z-4 I1.25 J0
    X-1.25 Y0 Z-4.5 I-1.25 J0
    X1.25 Y0 Z-5 I1.25 J0
    X-1.25 Y0 Z-5.5 I-1.25 J0
    X1.25 Y0 Z-6 I1.25 J0
    X-1.25 Y0 Z-6.5 I-1.25 J0
    X1.25 Y0 Z-7 I1.25 J0
    X-1.25 Y0 Z-7.5 I-1.25 J0
    X1.25 Y0 Z-8 I1.25 J0
    X-1.25 Y0 I-1.25 J0
    X1.25 Y0 I1.25 J0
    X0.65 Y0.6 I-0.6 J0
    G1 X0.35
    G18 G3 X-0.25 Z-7.4 I0 K0.6
    G1 Z10
    X-184.375 Y-0.6
    Z0.6
    G2 X-183.775 Z0 I0.6 K0
    G1 X-183.475
    G17 G3 X-182.875 Y0 I0 J0.6
    X-185.375 Y0 Z-0.5 I-1.25 J0
    X-182.875 Y0 Z-1 I1.25 J0
    X-185.375 Y0 Z-1.5 I-1.25 J0
    X-182.875 Y0 Z-2 I1.25 J0
    X-185.375 Y0 Z-2.5 I-1.25 J0
    X-182.875 Y0 Z-3 I1.25 J0
    X-185.375 Y0 Z-3.5 I-1.25 J0
    X-182.875 Y0 Z-4 I1.25 J0
    X-185.375 Y0 Z-4.5 I-1.25 J0
    X-182.875 Y0 Z-5 I1.25 J0
    X-185.375 Y0 Z-5.5 I-1.25 J0
    X-182.875 Y0 Z-6 I1.25 J0
    X-185.375 Y0 Z-6.5 I-1.25 J0
    X-182.875 Y0 Z-7 I1.25 J0
    X-185.375 Y0 Z-7.5 I-1.25 J0
    X-182.875 Y0 Z-8 I1.25 J0
    X-185.375 Y0 I-1.25 J0
    X-182.875 Y0 I1.25 J0
    X-183.475 Y0.6 I-0.6 J0
    G1 X-183.775
    G18 G3 X-184.375 Z-7.4 I0 K0.6
    G1 Z10
    X-368.5 Y-0.6
    Z0.6
    G2 X-367.9 Z0 I0.6 K0
    G1 X-367.6
    G17 G3 X-367 Y0 I0 J0.6
    X-369.5 Y0 Z-0.5 I-1.25 J0
    X-367 Y0 Z-1 I1.25 J0
    X-369.5 Y0 Z-1.5 I-1.25 J0
    X-367 Y0 Z-2 I1.25 J0
    X-369.5 Y0 Z-2.5 I-1.25 J0
    X-367 Y0 Z-3 I1.25 J0
    X-369.5 Y0 Z-3.5 I-1.25 J0
    X-367 Y0 Z-4 I1.25 J0
    X-369.5 Y0 Z-4.5 I-1.25 J0
    X-367 Y0 Z-5 I1.25 J0
    X-369.5 Y0 Z-5.5 I-1.25 J0
    X-367 Y0 Z-6 I1.25 J0
    X-369.5 Y0 Z-6.5 I-1.25 J0
    X-367 Y0 Z-7 I1.25 J0
    X-369.5 Y0 Z-7.5 I-1.25 J0
    X-367 Y0 Z-8 I1.25 J0
    X-369.5 Y0 I-1.25 J0
    X-367 Y0 I1.25 J0
    X-367.6 Y0.6 I-0.6 J0
    G1 X-367.9
    G18 G3 X-368.5 Z-7.4 I0 K0.6
    G1 Z10

    The job stops at line #25: G1 X0.65. It is stopping because the machine has gone into ALARM 1 and the Z axis has activated the limit switch. I am assuming that the machine itself has not actually reached line 25 because that is not a Z axis command, and is maybe stopping earlier at line 14: G28 G91 Z0, or at line 21: Z15???

    I have lots of questions:

    Commands such as Z0 in the above GCode, are they in relation to the Machine homing position, or to the job zero position that I have set? My understanding is that G90 means all coordinate values are relative offset to the Work Job zero?

    I am assuing that the G28 G91 Z0 command is telling the machine to home in the Z axis, could this be where it is hitting the limit switch?

    Is the CGode that is created by Fusion 360 understaning my machine limits and axis orientations correctly? I would assume so because I have values such as X=-369.5. However there seem to be lots of Y=0 values? Is it trying to send my machine beyod the limit switches? Why are some of the X,Y,Z values in the positive, when I would expect all of my values to be in the negative? Machine Home = -2.5 XYZ, machine X Left, Y furthest front, Z lowest position would be X=-770, Y=-785,Z=-150?

    Do I have a fundamental misunderstanding the the WCS here?

    What do I do to stop my machine hitting the limit switches and alarming?

    Thanks in advance for your help. Its been quite a learning curve so far!
     
  2. David the swarfer

    David the swarfer OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Aug 6, 2013
    Messages:
    3,435
    Likes Received:
    1,908
    There is the problem. That post is written by people who have never actually run a GRBL based machine, so is theoretically correct but in practise has some problems.
    Rather use the openbuilds postprocessor, written by people who do use GRBL (me and some others), for people who use GRBL.
    docs:software:fusion360 [OpenBuilds Documentation]

    only 1 requirement really,
    ALWAYS HOME the machine at switch on and after any crash or abort/error/ etc
    This is because the post uses G53 machine coordinate moves and so relies on a proper sense of home. (so does the autdoesk post, but with extra steps)

    The post defaults to a Z safetymove offset of -10mm. That is 10mm below the Z home position. Leave it at that unless you have a real reason for making is less, say -3mm to clear your switch.

    more explanation than you wanted:
    GRBL cannot go to Z=0 without hitting a limit switch and causing an alarm.
    In the autodesk post, the G28 move goes to Z=0.
    since the G28 position is relative to home anyway, we would rather use real machine coordinate moves that only rely on homing and not on any further setup from the user.

    Our post also solves other issues like mismatched radii on small arcs (they come that way from fusion), limited rapid speed for personal license users, laser/plasma 'stay down' rapid moves being slow, and other things I have forgotten.
     
  3. Lee Morse

    Lee Morse New
    Builder

    Joined:
    Dec 7, 2023
    Messages:
    19
    Likes Received:
    1
    Hi David, thank you. I will download the OpenBuids post-processor and see what happens! I will let you know.
     
  4. Lee Morse

    Lee Morse New
    Builder

    Joined:
    Dec 7, 2023
    Messages:
    19
    Likes Received:
    1
    Hi David,

    I just wanted to thank you. This has worked a charm. I just ran the job (without a cutting tool installed 'just in case'), and everyting looked perfect.

    I owe you a beer. Thank you :)
     
    David the swarfer likes this.
  5. Misterg

    Misterg Veteran
    Staff Member Moderator Builder Resident Builder

    Joined:
    Aug 27, 2022
    Messages:
    350
    Likes Received:
    273
    Further to David's reply:

    The command G28 sends the machine to a predefined position in *machine* coordinates. It is intended that this is a "safe" position, but needs to be set by *you* as a once-only exercise. If you haven't set it, it will probably be 0,0,0.

    It is in the GCode because you selected the 'G28' option under 'safe retracts' in the Autodesk post. (The better option is 'Clearance Height' if you're using that post processor.)

    In general, any absolute coordinates in GCode are relative to the work zero (but there are some exceptions).

    Glad everything is working now.
     
    David the swarfer likes this.
  6. Lee Morse

    Lee Morse New
    Builder

    Joined:
    Dec 7, 2023
    Messages:
    19
    Likes Received:
    1
    Hi misterg,

    Thank you for this. When you say I need to set a safe position as a once only exercise where exactly do I set this? In Fusion360? In CNCjs?

    When I applied the OpenBuilds post processing (through Fusion) I saw the option box to specify the -10, -10, -10 safetymove position. Is this what you are referring to?
     
  7. Misterg

    Misterg Veteran
    Staff Member Moderator Builder Resident Builder

    Joined:
    Aug 27, 2022
    Messages:
    350
    Likes Received:
    273
    Hi, it doesn't apply to the OpenBuilds Post, and it can be avoided in the Autodesk Post. It was just a bit of background info - sorry if it has confused things.

    [Bit more background: Setting the position of G28 is done through Gcode: Jog the machine to where you want the safe position to be (bearing in mind all possible tools and workpieces!) and, from the serial window, send the command "G28.1" Hence forth, every time a G28 command is issued the machine will rapid move to that point.]

    ETA: Just to reiterate that you don't need to do this for the OB Post processor.

    GCode reference that may be of interest:

    G-Codes
     
    Alex Chambers likes this.
  8. Lee Morse

    Lee Morse New
    Builder

    Joined:
    Dec 7, 2023
    Messages:
    19
    Likes Received:
    1
    Great thank you
     
    #8 Lee Morse, Feb 7, 2024
    Last edited by a moderator: Feb 7, 2024
  9. Lee Morse

    Lee Morse New
    Builder

    Joined:
    Dec 7, 2023
    Messages:
    19
    Likes Received:
    1
    Hi All,

    I have just hit a new out-out-of-bounds issue. I am trying to face my spoilboard. I am using the OpenBuilds post processor as suggested above. My spoilboard dimensions are 770x785. I am using a 25mm flattening bit. My machine home = -2.5, -2.5, -25mm. Job zero = -22.4, -28, -114. All other settings on the xPro V5 are the same as above. Here is a snippet of the generated code:

    G90 G94 G17
    G21

    (Operation 1 of 1 : Face5)
    G54
    (This relies on homing, see Search Results for Query: G53 fusion | OpenBuilds )
    G53 G0 Z-10
    G0 X-753.713 Y32.658


    My issue is that the code is alarming on G0 X-753.713 Y32.658 but I cannot see why the code is being generated like this? I have homed the machine. It appears to be inside my bounds, if I change to X-733 and Y-32 it runs ok. (I am stepping through the job line by line to make sure I catch the correct line).

    Does anyone have any pointers for me? What am I doing wrong in Fusion 360 to output X and Y beyond machine limits? Why is -753 out of bounds? WHy is it generating a +Y value?

    In Fusion 360 my Machine Library definition states Max X range = -770, Min X range = -770 (fr some reason they always mirror each other?), Max Y range = -785, Min Y range = -785.
     
    #9 Lee Morse, Feb 15, 2024
    Last edited: Feb 15, 2024
  10. David the swarfer

    David the swarfer OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Aug 6, 2013
    Messages:
    3,435
    Likes Received:
    1,908
    what have you drawn in fusion?
    a sketch rectangle the size of your spoilboard? that is probably bigger than your actual limits, so if you just add a face operation to that then it will exceed limits.
    rather draw a rectangle that is the size of the limits, then face inside that rectangle.

    another factor is where you put the origin in the setup, and what you set the wrok zeros to on the machine.
     
  11. Lee Morse

    Lee Morse New
    Builder

    Joined:
    Dec 7, 2023
    Messages:
    19
    Likes Received:
    1
    I have drawn a rectangle that is the same as my limits - 770x785.

    The origin is at the work zero. I thought all code was relative to machine zero?
     
  12. Lee Morse

    Lee Morse New
    Builder

    Joined:
    Dec 7, 2023
    Messages:
    19
    Likes Received:
    1
    Machine limits are 770x785.

    I am operating under the assumption that if I specify my machine limits then the code will not exceed that without giving me a warning as it Post Processes, or in fusion when it generates the tool path?
     
  13. David the swarfer

    David the swarfer OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Aug 6, 2013
    Messages:
    3,435
    Likes Received:
    1,908
    no, Gcode is relative to the WCS origin that you set in the 'setup' in Fusion.

    WCS = Workpiece Coordinate System

    The WCS is relative to the MCS = Machine Coordinate System
    the MCS is set by the homing process.

    So, from machine switch on:
    1. home
    2. jog to where the WCS XY must be and use the setZero buttons, or probe it.
    3. jog/probe Z zero (end of bit at surface of work, usually)
    4. run gcode
    Note that going to WCS 0 will trigger a limit alarm, so you cannot have the WCS at machine 0,0,0

     
  14. Alex Chambers

    Alex Chambers Master
    Moderator Builder

    Joined:
    Nov 1, 2018
    Messages:
    2,772
    Likes Received:
    1,358
    What toolpath are you using - the facing toolpath in Fusion always starts outside the stock box dimensions. Use a pocket toolpath.

    Alex.
     
    David the swarfer and Lee Morse like this.
  15. Lee Morse

    Lee Morse New
    Builder

    Joined:
    Dec 7, 2023
    Messages:
    19
    Likes Received:
    1
    Ah! That explains it!! Thank you. All along I was assuming code was relative to Machine Home
     
  16. Lee Morse

    Lee Morse New
    Builder

    Joined:
    Dec 7, 2023
    Messages:
    19
    Likes Received:
    1
    Good advice. Thank you
     

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