Connect a water flow sensor --> will M591 P7 work in Laser mode?
-
@cosmowave this will not work because as more readings the sum gets as less the chance that the avg value comes close to the low value.
There should be something like a array with 10 values which are overwritten every 10 readings to get an reliable value.
-
@paulg4h Yes... you need more or less 10 readings of the low value. But is your flow detection that much time critical?
-
@cosmowave You add the current value to the sum variable all the time --> so after 100 readings you got the sum of them and calculate the average by the dvision of 100 reading, so the avg value gets higher and higher.
-
@paulg4h uups, there is an error in my code!
you need to reset the counter to 0 in the else construct! -
var.counter var.sum if var.counter < 10 set var.sum = {var.sum + "newValue"} set var.counter = var.counter + 1 else var.counter = 0 if {var.sum / var.counter} < 20 NO FLOW
-
@cosmowave once again an error
The reset should be after the if where you calculate the average! -
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
-
@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...
-
@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
-
@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.
-
@dc42 said in Connect a water flow sensor --> will M591 P7 work in Laser mode?:
16/3 revs/sec = 320 rpm.
Many thank's!
-
@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...
-
@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!"
-
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-rc3Many thank's!
-
@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-rc3Many 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.
-
@paulg4h is this now working properly for you using firmware 3.3 ?
-
Many thank's I updated today and now the RPM of the flow sensor is working perfectly without the variables!
-
@dc42
Is it possible to allow even lower rpm readings? My flowsensor gives 35rpm at minimum...