Z endstop position

Tagged: 

This topic contains 17 replies, has 3 voices, and was last updated by  cocktailyogi 5 years, 4 months ago.

  • Author
    Posts
  • #1709

    sam_s
    Participant

    Hello,

    I was wondering why homing the z-axis relies on a maximum endstop? I typically use a minimum, which is very helpful for false starts (by saving a lot of waiting time).

    Just curious.

    Sam

  • #1713

    Quentin Harley
    Keymaster

    I use a max endstop because of the type of homing. It also allows you to do a complete home after printing to lower the bed to its lowest position. if the bed slips then, it does not have enough momentum to knock any of the endstops down…

    You are welcome to change it to a min endstop if you want to. Just change the homing routine in the firmware, and let us know how it works for you.

  • #4217

    cocktailyogi
    Participant

    Hi Quentin,

    I am from Germany and have been living in ZA for a couple of months. I love southern Africa. Actually I am also building a Morgan with some tiny changes to your setup. I am trying to change the Z-Endstop to Z_min_position and tried to to the nessecary firmware changed. Unfortunately my Z-endstop is ignored during homing “G28 Z0”. The arms are homing fine.
    – I am using optical endstops with RAMPS 1.4
    – M119 is working and gives me the expected states
    – I can trigger Zmin-Endstop and it will be recognised–> no electrical problem

    I have done my settings in configuration.h. Are there any other changes to do? I could not find any other SCARA-related comments in your github-Repo.

    Here my config:

    //===========================================================================
    //=============================Mechanical Settings===========================
    //===========================================================================
    
    // Uncomment the following line to enable CoreXY kinematics
    // #define COREXY
    
    // corse Endstop Settings
    //#define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors
    
    #ifndef ENDSTOPPULLUPS
      //#define Enstop settings: Individual Pullups. will be ignord if ENDSTOPPULLUPS is defined
      //#define ENDSTOPPULLUP_XMAX
      //#define ENDSTOPPULLUP_YMAX
      #define ENDSTOPPULLUP_ZMAX
      #define ENDSTOPPULLUP_XMIN
      #define ENDSTOPPULLUP_YMIN
      //#define ENDSTOPPULLUP_ZMIN
    #endif
    
    #ifdef ENDSTOPPULLUPS
      #define ENDSTOPPULLUP_XMAX
      #define ENDSTOPPULLUP_YMAX
      #define ENDSTOPPULLUP_ZMAX
      #define ENDSTOPPULLUP_XMIN
      #define ENDSTOPPULLUP_YMIN
      #define ENDSTOPPULLUP_ZMIN
    #endif
    
    // The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins.
    const bool X_ENDSTOPS_INVERTING = true; // set to true to invert the logic of the endstops. 
    const bool Y_ENDSTOPS_INVERTING = true; // set to true to invert the logic of the endstops. 
    const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of the endstops. 
    //#define DISABLE_MAX_ENDSTOPS
    
    // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
    #define X_ENABLE_ON 0
    #define Y_ENABLE_ON 0
    #define Z_ENABLE_ON 0
    #define E_ENABLE_ON 0 // For all extruders
    
    // Disables axis when it's not being used.
    #define DISABLE_X false
    #define DISABLE_Y false
    #define DISABLE_Z false
    #define DISABLE_E false // For all extruders
    
    #define INVERT_X_DIR false    // for Mendel set to false, for Orca set to true
    #define INVERT_Y_DIR false    // for Mendel set to true, for Orca set to false
    #define INVERT_Z_DIR false    // for Mendel set to false, for Orca, Morgan set to true
    #define INVERT_E0_DIR true   // for direct drive extruder v9 set to true, for geared extruder set to false
    #define INVERT_E1_DIR false   // for direct drive extruder v9 set to true, for geared extruder set to false
    #define INVERT_E2_DIR false   // for direct drive extruder v9 set to true, for geared extruder set to false
    
    // ENDSTOP SETTINGS:
    // Sets direction of endstops when homing; 1=MAX, -1=MIN
    #define X_HOME_DIR 1
    #define Y_HOME_DIR 1    
    #define Z_HOME_DIR -1    // Bed home to top (0)
    
    #define min_software_endstops false //If true, axis won't move to coordinates less than HOME_POS.
    #define max_software_endstops false  //If true, axis won't move to coordinates greater than the defined lengths below.
    // Travel limits after homing
    #define X_MAX_POS 210
    #define X_MIN_POS -10
    #define Y_MAX_POS 210
    #define Y_MIN_POS -10
    #define Z_MAX_POS 210
    #define Z_MIN_POS 0
    
    #define X_MAX_LENGTH (X_MAX_POS - X_MIN_POS)
    #define Y_MAX_LENGTH (Y_MAX_POS - Y_MIN_POS)
    #define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS)
    
    #define X_ARMLOOKUP_LENGTH (X_MAX_LENGTH / 20) + 1    // Maximum grid size: 2cm intervals (11 points per side for 200x200)
    #define Y_ARMLOOKUP_LENGTH (Y_MAX_LENGTH / 20) + 1
    
    // The position of the homing switches
    #define MANUAL_HOME_POSITIONS  // If defined, MANUAL_*_HOME_POS below will be used
    //#define BED_CENTER_AT_0_0  // If defined, the center of the bed is at (X=0, Y=0)
    
    // Manual homing switch locations:
    // For deltabots this means top and center of the cartesian print volume.
    // Scara: x centered, y 0
    #define MANUAL_X_HOME_POS -91
    #define MANUAL_Y_HOME_POS -4.5
    #define MANUAL_Z_HOME_POS 0.1  // Distance between nozzle and print surface after homing.
    
    //// MOVEMENT SETTINGS
    #define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
    #define HOMING_FEEDRATE {20*60, 20*60, 20*60, 0}  // set the homing speeds (mm/min)
    //#define QUICK_HOMING_FEEDRATE 20*60
    
    // default settings 
    
    #define DEFAULT_AXIS_STEPS_PER_UNIT   {215, 215, 100, 450}
    #define DEFAULT_MAX_FEEDRATE          {300, 300, 300, 45}  // (mm/sec)
    #define DEFAULT_MAX_ACCELERATION      {400, 400, 400, 8000}    // X, Y, Z, E maximum start speed for accelerated moves.
    
    #define DEFAULT_ACCELERATION          9000   // X, Y, Z and E max acceleration in mm/s^2 for printing moves
    #define DEFAULT_RETRACT_ACCELERATION  3000   // X, Y, Z and E max acceleration in mm/s^2 for r retracts
    
    // 
    #define DEFAULT_XYJERK                10.0    // (mm/sec)
    #define DEFAULT_ZJERK                 10.0    // (mm/sec)
    #define DEFAULT_EJERK                 5.0    // (mm/sec)
    
  • #4229

    Quentin Harley
    Keymaster

    The way homing was coded for morgan will ignore Z-min. It is a safety thing – homing with something on the bed will be a disaster with z-min, but z-max is perfectly fine.

    Where are you in SA?

  • #4233

    cocktailyogi
    Participant

    Hi Quentin,

    actually I am living in Switzerland. I am coming for an overlanding trip to ZA in August.

    Before I had a Prusa I3. It also had Zmin- Homing. I never encoundered any problem with thinks on the buildbed. But you are right, it could happen, but I dont care. My Morgan has a M8 Threaded rod as Z-Axis. It would take me too long time for homing.

    Could you tell me, where in the code you did the modification with the ignoring of Zmin? I would like to try it out.

    Yogi

  • #4273

    cocktailyogi
    Participant

    Hi Quentin,

    I have tested this settings already and I did it again. Only Zmin will be ignored. I only have a different endstopPullup-config, because I have Optoendstops, which do active pullup soldered pulldownresistors.
    M119 does exactly, what expected.
    X/Y have same optos and settings and do very well in your armlevel-Marlin

    Only Zmin gives problems. Must be firmware-related. There was a bug in Marlin regarding Zmin. Maybe it came also to your fork branching your version?
    https://github.com/ErikZalm/Marlin/issues/80

    I cannot find anything else in the code, which could explain, why it is ignored…

    Yogi

  • #4277

    Quentin Harley
    Keymaster

    Possible… My fork is on an ancient branch

  • #4441

    Quentin Harley
    Keymaster

    Where is your fork with the new marlin SCARA patched?

    To solve the problem, simply switch the x and y motors and endstop connectors. I did this very same thing to myself recently…

  • #4513

    cocktailyogi
    Participant

    Hi Quentin,

    thanks for your answer. You were right. It could be soved like you mentioned. But I read your answer later….. Now I swoped my arms. It was no so much effort.
    Unfortunately, I still have a problem with kinematics.

    I implemented your kinematic-functions into Marlin-Masterbranch. The forward and reverse-transformations are doing well and the results are plausible. But the arms are moving very strange and not like expected, but reproducable. Homing works great. At the moment I am looking for an idea, what is wrong. I did only sligth modifications to your kinematic-functions, so there are no worries. I double-checked the results with your original-functions. It must be something with the motion-control itself.

    If you are interested in my repository, please feel to have a look:
    https://github.com/cocktailyogi/Marlin/tree/SCARA_by_Yogi

    My goal is to merge it into the master branch. To get to that point I reduced public variable usage as much as possible and implemented everything by compiler-switch “#ifdef SCARA”

    Kind Regards,
    Yogi

  • #4517

    cocktailyogi
    Participant

    Hi Quentin,
    I am still tracking down my firmware-problem. Maybe you could look at my response on M114 and tell me, if you see anything unusual?

    In Home-Position after homing it brings:

    
    X:-30.00 Y:-55.00 Z:0.10 E:0.00 Count X: 115.23 Y:243.88 Z:0.10
    SCARA Theta:115.24   Psi+Theta:243.88
    SCARA Cal - Theta:115.24   Psi+Theta (90):38.64
    SCARA step Cal - Theta:109.61   Psi+Theta:122.35
    

    After “G1 X0 Y0 F1000” it moves over the bed and then stops outside bed….:

    
    X:0.00 Y:0.00 Z:0.10 E:0.00 Count X: 0.00 Y:0.00 Z:0.10
    SCARA Theta:83.21   Psi+Theta:218.29
    SCARA Cal - Theta:83.21   Psi+Theta (90):45.08
    SCARA step Cal - Theta:79.14   Psi+Theta:128.48
    

    “G1 X100 Y100” makes a move in 3 different directions and then stops on the front right corner…

    
    X:100.00 Y:100.00 Z:0.10 E:0.00 Count X: 100.00 Y:100.00 Z:0.10
    SCARA Theta:31.33   Psi+Theta:148.67
    SCARA Cal - Theta:31.33   Psi+Theta (90):27.34
    SCARA step Cal - Theta:29.80   Psi+Theta:111.60
    

    I have no idea, what is going on….

  • #4521

    Quentin Harley
    Keymaster

    Given your M114 output on homing, your home position is 30mm to the outside of the bed in X, and 55mm to the platform side of the bed in Y

    Correct?

    Would you mind posting some video?

  • #4549

    cocktailyogi
    Participant

    DONE! :-)))

    It works!

    I found the bug and now I have a Reprap Morgan with actual Marlin and Z-Min-Endstop.

    The bug was a stupid “&&” instead of “||” in prepare_move(). Took me two days to figure out my mistake.

    I did a pull-request in Github. Mybe they will pull it into masterbranch.
    Here is the repo:
    https://github.com/cocktailyogi/Marlin/tree/SCARA_by_Yogi

    Enjoy!
    Yogi

  • #4553

    Quentin Harley
    Keymaster

    Great Job!

    I meant to do this for a very long time, but just always had more important things to do.

    Gotta love Open Source!

    Everything working? M370 M371 M372 M373 M375 Manual leveling code?

  • #4593

    Quentin Harley
    Keymaster

    Ah I see… Levelling already implemented in Marlin

  • #4617

    cocktailyogi
    Participant

    You are welcome. In August we couls have a cold beer on that sucess.

    I have removed the M370 commands. Autolvelling is now in Marlin.
    Arc support is still missing.

    But I found another issue. My Extruder Stepper stooped working now. I am not sure, if it is firmware-related. It changed direction very quickly in one move. ?!?
    Current is set properly.

    Maybe you could test firmware on your printer.
    Yust copy SCARA-config-files from example folder to main-dir and enter your feedrates.

    Yogi

  • #4621

    cocktailyogi
    Participant

    Okay,

    found my extruder problem…. It was a broken wire to one coil…..

  • #4249

    Quentin Harley
    Keymaster

    Ok. Try this (and let me know what happens – never tried it this way… (Changes in bold)

    #ifndef ENDSTOPPULLUPS
    // fine Enstop settings: Individual Pullups. will be ignord if ENDSTOPPULLUPS is defined
    #define ENDSTOPPULLUP_XMAX
    #define ENDSTOPPULLUP_YMAX
    #define ENDSTOPPULLUP_ZMAX
    #define ENDSTOPPULLUP_XMIN
    #define ENDSTOPPULLUP_YMIN
    #define ENDSTOPPULLUP_ZMIN
    #endif

    // ENDSTOP SETTINGS:
    // Sets direction of endstops when homing; 1=MAX, -1=MIN
    #define X_HOME_DIR 1
    #define Y_HOME_DIR 1
    #define Z_HOME_DIR -1 // Bed home to top (-1)

    #define min_software_endstops true //If true, axis won’t move to coordinates less than HOME_POS.
    #define max_software_endstops true //If true, axis won’t move to coordinates greater than the defined lengths below.
    // Travel limits after homing
    #define X_MAX_POS 200
    #define X_MIN_POS 0
    #define Y_MAX_POS 200
    #define Y_MIN_POS 0
    #define Z_MAX_POS 200
    #define Z_MIN_POS MANUAL_Z_HOME_POS

    #define X_MAX_LENGTH (X_MAX_POS – X_MIN_POS)
    #define Y_MAX_LENGTH (Y_MAX_POS – Y_MIN_POS)
    #define Z_MAX_LENGTH (Z_MAX_POS – Z_MIN_POS)

    #define X_ARMLOOKUP_LENGTH (X_MAX_LENGTH / 20) + 1 // Maximum grid size: 2cm intervals (11 points per side for 200×200)
    #define Y_ARMLOOKUP_LENGTH (Y_MAX_LENGTH / 20) + 1

    // The position of the homing switches
    #define MANUAL_HOME_POSITIONS // If defined, MANUAL_*_HOME_POS below will be used
    //#define BED_CENTER_AT_0_0 // If defined, the center of the bed is at (X=0, Y=0)

    // Manual homing switch locations:
    // For deltabots this means top and center of the cartesian print volume.
    // Scara: x centered, y 0
    #define MANUAL_X_HOME_POS -8
    #define MANUAL_Y_HOME_POS -44
    #define MANUAL_Z_HOME_POS -10 // Distance between nozzle and print surface after homing.

  • #4429

    cocktailyogi
    Participant

    Hi Quentin,

    i had some progress. I am still preferring to have Z_min-Endstop. For Testing-pourpuses I switched over to Z-max and homing went fine. Then I decided to patch your SCARA-Code into the actual Marlin-tree and make a new firmware, which might find its way into the master-tree later. It is also possible to optimise the Scara-maths-transform code al little bit. As a matter of course I will refer to your code, espeacially the good maths.

    My z_min-endstop is doing well, now. It seems to be Marlin-Firmware-related.

    But I got stucked by another problem. It is possible to mount the Arms Theta and Psi mirrored, which will coause strange problems. It took me 2 days to figure this out. You should mention it in your calibration guide. I realised it be waching your pics. If the are are installed mirrored, it is reacting like inversed axis, but homing works well. Crasy mistake of me, which could happen to others, as well.

    Unfortunately it is not possible to upload pictures. Otherwise it could give you a pic of my problem and my printer. Maybe it is interesting, because we installed a simple adjustment-Screw for Z-Axis and bedleveling.

You must be logged in to reply to this topic.