Interfacing Water Flow Sensor with Raspberry Pi 3 🚿 🎯 Objective To measure the flow rate of water using a Water Flow Sensor (YF-S201) and Raspberry Pi 3. Useful in smart irrigation and water management systems. 🧰 Components Required Component Quantity Raspberry Pi 3 1 YF-S201 Water Flow Sensor 1 10K Pull-down Resistor 1 Jumper Wires As required Breadboard 1 ⚡ Circuit Connections Sensor Pin Connect To Red (VCC) 5V (Raspberry Pi) Black (GND) GND (Raspberry Pi) Yellow (Pulse Out) GPIO18 (Pin 12) with pull-down resistor 🧠 Python Code import RPi.GPIO as GPIO import time FLOW_SENSOR = 18 pulse_count = 0 def countPulse(channel): global pulse_count pulse_count += 1 GPIO.setmode(GPIO.BCM) GPIO.setup(FLOW_SENSOR, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) GPIO.add_event_detect(FLOW_SENSOR, GPIO.FALLING, callback=countPulse) try: while True: pulse_count = 0 time.sleep(1) flow_rate = (pulse_count / 7.5) ...
TECH KEEDA
|LEARN | EXPLORE | INNOVATE | I.O.T | A.I | ROBOTICS |