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

    want to set the timeout period for a simple filament sensor.

    Scheduled Pinned Locked Moved
    Gcode meta commands
    3
    7
    310
    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.
    • Nagoya-Kougeiundefined
      Nagoya-Kougei
      last edited by

      I am currently using a simple switch type filament sensor for my tool change 3D printer.

      Printing is temporarily stopped due to a momentary false detection by the filament sensor, so I found a previous post while searching for a timeout period.

      Re: Simple switch Run-Out Sensor too sensitive. Add timeout?

      I would like to write a function similar to this in daemo.g, but I don't really know how to write it.
      (https://forum.duet3d.com/post/187835)

      Can you provide me with a sample daemon.g code like the one written here?
      I find this mechanism a little difficult to code.

      RRF for Duet 3 Mini 5+ version 3.4.5 (SBC mode)

      PS. I am developing a tool change 3D printer in Japan.(https://twitter.com/Senju_3Dprinter)

      OwenDundefined 1 Reply Last reply Reply Quote 0
      • OwenDundefined
        OwenD @Nagoya-Kougei
        last edited by

        @Nagoya-Kougei
        I don't think you really need to use daemon.g
        When the sensor triggers it will run filament-error.g if it exists
        If it's not, then the print just pauses.
        You put whatever you want in that file.

        You may be getting switch "bounce" issues
        I use this to overcome that

        G4 P10 ; delay 10ms to debounce
        if sensors.filamentMonitors[0].status="ok"
        	echo "switch bounce detected - error cancelled"
        	M99 ; break out if sensor value is zero again (bouncing)
        ; if we got this far the switch is still showing no filament 
        M25 ;pause
        

        You could easily increase the G4 delay time to whatever you want.
        You'll need to put M25 after your checks in order to pause the print if the switch is still activated

        Nagoya-Kougeiundefined 1 Reply Last reply Reply Quote 1
        • Nagoya-Kougeiundefined
          Nagoya-Kougei @OwenD
          last edited by

          @OwenD
          thank you!
          I immediately inserted the code and tried it out, and it worked as expected!

          There is just one problem, because my 3d printer is a tool change , the [] part of "sensors.filamentMonitors[0]" changes depending on the head used from 0 to 2.

          How can I make it compatible? Thank you for your wonderful support.

          OwenDundefined 1 Reply Last reply Reply Quote 0
          • OwenDundefined
            OwenD @Nagoya-Kougei
            last edited by

            @Nagoya-Kougei
            Have a read of
            https://docs.duet3d.com/User_manual/RepRapFirmware/Events

            I think it will be something like the following, but you'll need to test

            G4 P10 ; delay 10ms to debounce
            if sensors.filamentMonitors[{param.B}].status="ok"
            	echo "switch bounce detected - error cancelled"
            	M99 ; break out if sensor value is zero again (bouncing)
            ; if we got this far the switch is still showing no filament 
            M25 ;pause
            
            Nagoya-Kougeiundefined 1 Reply Last reply Reply Quote 0
            • Nagoya-Kougeiundefined
              Nagoya-Kougei @OwenD
              last edited by

              @OwenD
              When I changed it to param.D, it worked! !
              {param.B} => {param.D}

              G4 P10 ; delay 10ms to debounce
              if sensors.filamentMonitors[{param.D}].status="ok"
                 echo "switch bounce detected - error cancelled"
                 M99 ; break out if sensor value is zero again (bouncing)
              ; if we got this far the switch is still showing no filament 
              M25 ;pause
              

              Now let's continue with the printing test! 🙂

              dc42undefined 1 Reply Last reply Reply Quote 0
              • dc42undefined
                dc42 administrators @Nagoya-Kougei
                last edited by

                @Nagoya-Kougei I'm glad you got it working. You don't need the { } around param.D.

                Duet WiFi hardware designer and firmware engineer
                Please do not ask me for Duet support via PM or email, use the forum
                http://www.escher3d.com, https://miscsolutions.wordpress.com

                Nagoya-Kougeiundefined 1 Reply Last reply Reply Quote 1
                • Nagoya-Kougeiundefined
                  Nagoya-Kougei @dc42
                  last edited by

                  @dc42  Thank you for the additional information! , I trt it !

                  Thanks to your support, we have successfully configured the firmware and will soon be able to release our tool change 3D printer!

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