About the Project
YFS201 Water Flow Sensor
The Water Flow sensor has 3 different wires RED, YELLOW, and BLACK as shown in the figure below. The red wire is generally utilized for supply voltage which ranges from 5V to 18V and the black wire is attached to GND. The yellow wire is utilized for the output, which can be read by an MCU.
The water flow sensor contains a pinwheel sensor that estimates the quantity of liquid that has passed through it.
The water flow sensor basically operates on the principle of hall effect. The water flow sensor is combined with a magnetic hall effect sensor, which produces an electric pulse with every strike.
Working of Project:
In this project, we attached the water flow sensor to a pipe. If the output valve of the pipe is terminated, the output of the water flow sensor is zero that means no pulses. And If the output valve of the pipe is opened. The water runs via the sensor, which in turn revolves around the wheel inside the sensor. In this situation, we can see pulses, which are produced from the sensor.
These pulses basically will work as an interrupt signal to the Arduino UNO.
The current time and loop time variable assure that for every one second the value of the flow_frequency is utilized for calculation of flow rate and volume. Once the calculation is completed, the flow_frequency variable is set to zero and the complete procedure is originated from the beginning.