Go Down

Topic: Control a relay (Read 924 times) previous topic - next topic


I want to control the flow of current with a relay, so when the parameters received by the water flow sensor are equal to 0 or < a value, I want the relay to be in one position, letting the current flow, but when the value returned by the water flow sensor >= a certain value, I want the relay to switch to the other position.
How can I do this?
Thanks in advance!


First, you need to be able to read the water flow sensor value. Can you?

Next, you need to compare that value to a minimum and a maximum value. Can you do that?

Finally, you need to set a pin HIGH or LOW, depending on whether the comparison returned true or false. Do you know how to do that?

How much current does your relay require to open/close? Most draw more than the Arduino can provide.
The art of getting good answers lies in asking good questions.


If you're monitoring water flow, you may find you need to take average readings over a short period because it's unlikely to be smooth and uniform. You probably also want to apply some hysteresis to your threshold comparison so that the valve isn't flapping when the flow level is jittering around the threshold.

Go Up