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

    analog probe triggered on falling edge? how?

    Scheduled Pinned Locked Moved
    Duet Hardware and wiring
    3
    10
    268
    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.
    • arhiundefined
      arhi
      last edited by arhi

      I need to configure analog probe to trigger on falling edge.

      Reading documentation P1 is "rising edge", si triggers when you get over the treshold and P3 is "same only falling edge" but I'm failing to make it work.

      M558 P1 C"zprobe.in" R0 H5 F3000 T3000 A3 S0.03 K0 I1 G31 P{sensors.probes[0].value[0] - 50} G31 M119
      > Z probe 0: current reading 0, threshold -50, trigger height 0.700, offsets X0.0 Y0.0
      > Endstops - X: not stopped, Y: not stopped, Z: no endstop, Z probe: at min stop
      
      M558 P3 C"zprobe.in" R0 H5 F3000 T3000 A3 S0.03 K0 I1 G31 P{sensors.probes[0].value[0] - 50} G31 M119
      > Z probe 0: current reading 0, threshold -50, trigger height 0.700, offsets X0.0 Y0.0
      > Endstops - X: not stopped, Y: not stopped, Z: no endstop, Z probe: at min stop
      
      M558 P1 C"zprobe.in" R0 H5 F3000 T3000 A3 S0.03 K0 I1 G31 P{sensors.probes[0].value[0] + 50} G31 M119
      > Z probe 0: current reading 0, threshold 50, trigger height 0.700, offsets X0.0 Y0.0
      > Endstops - X: not stopped, Y: not stopped, Z: no endstop, Z probe: not stopped
      
      M558 P3 C"zprobe.in" R0 H5 F3000 T3000 A3 S0.03 K0 I1 G31 P{sensors.probes[0].value[0] + 50} G31 M119
      > Z probe 0: current reading 0, threshold 50, trigger height 0.700, offsets X0.0 Y0.0
      > Endstops - X: not stopped, Y: not stopped, Z: no endstop, Z probe: not stopped
      

      both P1 and P3 behave identical, triggers when current > treshold

      gtj0undefined 1 Reply Last reply Reply Quote 0
      • gtj0undefined
        gtj0 @arhi
        last edited by gtj0

        @arhi said in analog probe triggered on falling edge? how?:

        I need to configure analog probe to trigger on falling edge.

        Reading documentation P1 is "rising edge", si triggers when you get over the treshold and P3 is "same only falling edge" but I'm failing to make it work.

        Which RRF and board?

        Where'd you read "rising edge" and "falling edge"?

        I only see that P3 inverts the control signal and I'm not even sure if its supported anymore. The WHATS_NEW pages are a little ambiguous. You could try inverting the pin but I don't remember if that works in analog mode.

        https://duet3d.dozuki.com/Wiki/Gcode#Section_M558_Set_Z_probe_type

        • P1 specifies an unmodulated or smart IR probe, or any other probe type that emulates one (probe output is an analog signal that rises with decreasing nozzle height above the bed). If there is a control signal to the probe, it is driven high when the probe type is P1.
        • P3 is similar to P1 but drives the control signal to the probe low. This may be used to switch between different Z probes.
        arhiundefined 1 Reply Last reply Reply Quote 0
        • arhiundefined
          arhi @gtj0
          last edited by

          @gtj0 said in analog probe triggered on falling edge? how?:

          Which RRF and board?

          RC12 and 2eth

          Where'd you read "rising edge" and "falling edge"?

          Well P1 def trigger on rising edge as it triggers when read > th

          P3 is kinda unclear but if it inverts the output then again output = !(read>th) so falling edge (the == point is irrelevant really)

          I only see that P3 inverts the control signal and I'm not even sure if its supported anymore.

          Whatever the "control signal" is.

          I assume it is the "output of the comparison of read vs threshold" that controls further behavior of the firmware and not some servo/modulator signal but it's probbly just that.

          The WHATS_NEW pages are a little ambiguous. You could try inverting the pin but I don't remember if that works in analog mode.

          does not, tried

          I solved the problem by physically inverting the signal before it reaches the duet but I wasted 2 hours before I figured out signal is going down and not up (nothing to do with duet, just the probe), finally I hooked up a scope and everything was clear inside few seconds, could not get duet to trigger on falling so inverted the signal, this is mostly postmortem checking if there maybe actually is a way to trigger on falling edge

          1 Reply Last reply Reply Quote 0
          • dc42undefined
            dc42 administrators
            last edited by dc42

            @arhi said in analog probe triggered on falling edge? how?:

            M558 P1 C"zprobe.in"

            M558 P1 C"!zprobe.in" should have done what you wanted.

            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

            arhiundefined 2 Replies Last reply Reply Quote 0
            • arhiundefined
              arhi @dc42
              last edited by

              @dc42 said in analog probe triggered on falling edge? how?:

              M558 P1 C"!zprobe.in" should have done what you wanted.

              I tried that 😄 and it did not, but I'll try it again as last time I tried something at 3am and didn't work worked during normal hours so problem was, as usual, between keyboard and chair. So lemme try again.

              1 Reply Last reply Reply Quote 0
              • arhiundefined
                arhi @dc42
                last edited by

                @dc42

                b8136e76-ae6e-45cf-aa73-00d86b3eb1e5-image.png

                so originally defined without !
                triggered when current > trashold

                defined with !
                same thing current > trashold

                Now, since I did have some sleep, I do see that it was reading 775 and now 247 so I suspect it always trigger when current > trashold but if I define with !analogpin the "current" is actually "1024 - current_if_no_invert" ? Am I right?

                gtj0undefined 1 Reply Last reply Reply Quote 0
                • gtj0undefined
                  gtj0 @arhi
                  last edited by

                  @arhi I've just been testing this...

                  Inverting the pin changes the calculation of the value but it doesn't change the consideration of whether it's "triggered" or not. It's always triggered when the value is above the threshold. The I parameter does nothing it appears.

                  One thing I noticed in my testing is that issuing M558 always resets the threshold to 500 so a G31 command should always come after M558. It's in the docs for M558 but I forgot it. 🙂

                  1 Reply Last reply Reply Quote 0
                  • arhiundefined
                    arhi
                    last edited by

                    @gtj0 yes, that's what I suspected it always trigger when read > th but calculate read as 1024-read in case of ! in the analog pin name. I did not do nothing for me too, confusing but..

                    yes, G31 always after 🙂

                    dc42undefined 1 Reply Last reply Reply Quote 0
                    • dc42undefined
                      dc42 administrators @arhi
                      last edited by

                      @arhi said in analog probe triggered on falling edge? how?:

                      @gtj0 yes, that's what I suspected it always trigger when read > th but calculate read as 1024-read in case of ! in the analog pin name. I did not do nothing for me too, confusing but..

                      Yes in RRF 3.01 using ! in front of the pin name will change the reading to 1000 minus the original reading. So if you also change the threshold to 1000 minus the original threshold, it should do what you want.

                      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

                      arhiundefined 1 Reply Last reply Reply Quote 1
                      • arhiundefined
                        arhi @dc42
                        last edited by

                        @dc42 yup it works great, just as you explained. I originally expected the readings to remain the same but > < to be switched but this also makes sense.

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