Flow rate keeps climbing, or stays 0
- YF-S201 flow sensor
Why it happens
- The pulse count isn't set back to 0 each second.
- The signal wire isn't on an interrupt pin (2 or 3 on the Uno).
- Water flows against the arrow.
How to fix it
- Set the count to 0 after each calculation.
- Use pin 2 or 3 with
attachInterrupt(digitalPinToInterrupt(2), …). - Make the counter
volatile. - Follow the arrow on the sensor.
It worked if: A steady tap gives a steady number, and closing it gives 0.
Related errors
Tutorials where it can happen
From how the part works. Explained from how the part works; not tried on a real circuit for this page.
Didn't help? Search another error or ask us.

