Noob here. I am looking for some code so that my water flow sensor, after a certain quantity is met, will signal a solenoid to shut off the flow of water
what sort of “Water Flow Sensor” ??
In order for people to be able to help you as much as possible, we need to know what flow sensor you are using.
In general, however, you will get a flow rate, and from that you can simply use the fact that the quantity of water is given by the flow rate multiplied by the time.
So for instance, if the flow rate was 1 cubic centimeter per second, and you wanted to stop when 10 cubic centimeters had passed through, you would stop after 10 seconds.
If the flow rate is variable, it is slightly more tricky, but the idea would be to sample every small interval, and then multiply the average sampled flow rate before and after the interval by the interval, and then keep summing until you have got your desired quantity.
Hall effect flowmeter.
Here is what I found. so If I add a time statement to the end it should work? (flowrate / time)
water38skier: Here is what I found. so If I add a time statement to the end it should work? (flowrate / time)
check the pipe threads on the unit. Won't find anything to match in a US store.
Paul_KD7HB: check the pipe threads on the unit. Won't find anything to match in a US store.
pvc threaded fittings may work, might need thick thread tape. depends on your pressures. my sump has no restrictions so the pressures are low enough that they work fine.
Those devices are BSP. The 1/2" and 3/4" have the same diameter and pitch as NPT, but they do differ slightly in thread angle. This should not be a problem.
I adapted this http://www.freetronics.com.au/pages/jaycar-water-flow-gauge