Using two endstops on same axis



  • Hello. Is there any way to assign two endstops to one axis? I'm moving some filament through a path and I want to check it's presence at two different points. What I need to do is home the axis driving the filament until first endstop trigger at high end, then disable the 1st endstop and home again until the 2nd endstop trigger at high end.

    P.s.M574 C parameter is not working for me.



  • Don't think thats possible with the current firmware, not as a configuration option at least. Possibly in version 3 of the firmware when its done.

    However you could you could try using one normally closed switch and one normally open switch in parallell. Home against the first normally closed switch, then reconfigure the homing switch for that axis to be inverted and do another homing move until the filament reaches the normally open switch and closes the circuit.

    Disclaimer; author is heavily sedated and suggestion may not be founded in facts. Try with caution.



  • @bearer said in Using two endstops on same axis:

    Don't think thats possible with the current firmware, not as a configuration option at least. Possibly in version 3 of the firmware when its done.
    However you could you could try using one normally closed switch and one normally open switch in parallell. Home against the first normally closed switch, then reconfigure the homing switch for that axis to be inverted and do another homing move until the filament reaches the normally open switch and closes the circuit.
    Disclaimer; author is heavily sedated and suggestion may not be founded in facts. Try with caution.

    Not sure if that works. In order to check if the filament is actually there ,I need to configure external triggers using M581 and check the triggers with M582. The endstops are in fact one normally open and the other normally closed . Choosing which endstop the axis is using with the C parameter of M574 would have made this a very easy task.



  • If you have the endstops configured with M574 you simply G1 H1 En move the axis until the filament arrives. Where E is you extruder or whatever axis, and n is the expected lenght of the filament to travel. Reconfigre M574 and repeat. Finish up with setting sensible M208 limits again which were overridden by G1 H1



  • Just try M574 with the C parameter? But if you intend to use triggers i don't think the pin need to be a endstop attached to an axis, it just need to be a free endstop input as those are the only ones checked by the firmware for now.



  • @bearer said in Using two endstops on same axis:

    If you have the endstops configured with M574 you simply G1 H1 En move the axis until the filament arrives. Where E is you extruder or whatever axis, and n is the expected lenght of the filament to travel. Reconfigre M574 and repeat. Finish up with setting sensible M208 limits again which were overridden by G1 H1

    Basically measuring the filament. Valid approach normally but not really what I’m looking for. The whole idea is that the filament might get stuck somewhere between the two endstops, in which case it just grinds until the G1 move is finished and then the printer will just continue to execute the gcode as normal.

    If the filament gets stuck between sensors, with external triggers I can just pause the print using a triggerx.g macro and fix the issue manually or, eventually , macros.



  • But if you're not going to use G1 H1 you don't need the endstop configured with M574, M581 for the trigger will work with all the endstop pins, assigned to an axis or not. As such you don't need two endstops, just two triggers, which should work. (provided the code you put in the triggers gets the job done)



  • This is what it looks like ATM:

    M574 V2 S1 ; set V axis max endstop to switched low
    G91        ; relative moves
    G1 V20 H1 F3000 ; feed filament to filament sensor
    G92 V0 ; force V to 0mm
    G1 V500 H1  F3000 ; feed a bit more to reliably switch sensor And reach tube
    G92 V0 ; force V to 0mm
    M400 ; wait for moves to finish
    M581 V S0 T2 C0         ; activate trigger 2 on falling edge
    M582 T2                                ; check filament sensor to confirm loading successful
    M581 T2 S-1    ; deactivate trigger 2
    

    This is moving the filament on V axis to the first endstop, checks that endstop , if the filament is not present it runs a trigger2.g macro.
    If the filament it’s there I’ll have to disable the first endstop, configure second endstop to max V ,move the filament until it hits it, check in if is there as above, if it’s not present will run same/another trigger.g macro. I need the second endstop to check if the filament actually reached it , it may get blocked somewhere along its path between between the sensors.

    I hope this clarifies what I’m trying to achieve.

    Anyway, it seems that currently there’s no way I can pair different endstops to axis and I’m not competent enough to compile the 3 beta, also I don’t think I’d be able to use i without proper documentation.



  • There are regular builds of the version 3 betas, which i keep updating to my "never works properly anyways" printer, the work horse is, and will be, running the latest 2.x release for 6-12 months I'm guessing, but I'm conservative when it comes to updates on stuff I rely on.

    But yes, the task at hand is clearer now. Just a fyi, if you put ``` on the line over and under your g-code the forum formats it as code. single backticks will do the same inline in a paragraph.

    so the trigger2.g would have M574 V2 S2 and more G1 H1 moves, followed by another M582 back in the homing file?



  • @bearer No, trigger2 just shows a message about filament not being detected and pauses the print.

    I am trying to run a MMU2 with duets hardware using this guide Tprepmaster is the macro that I’m trying to edit. In there , after the endstop is checked , it uses sensorless homing to drive the filament into the extruder’s gears. But there is no way to detect if the filament really got there or it just got snagged on it’s way and stalled.

    Other reason for not using sensorless is the fact that the filament will have some tension in it from the motor driving into the extruder gears until it stalls and it could prove tricky to measure the amount is needed to be extruded for the filament to get into the melt zone .



  • Okay, so you use M574/G1 H1 to do the move and stop if/when the endstop is hit, then you use M581/M582 to pause if not.

    Then my proposed NC with NO in parallell solution should work i think with the adittion of M581/M582 after each G1 H1 move. To further avoid unnecessary grinding of filament you'd need a filament monitor that tracks filament motion i recon.



  • I’ll try wire them in parallel but not sure it will work. What I think it will happen is that as soon I configure the with M574 V2 S1/S0 one will trigger while the other not.



  • Both switches are in parallell between signal and ground with onboard pull up to 3v3.

    No filament present.
    First switch is NC and not pressed, it pulls signal to gnd.
    Second switch is NO and not pressed, it has no effect.

    You issue G1 H1 Vn and when filament arrive at first switch:
    First switch is NC and pressed, it has no effect, and duet pull up makes signal 3.3v, the G1 H1 move is terminated by the active high endstop.
    Second switch is NO and not pressed, it has no effect.

    (You check that filament actually arrived by means of M581/M582)

    So far so good. You now reconfigure the V endstop to be active low instead of active high. Signal is currently high, and you issue G1 H1 Vn and when filament arrive at second switch:
    First switch is NC and still pressed, it continiues to have no effect.
    Second switch is NO and also pressed, it now pulls the signal to gnd and the G1 H1 move is terminated by the active low endstop.

    (You check that filament actually arrived by means of M581/M582)

    I could be wrong, but if you wire it up I think its worth a try.



  • So, if I've got this correct, you want to send a sequence of commands to home the filament (E axis) twice, once to one point, and then again to a second point.

    Set the firmware to expect a normally closed switch, which the first one will be. The second will be normally open, both will be in parallel. The circuit will see a closed switch.

    Home the axis. The first switch opens when the filament enters it. Both switches are open, the axis stops.

    Set the firmware to expect a normally open switch. Both switches are open, nothing is triggered.

    Home the axis. When the filament hits the second switch, it closes. The axis stops.

    Edit: LOL. Took me too long to type. This is the same solution as above.



  • Yes! That worked. Can’t believe you gave me the solution in your first post and I was just overthinking it.



  • More drugs less thinking 😛
    (No kids, dont do drugs!)

    But if you describe what you want to achieve instead of how you (think you) want to achieve it, you'll get to the finish line faster.


 

Looks like your connection to Duet3D was lost, please wait while we try to reconnect.