Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Using endstop for DC motor

    Scheduled Pinned Locked Moved
    Using Duet Controllers
    3
    5
    312
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • adistrundefined
      adistr
      last edited by adistr

      Hi,
      I connect dc motor to my duet 2 wifi board - through a driver, an external power source and it works great.
      The question I have is how can I use one of my endstop switches to stop a dc motor (like a stepper motor) when the endstop switch is pressed?

      Or other option -
      how can I catch an event of "endstop pressed" and after that event execute specific command?

      Thanks,
      Adi

      alankilianundefined 1 Reply Last reply Reply Quote 0
      • alankilianundefined
        alankilian @adistr
        last edited by

        @adistr THIS POST talks about using an endstop switch as a "trigger" and then using the M581 command to configure the results.

        Basically, you would use M581 to connect your endstop switch input to trigger #2 and when the endstop was hit, the macro sys/trigger2.g would be executed.

        SeemeCNC Rostock Max V3 converted to V3.2 with a Duet2 Ethernet Firmware 3.2 and SE300

        adistrundefined 1 Reply Last reply Reply Quote 2
        • adistrundefined
          adistr @alankilian
          last edited by adistr

          @alankilian
          I appreciate your response very much.
          I connect the end stop switch to Y (without a motor)

          • In addition, I added to sys trigger1.g file that contains the following command: M42 P7 S0.
            I also add this line at the end of the config file -
            ; Custom settings are not defined
            M581 T1 Y S1.

          Why is the trigger not executed and the DC motor continues to run?


          Additionally, I have tried adding M300 in the trigger file to understand if the file is executed when the end stop is pressed, but the beep is not working.
          What am I doing wrong? Any suggestions?

          Thanks,
          Adi

          alankilianundefined Phaedruxundefined 2 Replies Last reply Reply Quote 0
          • alankilianundefined
            alankilian @adistr
            last edited by

            @adistr

            You have to use a trigger number 2 or greater as in my example.

            Trigger number 0 causes an emergency stop as if M112 had been received. Trigger number 1 causes the print to be paused as if M25 had been received. Any trigger number # greater than 1 causes the macro file sys/trigger#.g to be executed.

            You can test your trigger macro by typing this in the console

            M98 P"trigger2.g"
            

            If you still have problems, post your complete config.g and your complete trigger2.g and we'll take a look.

            SeemeCNC Rostock Max V3 converted to V3.2 with a Duet2 Ethernet Firmware 3.2 and SE300

            1 Reply Last reply Reply Quote 1
            • Phaedruxundefined
              Phaedrux Moderator @adistr
              last edited by

              @adistr said in Using endstop for DC motor:

              M581 T1 Y S1.

              Why is the trigger not executed and the DC motor continues to run?

              This looks like syntax for RRF2. Surely you are on RRF3.4 now which is far more felxible?

              https://docs.duet3d.com/User_manual/Reference/Gcodes#m581-configure-external-trigger

              Z-Bot CoreXY Build | Thingiverse Profile

              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              Unless otherwise noted, all forum content is licensed under CC-BY-SA