Tool Change G Code and Z Touch Plate

New Home Forum Mostly Printed CNC – MPCNC Advice – MPCNC Tool Change G Code and Z Touch Plate

This topic contains 6 replies, has 5 voices, and was last updated by  Robert Kyle 3 weeks, 4 days ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #44416

    Andy
    Participant

    -I thought i would hop on here and share my experiences with tool changes and the g code necessary to get the job done. When i first started with the machine i did not use a Z touch plate. Like most people i just moved the Z axis until it touched the top of the surface. This worked fine until i was engraving on ABS Sheet with a V bit. I literally could not tell where the top of the surface was because the bit was so sharp and the material was so soft. I had inconsistent depth so the look of the engraving varied quite a bit from piece to piece. So i researched using a touch plate. I had a pretty hard time getting a clarified reference on how to hook it up. I did eventually find the info needed and got it working. I have attached a picture of the connections that have to be made for the touch plate. After i started using it i really don’t understand why everyone doesn’t use it. You hook one wire to the mill bit and one wire to a plate, in my case a feeler gauge. Home the z axis and viola consistent depth every time. Super easy.

    -Using the touch plate allowed me to explore typical tool change procedures. I originally ran the machine without an LCD. This presents a problem with tool changes because of the M0 code used to pause the program. This can normally only be resumed by clicking the knob on an LCD. There is no code available to restart after a plain M0 code. Although after more research i did find that a timer can be set to the M0 code. For example M0 S20 will pause the program for 20 seconds and return back to where it left off. I was able to write some simple g code that used this feature to do these tool changes successfully without an LCD. Here is the g code used without an LCD and comments to explain what each code does. I have attached the plain g code for anyone to use. Ill explain how to apply it in a bit.

    M0 S10 (Pause for 10 Seconds. This is to signal you to turn the spindle off)
    G0 X0.0000 Y0.0000 F2100 (Go to Zero on the X and Y Axis at a feed rate of 2100)
    M18 Z (Disable Z Stepper Motor. This is disabled so you can manually move the Z axis up to get the new bit in)
    M0 S120 (Pause For 120 seconds. This is when the tool change happens. This time can be shortened or lengthened. In my opinion it is much better to leave it extra long or the code will start to home the z before you have your touch plate ready.)
    G28 Z (Home Z Axis to touch plate)
    G1 Z2 F150 (Raise Z axis 2mm at a feed rate of 150 in order to remove your touch plate)
    M0 S20 (Pause for 20 seconds. This is to signal you to turn the spindle on)
    G1 Z-0.4 F150 (This sets the negative offset of the thickness of your touch plate. In my case, i use a .4mm feeler gauge. This would be changed to the thickness of your touch plate. Make sure and leave it negative.)
    G92 Z0 (This now sets the Z axis to zero at the offset above, meaning the top of your work piece)
    G0 Z5.0000 F480 (This pulls the z axis back up off the work piece at a feed rate of 480)
    G0 X0.0000 Y0.0000 Z0.0000 F2100 (Go to zero on all axis. Probably not necessary but i like to do it)
    G0 Z5.0000 F480 ( Pull the Z axis back up off the work piece at a feed rate of 480)

    (The code will now continue where it left off)

     

    -After a while i got an LCD. Again i highly recommend the LCD and don’t see any reason everyone shouldn’t use one. While using just the computer, i had issues with my usb connections going out on me and killing a job. After getting the LCD i have had zero problems. Since i could now resume a job after a plain M0 code i re-wrote the g code to suit. Here is the g code with comments that i now use with the LCD.

    M0 (Pause code until resume is clicked on the LCD. This reminds you to turn off the spindle)
    G0 X0.0000 Y0.0000 F2100 (Move to zero on X and Y)
    M18 Z (Disable Z Stepper Motor. This is disabled so you can manually move the Z axis up to get the new bit in)
    M0 (Pause code until resume is clicked on the LCD. This is for you to get your touch plate set up)
    G28 Z (Home Z axis to touch plate)
    G1 Z2 F150 (Raise Z axis 2mm at a feedrate of 150 in order to remove your touch plate)
    M0 (Pause code until resume is clicked on the LCD.This is to un hook the touch plate and turn the spindle on)
    G1 Z-0.4 F150 (This sets the negative offset of the thickness of your touch plate. In my case, i use a .4mm feeler guage. This would be changed to the thickness of your touch plate. Make sure and leave it negative.)
    G92 Z0 (This now sets the Z axis to zero at the offset above, meaning the top of your workpiece)
    G0 Z5.0000 F480 (This pulls the z axis back up off the workpiece at a feedrate of 480)
    G0 X0.0000 Y0.0000 Z0.0000 F2100 (Go to zero on all axis. Probably not necessary but i like to do it)
    G0 Z5.0000 F480 ( Pull the Z axis back up off the workpiece at a feedrate of 480)

    (The code will now continue where it left off)

     

    -Now how to apply it. If you want it to run for every tool change, of every job you create in Estlcam, go to to setup-cnc programs-text-tool change. Delete all the info in the box and paste either the “with LCD code” or the “without LCD code” and save the settings. If you want to use it only for some tool changes on some jobs, you have to edit the g code generated by Estlcam manually. I have uploaded a really poor quality video to demonstrate the without LCD code. (Not sure why the video looks wavy all the time. That only happened after upload.)  I have also added my start program g code. You apply it by going setup-cnc programs-texts-program start in Estlcam. Hope this helps someone out, i really enjoy being able to use the tool change function without having to configure new g code for every tool change.

     

    Thanks,

    Andy

     

    • This topic was modified 4 weeks, 1 day ago by  Andy.
    • This topic was modified 4 weeks, 1 day ago by  Andy.
    2 users thanked author for this post.
    #44423

    Ryan
    Keymaster

    So clear and informative I am going to be linking this one a lot. Thank you so much for taking the time to type this one out!

    So now you should give the new dual endstop firmware a test run and give us some feedback. This will (should) allow you to just run each piece independently no need for pauses and resumes. Different days, after a complete power cycle, home and go. If you always use the same touch plate you can set a Z offset in the firmware as well so a regular g28 will work.

    If you get a chance to try it out let me know what you think and which way is easier.

    • This reply was modified 4 weeks, 1 day ago by  Ryan.
    • This reply was modified 3 weeks, 3 days ago by  Ryan.
    #44428

    Andy
    Participant

    Ryan, thats one of the next things on my list. I can definitely see the advantages of it.

    • This reply was modified 4 weeks, 1 day ago by  Andy.
    #44439

    thesfreader
    Participant

    Andy, thanks for the great wrap-up.

    Just reminded me of something I has seen in the Marlin gcode M0 / M1 commands : you can add an additional message to show on the display, which you could add to “clarify” the reason for the pause

     

    (Also M117 can change the LCD display message)

    #44450

    Jeffeb3
    Participant

    You can also split the gcode up into different files for different tools. As long as the motors stay engaged between files.

    #44451

    Jeffeb3
    Participant

    Is that the right video? It wasn’t a tool change.

    Edit: my mistake. The link starts the video almost at the end.

    • This reply was modified 4 weeks, 1 day ago by  Jeffeb3.
    #44738

    Robert Kyle
    Participant

    Excellent description and guide to tool changes, many thanks Andy.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.