Leak detection and pump shut-off using flow sensor,

Hello, I would like to detect any water flow rate through my water line that happens for extended periods using a flow meter/sensor, and have Arduino shut down my water pump if a certain time limit is reached. I have these simple logic steps but I don't quite know how to program it. I'm hoping it's fairly easy and that someone could possibly help with the code. Thank you in advance.

Command Loop: IF flow detected THEN start timer IF flow stops THEN stop and reset timer

Sub-Command: IF timer reaches 500 seconds THEN send signal to pump relay to shut off pump AND THEN end/pause/stop/sleep program

We generally require newbies to supply an attempt of their own and then assist with problems and improvements. We get too many people wanting us to do the project for them.

Read the information available under the Learning tab at top of this page.

Please put your code in its own window as seen in other posts. This can be done by placing     [code]  and [/code]  around the code or use the </> icon. This makes it easier for others to read.

How to use this forum

Weedpharma

The piece of code in this link should be adaptable to deal with your situation.

Also have a look at Planning and Implementing a Program

...R

first thing you need is the sensor.

get a sensor, find out how to read it. residential water meters typically do not have anything but dials and no means of getting electronic signal.

but, once you get a signal, the rest is pretty easy.