Hello, I recently built my own CNC router. it's small but works pretty well. i'm learning gcode but i can't figure out the following: after the job is done the cutter should return to starting point. This can be done with $28 and $92. But the Z-axis first has to go up above the workpiece (the safe zone) and then back to the starting point of X and Y. I can't really figure out the right g-code for this yet, hope someone can help me. Regards, Anne Lanting
What cad/cam software and post processor are you using? It should be possible to add some end code to every job to do what you want. eg;- G53 G0 Z-10 would switch to the machine co-ordinate system (for this line only) and do a rapid move to just below your Z homing switch. G0 X0 Y0 would then do a rapid move in whichever workplace co-ordinate system is current to the workplace zero position. Alex. EDIT - it's G28, G92 - not $.
You don't say what controller you are using but lets assume a Blackbox type runnig GRBL. GRBL understands G28 as a 'go to stored position'. Where is that position? By default it is the same place as home, in other words 0,0,0 offset from the machine home. GRBL has an idiosyncrasy in that if you send it to home, 0,0,0, it will hit the limit switch and spit out an error, having hit a hard limit. So going to the default G28 position is a bad idea. You do have the option of setting the G28 position, just jog to where you want it (Z hi !!) and issue G28.1 in the serial console. Now the offsets from home to the current possitiokn are stored as the G28 position. However, now and then you may do something that resets these offsets during something like a software upgrade, and off we go into hard limit territory again. I use G28 as a toolchange position, if it ever goes off to the wrong place it won't matter much since I do manual toolchanges. Much better is to use the machine coordinate system, the MCS. Everything is an offset from this, and this is set to a reliable 0,0,0 position by the homing process. GRBL supports 6 Work Coordinate Systems (grblHAL more), and we normally work in the G54 system. This is what you are setting when you click 'setZero' in the CONTROL interface. All motion commands use the current WCS for motion and the current WCS is never the Machine system, to access that you have to specify it everytime, ie G53 on every line that needs it. So, how to use it safely? move Z up to clear clamps 'n things then move X and Y to 0,0 on the workpiece (or near to home) Code: G17 G90 G49 G21 ; first set some modes so we get what we are expecting G53 G0 Z-10 ; move Z up to 10mm below the home position, it ca go closer if your switches are happy with it G0 X0 Y0 ; move to WCS 0,0, where you zeroed your work an alternative is Code: G17 G90 G49 G21 ; first set some modes so we get what we are expecting G53 G0 Z-10 ; move Z up to 10mm below the home position, it ca go closer if your switches are happy with it G53 G0 X-10 Y-10 ; move to MCS -10,-10, near machine home this one facilitates inspecting and removing the workpiece since work 0,0 might put the tool in your way. This one is also useful at the end of your work session, parking the tool near to home so that when you turn on again, the homing process does not have far to go and is much quicker. PS: never ever use G92, it offsets ALL coordinate systems which can have some surprising sideeffects and you will break tools. The GRBL gui Candle uses G92 for work offsets and I experienced the sideeffects firsthand (and stopped using Candle as a result). It also prevents you effectively using multiple WCS systems to cut the same thing in a different place. see also Home, Fusion360 and G53 Z moves