This is YF-S201 Water Flow meter Measurement Sensor with 1-30Leter/min Flow Rate in black colour. This sensor sits in line with your water line and contains a pinwheel sensor to measure how much liquid has moved through it. There’s an integrated magnetic hall effect sensor that outputs an electrical pulse with every revolution. The hall effect sensor is sealed from the water pipe and allows the sensor to stay safe and dry.
By counting the pulses from the output of the sensor, you can easily calculate water flow. Each pulse is approximately 2.25 millilitres.
Note this isn’t a precision sensor, and the pulse rate does vary a bit depending on the flow rate, fluid pressure, and sensor orientation. It will need careful calibration if better than 10% precision is required. However, it’s great for basic measurement tasks!
We have an example Arduino sketch(check the ATTACHMENTS tab) that is useful to quickly test the sensor; it will calculate the approximate flow of water in liters/hour. The pulse signal is a simple square wave so it’s quite easy to log and convert into liters per minute using the following formula.
Connection
Red wire : +5V Black wire : GND Yellow wire : PWM output
Features :
The simple and compact module.
Easy to Install.
High Sealing Performance.
High-Quality Hall Effect Sensor.
Package Includes :
1 x YF-S201 Water Flow meter Measurement Sensor with 1-30Liter/min Flow Rate – Black.
Pin Connections Table 1
Board Sensor Pin Connection YF-S201 Red/Black/Yellow 5-24V / GND / board interrupt-capable pin
YF-S201 Water Flow Measurement Sensor with 1-30Liter/min Flow Rate - Black - Arduino Uno
YF-S201 Water Flow Measurement Sensor with 1-30Liter/min Flow Rate - Black - Arduino Nano
YF-S201 Water Flow Measurement Sensor with 1-30Liter/min Flow Rate - Black - Arduino Mega
YF-S201 Water Flow Measurement Sensor with 1-30Liter/min Flow Rate - Black - ESP32
YF-S201 Water Flow Measurement Sensor with 1-30Liter/min Flow Rate - Black - ESP8266
YF-S201 Water Flow Measurement Sensor with 1-30Liter/min Flow Rate - Black - STM32
YF-S201 Water Flow Measurement Sensor with 1-30Liter/min Flow Rate - Black - Raspberry Pi Pico
1 //ekostra.com
2 //electronics store in egypt
3 //+201008896258
4
5 // Signal pin 2 on Arduino Uno (needs an interrupt-capable pin)
6 #define FLOW_PIN 2
7 volatile unsigned long pulseCount = 0 ;
8
9 void countPulse() { pulseCount++; }
10
11 void setup () {
12 Serial.begin (115200 );
13 pinMode (FLOW_PIN, INPUT_PULLUP);
14 attachInterrupt(digitalPinToInterrupt(FLOW_PIN), countPulse, FALLING);
15 }
16
17 void loop () {
18 delay (1000 );
19 noInterrupts();
20 unsigned long count = pulseCount;
21 pulseCount = 0 ;
22 interrupts();
23
24 float litersPerMin = count / 7.5 ; // YF-S201 datasheet: ~7.5 pulses per liter/min
25 Serial.print ("Flow: "); Serial.print (litersPerMin); Serial.println (" L/min");
26 }
1 //ekostra.com
2 //electronics store in egypt
3 //+201008896258
4
5 // Signal pin 2 on Arduino Nano (needs an interrupt-capable pin)
6 #define FLOW_PIN 2
7 volatile unsigned long pulseCount = 0 ;
8
9 void countPulse() { pulseCount++; }
10
11 void setup () {
12 Serial.begin (115200 );
13 pinMode (FLOW_PIN, INPUT_PULLUP);
14 attachInterrupt(digitalPinToInterrupt(FLOW_PIN), countPulse, FALLING);
15 }
16
17 void loop () {
18 delay (1000 );
19 noInterrupts();
20 unsigned long count = pulseCount;
21 pulseCount = 0 ;
22 interrupts();
23
24 float litersPerMin = count / 7.5 ; // YF-S201 datasheet: ~7.5 pulses per liter/min
25 Serial.print ("Flow: "); Serial.print (litersPerMin); Serial.println (" L/min");
26 }
1 //ekostra.com
2 //electronics store in egypt
3 //+201008896258
4
5 // Signal pin 2 on Arduino Mega (needs an interrupt-capable pin)
6 #define FLOW_PIN 2
7 volatile unsigned long pulseCount = 0 ;
8
9 void countPulse() { pulseCount++; }
10
11 void setup () {
12 Serial.begin (115200 );
13 pinMode (FLOW_PIN, INPUT_PULLUP);
14 attachInterrupt(digitalPinToInterrupt(FLOW_PIN), countPulse, FALLING);
15 }
16
17 void loop () {
18 delay (1000 );
19 noInterrupts();
20 unsigned long count = pulseCount;
21 pulseCount = 0 ;
22 interrupts();
23
24 float litersPerMin = count / 7.5 ; // YF-S201 datasheet: ~7.5 pulses per liter/min
25 Serial.print ("Flow: "); Serial.print (litersPerMin); Serial.println (" L/min");
26 }
1 //ekostra.com
2 //electronics store in egypt
3 //+201008896258
4
5 // Signal pin 27 on ESP32 (needs an interrupt-capable pin)
6 #define FLOW_PIN 27
7 volatile unsigned long pulseCount = 0 ;
8
9 void countPulse() { pulseCount++; }
10
11 void setup () {
12 Serial.begin (115200 );
13 pinMode (FLOW_PIN, INPUT_PULLUP);
14 attachInterrupt(digitalPinToInterrupt(FLOW_PIN), countPulse, FALLING);
15 }
16
17 void loop () {
18 delay (1000 );
19 noInterrupts();
20 unsigned long count = pulseCount;
21 pulseCount = 0 ;
22 interrupts();
23
24 float litersPerMin = count / 7.5 ; // YF-S201 datasheet: ~7.5 pulses per liter/min
25 Serial.print ("Flow: "); Serial.print (litersPerMin); Serial.println (" L/min");
26 }
1 //ekostra.com
2 //electronics store in egypt
3 //+201008896258
4
5 // Signal pin D5 on ESP8266 (needs an interrupt-capable pin)
6 #define FLOW_PIN D5
7 volatile unsigned long pulseCount = 0 ;
8
9 void countPulse() { pulseCount++; }
10
11 void setup () {
12 Serial.begin (115200 );
13 pinMode (FLOW_PIN, INPUT_PULLUP);
14 attachInterrupt(digitalPinToInterrupt(FLOW_PIN), countPulse, FALLING);
15 }
16
17 void loop () {
18 delay (1000 );
19 noInterrupts();
20 unsigned long count = pulseCount;
21 pulseCount = 0 ;
22 interrupts();
23
24 float litersPerMin = count / 7.5 ; // YF-S201 datasheet: ~7.5 pulses per liter/min
25 Serial.print ("Flow: "); Serial.print (litersPerMin); Serial.println (" L/min");
26 }
1 //ekostra.com
2 //electronics store in egypt
3 //+201008896258
4
5 // Signal pin PA1 on STM32 (needs an interrupt-capable pin)
6 #define FLOW_PIN PA1
7 volatile unsigned long pulseCount = 0 ;
8
9 void countPulse() { pulseCount++; }
10
11 void setup () {
12 Serial.begin (115200 );
13 pinMode (FLOW_PIN, INPUT_PULLUP);
14 attachInterrupt(digitalPinToInterrupt(FLOW_PIN), countPulse, FALLING);
15 }
16
17 void loop () {
18 delay (1000 );
19 noInterrupts();
20 unsigned long count = pulseCount;
21 pulseCount = 0 ;
22 interrupts();
23
24 float litersPerMin = count / 7.5 ; // YF-S201 datasheet: ~7.5 pulses per liter/min
25 Serial.print ("Flow: "); Serial.print (litersPerMin); Serial.println (" L/min");
26 }
1 //ekostra.com
2 //electronics store in egypt
3 //+201008896258
4
5 // Signal pin 3 on Raspberry Pi Pico (needs an interrupt-capable pin)
6 #define FLOW_PIN 3
7 volatile unsigned long pulseCount = 0 ;
8
9 void countPulse() { pulseCount++; }
10
11 void setup () {
12 Serial.begin (115200 );
13 pinMode (FLOW_PIN, INPUT_PULLUP);
14 attachInterrupt(digitalPinToInterrupt(FLOW_PIN), countPulse, FALLING);
15 }
16
17 void loop () {
18 delay (1000 );
19 noInterrupts();
20 unsigned long count = pulseCount;
21 pulseCount = 0 ;
22 interrupts();
23
24 float litersPerMin = count / 7.5 ; // YF-S201 datasheet: ~7.5 pulses per liter/min
25 Serial.print ("Flow: "); Serial.print (litersPerMin); Serial.println (" L/min");
26 }
Project Notes: Hall-effect water flow sensor - counts pulses proportional to flow rate.