Gravity: Water Flow Sensor (1/2

SEN0217 Gravity: Water Flow Sensor For Arduino

Introduction

The Water Flow sensor measures the rate of a liquid flowing through it. The YF-S201 water flow sensor consists of a plastic valve body, flow rotor and hall effect sensor. It is usually used at the inlet end to detect the amount of flow. When liquid flows through the sensor, a magnetic rotor will rotate and the rate of rotation will vary with the rate of flow. The hall effect sensor will then output a pulse width signal. Connect it to a arduino microcontroller and you can monitor multiple devices such as your coffee maker, sprinkler or anything else, and control the water flow rate to suit your needs!

Specification

Board Overview

Number Color Name Description
1 Green Signal Pulse Signal
2 Red VCC 5~12V
3 Black GND GND

Pulse Signal

SEN0217 Gravity: Water Flow Sensor For Arduino Pulse Signal

Tutorial

In this Tutorial, we'll measure liquid flow using this sensor.

Requirements

Connection Diagram

SEN0217 Gravity: Water Flow Sensor For Arduino Connection Diagram

Sample Code

/***************************************************
 This example reads Water flow sensor Sensor.

 Created 2016-3-13
 By berinie Chen <bernie.chen@dfrobot.com>

 GNU Lesser General Public License.
 See <http://www.gnu.org/licenses/> for details.
 All above must be included in any redistribution
 ****************************************************/

/***********Notice and Trouble shooting***************
 1.Connection and Diagram can be found here  https://www.dfrobot.com/wiki/index.php?title=Water_Flow_Sensor_-_1/2%E2%80%B3_SKU:_SEN0217#Sample_Code
 2.This code is tested on Arduino Uno.
 ****************************************************/
volatile double waterFlow;
void setup() {
  Serial.begin(9600);  //baudrate
  waterFlow = 0;
  attachInterrupt(0, pulse, RISING);  //DIGITAL Pin 2: Interrupt 0
}
void loop() {
  Serial.print("waterFlow:");
  Serial.print(waterFlow);
  Serial.println("   L");
  delay(500);
}

void pulse()   //measure the quantity of square wave
{
  waterFlow += 1.0 / 450.0;
}

FAQ

Q&A Some general Arduino Problems/FAQ/Tips
A For any questions, advice or cool ideas to share, please visit the DFRobot Forum.

More

DFshopping_car1.png Get Gravity: Water Flow Sensor (1/2") For Arduino from DFRobot Store or DFRobot Distributor.

Category: Sensors & Modules > Sensors > Liquid Sensors

Turn to the Top