8"_SKU__SEN0216 - jimaobian/DFRobotWiki GitHub Wiki
The Water Flow sensor measures the rate of a liquid flowing through it. The YF-S401 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 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!
- A 6 mm hose is recommended
- Avoid unit contact with corrosive chemicals
- The unit must be installed vertically, tilted no more than 5 degrees
- Liquid temperature should be less than 120 C to avoid damage to unit
- Inner Diameter: 4 mm
- Outside diameter: 7 mm
- Proof Water Pressure: <0.8 MPa
- Water Flow Range: 0.3-6 L/min
- Voltage Range: 5~12 V
- Operating Current: 15 mA (DC 5V)
- Insulation Resistance: >100 MΩ
- Accuracy: ±5% (0.3-3L/min)
- The Output Pulse High Level: >4.5 VDC (DC input voltage 5 V)
- The Output Pulse Low Level: <0.5 VDC (DC input voltage 5 V)
- Output Pulse Duty Ratio: 50% ± 10%
- Water-flow Formula: 1L = 5880 square waves
- Working Humidity Range: 35% ~ 90% RH (no frost)
- Dimension: 58*35*26 mm/2.28*1.37*1.02 inches
- Weight: 30g
---------------------------------------------------------- | |
|-------------------------------------------------------------|
| | |
|---------------------------------------------------------|
| | | | | |
|------------|-----------|----------|-----------------|
| **Number** | **Color** | **Name** | **Description** |
||
| 1 | Green | Signal | Pulse Signal |
| 2 | Red | VCC | 5~12V |
| 3 | Black | GND | GND | | | |
Pulse Signal
In this Tutorial, we'll measure liquid flow using this sensor.
-
Hardware
- DFRduino UNO R3
- Water flow sensor
- Jumper Wires
-
Software
- Arduino IDE, [https://www.arduino.cc/en/Main/Software| Click to Download Arduino IDE from Arduino®]
/***************************************************
This example reads Water flow sensor Sensor.
Created 2016-3-13
By berinie Chen <[email protected]>
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 http://www.dfrobot.com/wiki/index.php?title=Water_Flow_Sensor_-_1/8%22_SKU:_SEN0216
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 / 5880.0;
}
For any questions, advice or cool ideas to share, please visit the DFRobot Forum. |
CAD File shopping from dfrobot store or dfrobot distributor.