Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Water Flow Sensor / Flow Meter Arduino Library, Flow Rate, Volume, YF-S201, YF-B1, OF10ZAT, OF10ZZT, OF05ZAT, OF05ZZT

License

NotificationsYou must be signed in to change notification settings

hafidhh/FlowSensor-Arduino

arduino-library-badgePlatformIO RegistryGitHub releaseLicense

🚀 Description

Arduino library for Flow Sensor

Volume Formula

$$Volume (L) = {Total Pulse \over Pulse/Liter}$$

Flow rate Formula

$$Q = {Frequency \over Pulse/Liter}60$$$$Q = {Pulse/Time \over Pulse/Liter}60$$

Q = Flowrate (Liter/minute)

🔥 Features

  • Get Volume in Liter
  • Get Flow Rate in Liter/Secound
  • Get Flow Rate in Liter/Minute
  • Get Flow Rate in Liter/hour
  • Count Pulse and get Value

✨ Tested Devices

  • Arduino Nano ATMega328P
  • NodeMCU ESP8266
  • NodeMCu ESP32
  • LGT8F328P (Logic Green)

💻 Installation

Using Library Manager

Arduino

At Arduino IDE, go to menu Sketch -> Include Library -> Manage Libraries...

In Library Manager Window, search "flowsensor" in the search form then select "FlowSensor".

Click "Install" button.

Platform IO

For PlatformIO IDE, using the following command.

Or at PIO Home -> Library -> Registry then search FlowSensor.

Manual Installation

For Arduino IDE, download zip file from the repository (Github page) by select Code dropdown at the top of repository, select Download ZIP

From Arduino IDE, select menu Sketch -> Include Library -> Add .ZIP Library....

Choose FlowSensor-Arduino-master.zip that previously downloaded.

🔥 Sensor

Sensor TypeCodePulse/Liter
YF-S201YFS201450
YF-S401YFS4015880
YF-B1YFB1660
YF-B1-SYFB1S1077
OF10ZATOF10ZAT400
OF10ZZTOF10ZZT400
OF05ZATOF05ZAT2174
OF05ZZTOF05ZZT2174

✨ Add New Sensor

If you want to add new sensor you can editFlowSensor_Type.h file in src and create pull request or you can use dynamic declaration.

💻 Usages

Seeall examples

Initialization

If your sensor is not available in sensor list you can use dynamic declaration by use sensor pulse/liter in type, example 450 for YF-S201.

#include<FlowSensor.h>uint16_t type = YFS201;// type : Sensor type or pulse/liter// uint16_t type = 450;uint8_t pin = D2;// pin : interrupt pinFlowSensorSensor(type, pin);

if you want to change sensor pin and sensor type you can use setPin and setType.
if you change the pin with setPin() you have to do sensor.begin() again

Sensor.setPin(pin);Sensor.setType(type);

Sensor begin

paramuserFunc
parampullup
if you have an external pull up you can set pull up to true

voidcount(){    Sensor.count();}voidsetup(){    Sensor.begin(count());}

Set Sensor Pin

parampin

Sensor.setPin(pin);

Set Sensor Type

paramtype

Sensor.setType(type);

Sensor Read

Sensor.read()

Count Pulse

Sensor.count()

Get Total Pulse

returntotal pulse

Sensor.getPulse()

Reset Pulse

set pulse value to 0

Sensor.resetPulse()

Get Flowrate (L/s)

returnFlowrate (L/s)

Sensor.getFlowRate_s()

Get Flowrate (L/m)

returnFlowrate (L/m)

Sensor.getFlowRate_m()

Get Flowrate (L/h)

returnFlowrate (L/h)

Sensor.getFlowRate_h()

Get Total Volume (L)

returnVolume (L)

Sensor.getVolume()

Reset Volume (L)

set volume value to 0

Sensor.resetVolume()

🛡️ License

This project is licensed under the MIT License - see theLICENSE file for details.

🙏 Support

We all need support and motivation. Please give this project a ⭐️ to encourage and show that you liked it. Don't forget to leave a star ⭐️ before you move away.

If you found the app helpful, consider supporting us with a coffee.

About

Water Flow Sensor / Flow Meter Arduino Library, Flow Rate, Volume, YF-S201, YF-B1, OF10ZAT, OF10ZZT, OF05ZAT, OF05ZZT

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Sponsor this project

  •  

Contributors7


[8]ページ先頭

©2009-2025 Movatter.jp