Problems with optical endstops

Hi,

I’m setting up a new i3 derived printer (24V) using a smoothie 5x 1.0b, and got an irritating small problem.

I prefer to use optical endstops (V19 1028 TCST 2103 ) rather than switches, because I find them much more repeatable, which is especially important on Z.
I could wire them correctly on X and Z but could not make it work on Y.

On Y, what happens is that the endstop switch correctly from 0 to 1 when homing, but never get back to 0 when leaving the end position.
Any idea what this happens ? I checked cabling and continuity, used 2 different detectors, used both YMIN et YMAX pins. The only difference is that the Y cable is perhaps 200mm longer.

It is not a big deal because I could use a standard switch and that works, but I would like to understand.

the relevant part of the config (note that I home to Ymax) :

## Endstops
endstops_enable                              true             # The endstop module is enabled by default and can be disabled here
#corexy_homing                               false            # Set to true if homing on a hbot or corexy
alpha_min_endstop                            1.24^            # Pin to read min endstop, add a ! to invert if endstop is NO connected to ground
#alpha_max_endstop                           1.25^            # Pin to read max endstop, uncomment this and comment the above if using max endstops
alpha_homing_direction                       home_to_min      # Or set to home_to_max and set alpha_max and uncomment the alpha_max_endstop
alpha_min                                    0                # This gets loaded as the current position after homing when home_to_min is set
alpha_max                                    190              # This gets loaded as the current position after homing when home_to_max is set
#beta_min_endstop                             1.26^            # Pin to read min endstop, add a ! to invert if endstop is NO connected to ground
beta_max_endstop                            1.26^            # Pin to read max endstop, uncomment this and comment the above if using max endstops
beta_homing_direction                        home_to_max      # Or set to home_to_max and set alpha_max and uncomment the alpha_max_endstop
beta_min                                     0                # This gets loaded as the current position after homing when home_to_min is set
beta_max                                     200              # This gets loaded as the current position after homing when home_to_max is set
gamma_min_endstop                            1.28^            # Pin to read min endstop, add a ! to invert if endstop is NO connected to ground
#gamma_max_endstop                           1.29^            # Pin to read max endstop, uncomment this and comment the above if using max endstops
gamma_homing_direction                       home_to_min      # Or set to home_to_max and set alpha_max and uncomment the alpha_max_endstop
gamma_min                                    0                # This gets loaded as the current position after homing when home_to_min is set
gamma_max                                    160              # This gets loaded as the current position after homing when home_to_max is set

alpha_max_travel 195 # Max travel in mm for alpha/X axis when homing
beta_max_travel 205 # Max travel in mm for beta/Y axis when homing
gamma_max_travel 165 # Max travel in mm for gamma/Z axis when homing

Optional enable limit switches, actions will stop if any enabled limit switch is triggered

#alpha_limit_enable false # Set to true to enable X min and max limit switches
#beta_limit_enable false # Set to true to enable Y min and max limit switches
#gamma_limit_enable false # Set to true to enable Z min and max limit switches

Endstops home at their fast feedrate first, then once the endstop is found they home again at their slow feedrate for accuracy

alpha_fast_homing_rate_mm_s 50 # Alpha/X fast homing feedrate in mm/second
alpha_slow_homing_rate_mm_s 25 # Alpha/X slow homing feedrate in mm/second
beta_fast_homing_rate_mm_s 50 # Beta/Y fast homing feedrate in mm/second
beta_slow_homing_rate_mm_s 25 # Beta/Y slow homing feedrate in mm/second
gamma_fast_homing_rate_mm_s 4 # Gamma/Z fast homing feedrate in mm/second
gamma_slow_homing_rate_mm_s 2 # Gamma/Z slow homing feedrate in mm/second

alpha_homing_retract_mm 5 # Distance to retract from the endstop after it is hit for alpha/X
beta_homing_retract_mm 5 # Distance to retract from the endstop after it is hit for beta/Y
gamma_homing_retract_mm 1 # Distance to retract from the endstop after it is hit for gamma/Z

Optional enable limit switches, actions will stop if any enabled limit switch is triggered (all are set for delta)

#alpha_limit_enable false # Set to true to enable X min and max limit switches
#beta_limit_enable false # Set to true to enable Y min and max limit switches
#gamma_limit_enable false # Set to true to enable Z min and max limit switches

Optional order in which axis will home, default is they all home at the same time,

If this is set it will force each axis to home one at a time in the specified order

homing_order XYZ # X axis followed by Y then Z last
#move_to_origin_after_home false # Move XY to 0,0 after homing
#endstop_debounce_count 100 # Uncomment if you get noise on your endstops, default is 100
#endstop_debounce_ms 1 # Uncomment if you get noise on your endstops, default is 1 millisecond debounce
#home_z_first true # Uncomment and set to true to home the Z first, otherwise Z homes after XY

End of endstop config

Imported from wikidot

I had this same issue literally yesterday, and the solution is simple yet not obvious. You need to add a 1K ohm resistor from the signal pin to ground (do this for both X and Y axes to ensure that the logic levels are reached). This immediately solved my problem. I also recommend using your console to send an M119 to verify the results (before and after). Hope this helps.