Standoff offset between max and minimum endstops on dual axis?



  • Hiya, had a thought of a macro / behaviour I’d like to achieve and wanted to get some thoughts on it. This would be for setting up dual endstops or sensorless homing on the max and min of individual axes, and could be useful for squaring parallel axes by finding the difference in travel distance - (assuming the machine itself is built square).

    On my CNC machine I have two y endstops on parallel y axes (y and v when unmapped). I’ve manually worked out the difference and fine adjusted the standoff distance after homing to square the y axes to the x axis. So assuming the difference between the two y axes is 1mm greater on one side - that could be added to the opposite sides standoff distance to square the machine.

    I’d like to write a macro where homing towards physical endstops sets the zero, and to then moving towards the opposite direction using sensorless stopping to probe and report the distance travelled.

    I am stuck on how to achieve this as the G1 H3 measures axis length but sets the appropriate M208 limit, and M558 P10 uses the z motor stall detect – is there a way to report the distance during a sensorless homing / probing other axes movement?

    I've not tested anything out yet - so it's just an idea at the moment.


  • Moderator

    Here's an example of a macro being used to measure the Z0 position and then measure the length of the Z axis using G1 H3 to set the M208. Perhaps that gives some ideas?

    https://duet3d.dozuki.com/Wiki/Macros#Section_Example_Measuring_the_Z_axis_for_a_Z_max_endstop_and_saving_the_result

    As for specifics, I'm not sure how it would work with dual endstops unless the axis were split and the shorter distance used for both axis (ie enforce the soft limit for the longer axis to keep it lined up with the shorter axis.)



  • @Phaedrux Thanks for that - I guess what I need to find out when I next have time is whether the M574 command can be used to set max and min endstops at the same time - which I haven't tried.

    ; endstops
    M574 Y2 S1 P"ystop"		; y max active high max endstop switch
    M574 Y1 S3			; y min sensorless 
    

    I can then attempt something like this this - which measures the min y & v axes post start-up homing.

    G91					; relative positioning
    G21					; Set units to mm
    M584 Y1 V4 P5				; separate Y axis steppers for independent alignment
    M574 Y1 S3				; y max active high min sensorless
    M574 V1 S3				; v max active high min sensorless
    M913 Y65 V65				; drop motor current to 70%
    M208 Y-10 V-10 S1			; set Y and V axis max beyond machine size.
    G1 H3 Y-810 V-810 F1000		; move quickly to Y & V axis min and stop there (first pass)
    G1 H0 Y10 V10 F800			; go back a few mm
    G1 H3 Y-40 V-40 F200			; move slowly to Y axis endstop once more (second pass)
    G0 H0 Y4 V4					; move away from physical ends
    G10 L2 P6 Y{move.axes[1].machinePosition} V{move.axes[0].machinePosition}		; store sensorless stop location to G59 WCS
    

    I should be able to refer to the machine position and work out what the difference between the y and v axes, and then workout the standoff distance during normal homing. Something to test when I'm next in. Not sure if this will work because it depends on the parts making contact during the sensorless movement and how similar they are.

    Maybe in reality spot marking four holes on a piece of material, and using a camera to log the coordinates would be more accurate.

    Thanks again. Will update with results and development.


  • Moderator

    @EducatingSavvas said in Measuring distance between max and minimum endstops on axis?:

    whether the M574 command can be used to set max and min endstops at the same time - which I haven't tried.

    No they can't, but you don't really have to have both endstops configured at the same time if you're just using them as endstops which are only active during homing. You can configure the min endstop to set 0, and then configure the high endstop to measure the distance.



  • @Phaedrux

    I think I need a G1 H4 option where the move is terminated when the sensorless-endstop switch is triggered, however without setting the axis limit to the current position and overriding the value in M208. I want to maintain some distance between between the axes limits opposite from the homing end stops so nothing (dust, debris, wires or my fingers) accidently gets caught in the gap.

    I'm also trying to test this out on my electronics without a physical CNC machine. So I'm pinching the stepper motors shafts to simulate a sensorless stop and overriding the minimum limits too short...


  • administrators

    @EducatingSavvas said in Standoff offset between max and minimum endstops on dual axis?:

    @Phaedrux

    I think I need a G1 H4 option where the move is terminated when the sensorless-endstop switch is triggered, however without setting the axis limit to the current position and overriding the value in M208.

    That's already implemented in firmware 3.2beta4.



  • @dc42 It's like you can read my mind! I'll update as soon as I can - still on beta3.2.

    In case anyone is following this thread, this is implemented by - G1 H1 E moves (stopping on motor stall).


Log in to reply