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

    Connect a water flow sensor --> will M591 P7 work in Laser mode?

    Scheduled Pinned Locked Moved Solved
    Laser Cutters
    4
    50
    2.2k
    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.
    • cosmowaveundefined
      cosmowave @cosmowave
      last edited by

      var.counter
      var.sum
      
      if var.counter < 10
         set var.sum = {var.sum + "newValue"}
         set var.counter = var.counter + 1
      
      else 
         if {var.sum / var.counter} < 20
         	NO FLOW
         var.counter = 0
      

      Mankati FSXT+, DeltaTowerV2, E3D MS/TC

      paulg4hundefined 1 Reply Last reply Reply Quote 0
      • paulg4hundefined
        paulg4h @cosmowave
        last edited by paulg4h

        @cosmowave there is still an issue, the sum value will get higher and higher, so when the flow sensor will return only zero after an hour it takes several runs to get the avg town to trigger the alarm.

        var val1 = 0
        var val2 = 0
        var val3 = 0
        var val4 = 0
        var val5 = 0
        var max= 5
        var avg = 0
        var pos = 1
        var initDone = 0
        while true
          G4 S2 ; run every two seconds
          if pos = 1
            set val1 = fans[0].rpm
          if pos = 2
            set val2 = fans[0].rpm
          if pos = 3
            set val3 = fans[0].rpm
          if pos = 4
            set val4 = fans[0].rpm
          if pos = 5
            set val5 = fans[0].rpm
         set  pos = pos +1 
          if pos > max
            set pos = 1
            if initDone = 0
              set initDone = 1
          set avg = {val1 + val2 + val3 + val4 + val5} / max
        
          if initDone > 0
            if avg < 50
               M118 S"no water flow"
               M25
        

        This code is not tested jet and far from nice...

        cosmowaveundefined 1 Reply Last reply Reply Quote 0
        • cosmowaveundefined
          cosmowave @paulg4h
          last edited by

          @paulg4h yes, you're right. There is again an error! Soory for that!
          You have to reset the sum too!

          var.counter
          var.sum
           
          if var.counter < 10
             set var.sum = {var.sum + "newValue"}
             set var.counter = var.counter + 1
           
          else 
             if {var.sum / var.counter} < 20
             	NO FLOW
             var.counter = 0
             var.sum = 0
          

          Mankati FSXT+, DeltaTowerV2, E3D MS/TC

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

            @paulg4h said in Connect a water flow sensor --> will M591 P7 work in Laser mode?:

            How could I use the rpm more reliable to detect water flow, even in DWC the Sensors Fan RPM are shown and jumps between 0 and something between 190 and 210 all the time.

            That doesn't sound right. I suspect it is because the RPM is much lower than for a typical fan. If RRF doesn't receive any tacho pulses for a certain period of time, it assumes the fan has stopped and gives a zero reading.

            I just checked the code: it requires at least 32 tacho pulses over a period not exceeding 3 seconds. It assumes 2 tacho pulses per revolution. So the minimum speed to get a stable reading is 16/3 revs/sec = 320 rpm.

            I'll make a note to allow a wider range in RRF 3.4.

            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

            paulg4hundefined 1 Reply Last reply Reply Quote 1
            • paulg4hundefined
              paulg4h @dc42
              last edited by

              @dc42 said in Connect a water flow sensor --> will M591 P7 work in Laser mode?:

              16/3 revs/sec = 320 rpm.

              Many thank's!

              cosmowaveundefined 1 Reply Last reply Reply Quote 0
              • cosmowaveundefined
                cosmowave @paulg4h
                last edited by

                @paulg4h If you can open the sensor, you can try to insert more magnets. Eventually you can reach the desired rpm. But i'm not sure if there is space and if the hall detects proper signal-edges with more magnets...

                Mankati FSXT+, DeltaTowerV2, E3D MS/TC

                paulg4hundefined 1 Reply Last reply Reply Quote 0
                • paulg4hundefined
                  paulg4h @cosmowave
                  last edited by

                  @cosmowave I use your script above with some slightly modification and now it works so far

                  var counter=0
                  var sum=0
                  
                  while true
                    G4 S2
                    if job.duration = null
                        ; No job ignore sensor reading
                    else
                        ; Check Water Flow
                        if var.counter < 10
                          set var.sum = {var.sum + fans[0].rpm}
                          set var.counter = var.counter + 1
                        else 
                          if {var.sum / var.counter} < 50
                            ; NO FLOW
                            var.counter = 0
                            var.sum = 0
                            M25
                            M118 S"No Water flow!" 
                        
                        ; Check water temperature
                        if sensors.analog[0].lastReading > 35
                           M25
                           M118 S"Water to hot!"
                  
                  paulg4hundefined 1 Reply Last reply Reply Quote 0
                  • paulg4hundefined
                    paulg4h @paulg4h
                    last edited by paulg4h

                    The Release 3.3 of RRF includes a fix to recognize pulse sensors until 160 rpm instead of 320 rpm minimum
                    https://github.com/Duet3D/RepRapFirmware/wiki/Changelog-RRF-3.x-Beta-&-RC#reprapfirmware-33-post-rc3

                    Many thank's!

                    dc42undefined 2 Replies Last reply Reply Quote 0
                    • dc42undefined
                      dc42 administrators @paulg4h
                      last edited by dc42

                      @paulg4h said in Connect a water flow sensor --> will M591 P7 work in Laser mode?:

                      The Release 3.3 of RRF includes a fix to recognize pulse sensors until 160 rpm instead of 320 rpm minimum
                      https://github.com/Duet3D/RepRapFirmware/wiki/Changelog-RRF-3.x-Beta-&-RC#reprapfirmware-33-post-rc3

                      Many thank's!

                      @paulg4h You can download preview firmware including that change from https://www.dropbox.com/sh/xfsvscbaab0dtzl/AACCcSeiTNINZL-xbs6IhC4Ja?dl=0. Ignore the .map files.

                      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

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

                        @paulg4h is this now working properly for you using firmware 3.3 ?

                        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

                        paulg4hundefined 1 Reply Last reply Reply Quote 0
                        • paulg4hundefined
                          paulg4h @dc42
                          last edited by

                          @dc42

                          Many thank's I updated today and now the RPM of the flow sensor is working perfectly without the variables!

                          cosmowaveundefined 1 Reply Last reply Reply Quote 0
                          • cosmowaveundefined
                            cosmowave @paulg4h
                            last edited by

                            @dc42
                            Is it possible to allow even lower rpm readings? My flowsensor gives 35rpm at minimum...

                            Mankati FSXT+, DeltaTowerV2, E3D MS/TC

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