Connect a water flow sensor --> will M591 P7 work in Laser mode?
-
@paulg4h
Thanks for sharing!
I'm just wondering, if there's a different way to code this (G4 P10)?
Eg. using a counter variable or iteration?
You can keep it like that, but if there's more code in daemon.g (for Lid control?) you don't want daemon.g to stick in a if-iteration with lots of G4. -
@o_lampe You are right, this is not perfect, maybe I found a better way without G4 P10 but for the lid control this doesn't matter because this is handled by triggers and works without G4
-
@paulg4h
I'm sure you know it already, just wanted to mention that daemon.g runs only every 10 seconds. So you already have a G4 P10 'incorporated'.
Just have to count, how many times in a row your sensors were outside of the zone. -
@o_lampe said in Connect a water flow sensor --> will M591 P7 work in Laser mode?:
@paulg4h
I'm sure you know it already, just wanted to mention that daemon.g runs only every 10 seconds. So you already have a G4 P10 'incorporated'.
Just have to count, how many times in a row your sensors were outside of the zone.G4 P10 waits for 10 milliseconds. G4 S10 would wait for 10 seconds.
To reduce the number of accesses to the SD card, it's best to use an explicit loop in daemon.g like this:
while true G4 S2 ... rest of code ...
This saves RRF from having to keep re-opening the file. You can change S2 to however many seconds you want to wait between tests.
-
@dc42 thanks for the input.
After changing of the daemon.g I am not able to update the file by DWC because it is now opened forever.
How can I update the daemon.g beside change the file on SD card now?
-
@paulg4h said in Connect a water flow sensor --> will M591 P7 work in Laser mode?:
@dc42 thanks for the input.
After changing of the daemon.g I am not able to update the file by DWC because it is now opened forever.
How can I update the daemon.g beside change the file on SD card now?
Rename the daemon.g file from DWC, then reset.
-
@dc42 Thank's again!
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.
What is the best in sort of functionality and use as low as possible resources in RRF?
-
Is there anybody who can show the best way to monitor such an sensor where the reading is not reliable on RRF 3.3?
Many thanks!
-
@paulg4h I think, it is a signal problem. Do you have an oscilloscope for checking the signal?
-
@cosmowave For me it looks like that RRF is not able to count the signal (rpm) because the DWC which pools the values every second shows as example 207 - 0 - 196 - 0 - 201 - 0 -198 - 0 so every two seconds I get zero.
How to use a variable to calculate a avg value to get a relieable value I can use to decide that the water flow is still there?
-
@paulg4h Eventually you can make a sum of e.g. 10 measurements of the value and take the average of these measurements. When the average is below a value (e.g. 20) then you have no flow.
It will be a littel slower, but i think, that is no problem...
-
@cosmowave so create 10 position variables and one counter and avg or is there a type of list /array available too?
How to create such a script that it uses as less ressources of the system as posible?There is an variable type of array but I have no clue how to assign a value or sum the values to get an AVG with the informations provided there.
-
@paulg4h or something like this in daemon.g
var.counter var.sum if var.zähler < 10 set var.sum = {var.sum + "newValue"} set var.counter = var.counter + 1 else if {var.sum / var.counter} < 20 NO FLOW
-
@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