Zero all axis automatically

New Home Forum Mostly Printed CNC – MPCNC Troubleshooting – MPCNC Zero all axis automatically

This topic contains 5 replies, has 4 voices, and was last updated by Profile photo of Jason Jason 1 year, 1 month ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #12691
    Profile photo of David
    David
    Participant

    This may be common knowledge to most people here but thought I would share anyways. I’m not using end stops in my setup, and I some times forget to reset my Arduino when I line up my spindle before I begin my cut. I found just adding “G92 X0 Y0 Z0” to your beginning gcode will do the trick every time. Just thought I’d share….

    #12707
    Profile photo of Barry
    Barry
    Participant

    I use that as one of the scripts in repetier, then button 1 on the manual control tab will set 0 for me.

    #12712
    Profile photo of Ryan
    Ryan
    Keymaster

    Hah, that is a great idea. I wouldn’t use it when I 3D print but I will definitely add it to estlcam’s beginning gcode. I screw that up all the time and never thought about pre-zeroing it.

    #12725
    Profile photo of David
    David
    Participant

    I’m thinking about incorporating this command to all of the programs that allow to edit the beginning gcode. Think it would help with 3D printing and Laser etching as well, right?

    #12726
    Profile photo of Ryan
    Ryan
    Keymaster

    For me it wouldn’t be good for 3D printing. Once you set the 0,0,0 point and it finishes a job I just start another and it goes home by itself (the home I set). If you used this command you would have to set the home every time. I might be a little unusual as I rarely turn off the machine and it runs constantly.

    #12765
    Profile photo of Jason
    Jason
    Participant

    I added it to my LCD menu a week ago 🙂

    You just need to edit the ultralcd.cpp file of the sketch. I’m on Marlin RC6 so the menu code is slightly different but here’s what I modified:

    /**
     *
     * "Main" menu
     *
     */
    
    static void lcd_main_menu() {
      START_MENU();
      MENU_ITEM(back, MSG_WATCH);
      if (movesplanned() || IS_SD_PRINTING) {
        MENU_ITEM(submenu, MSG_TUNE, lcd_tune_menu);
      }
      else {
        MENU_ITEM(submenu, MSG_PREPARE, lcd_prepare_menu);
        #if ENABLED(DELTA_CALIBRATION_MENU)
          MENU_ITEM(submenu, MSG_DELTA_CALIBRATE, lcd_delta_calibrate_menu);
        #endif
      }
      MENU_ITEM(gcode, MSG_SETHOME, PSTR("G92 X0 Y0 Z0"));
      MENU_ITEM(gcode, "Needle Off", PSTR("M280 P0 S0"));
      MENU_ITEM(gcode, "Needle Low", PSTR("M280 P0 S90"));
      MENU_ITEM(gcode, "Needle Med", PSTR("M280 P0 S135"));
      MENU_ITEM(gcode, "Needle Full", PSTR("M280 P0 S180"));
    
      MENU_ITEM(submenu, MSG_CONTROL, lcd_control_menu);
    
      #if ENABLED(SDSUPPORT)
        if (card.cardOK) {
          if (card.isFileOpen()) {
            if (card.sdprinting)
              MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_sdcard_pause);
            else
              MENU_ITEM(function, MSG_RESUME_PRINT, lcd_sdcard_resume);
            MENU_ITEM(function, MSG_STOP_PRINT, lcd_sdcard_stop);
          }
          else {
            MENU_ITEM(submenu, MSG_CARD_MENU, lcd_sdcard_menu);
            #if !PIN_EXISTS(SD_DETECT)
              MENU_ITEM(gcode, MSG_CNG_SDCARD, PSTR("M21"));  // SD-card changed by user
            #endif
          }
        }
        else {
          MENU_ITEM(submenu, MSG_NO_CARD, lcd_sdcard_menu);
          #if !PIN_EXISTS(SD_DETECT)
            MENU_ITEM(gcode, MSG_INIT_SDCARD, PSTR("M21")); // Manually initialize the SD-card via user interface
          #endif
        }
      #endif //SDSUPPORT
    
      END_MENU();
    }

    The following lines are what I added:

     
    MENU_ITEM(gcode, MSG_SETHOME, PSTR("G92 X0 Y0 Z0"));
    MENU_ITEM(gcode, "Needle Off", PSTR("M280 P0 S0"));
    MENU_ITEM(gcode, "Needle Low", PSTR("M280 P0 S90"));
    MENU_ITEM(gcode, "Needle Med", PSTR("M280 P0 S135"));
    MENU_ITEM(gcode, "Needle Full", PSTR("M280 P0 S180"));
    

    The first line adds the new “set zero” command, the next 4 lines send servo commands to control the speed of the needle cutter I’m working on. This all shows up in my LCD on the main menu.

    Oh yeah…you also have to edit language_en.h and add this at the end:
    #define MSG_SETHOME "Set XYZ to 000"

    I’ve actually since updated my code to use configurable strings for all of those commands…
    I also ended up moving this all into a sub-menu and am working on adding other commands like “Raise Z by 15” and “Lower Z to 0” that are helpful. You can see my work in progress on my github, here’s the changes I’ve made to the menu’s so far: https://github.com/jhitesma/Marlin-Folger/commit/6988f456ec8eaf8ae629d0c41d873119e491e353

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

You must be logged in to reply to this topic.