Giter VIP home page Giter VIP logo

flowsensor-arduino's Introduction

Water Flow Sensor Library Arduino

arduino-library-badge PlatformIO Registry GitHub release License

๐Ÿš€ 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 Type Code Pulse/Liter
YF-S201 YFS201 450
YF-B1 YFB1 660
OF10ZAT OF10ZAT 400
OF10ZZT OF10ZZT 400
OF05ZAT OF05ZAT 2174
OF05ZZT OF05ZZT 2174

โœจ Add New Sensor

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

๐Ÿ’ป Usages

See all 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 pin

FlowSensor Sensor(type, pin);

or if you sensor is not available in sensor list you can use pulse/liter sensor in type.

Sensor begin

param userFunc

void count()
{
    Sensor.count();
}

void setup()
{
    Sensor.begin(count());
}

Sensor Read

Sensor.read()

Count Pulse

Sensor.count()

Get Total Pulse

return total pulse

Sensor.getPulse()

Reset Pulse

set pulse value to 0

Sensor.resetPulse()

Get Flowrate (L/s)

return Flowrate (L/s)

Sensor.getFlowRate_s()

Get Flowrate (L/m)

return Flowrate (L/m)

Sensor.getFlowRate_m() 

Get Flowrate (L/h)

return Flowrate (L/h)

Sensor.getFlowRate_h() 

Get Total Volume (L)

return Volume (L)

Sensor.getVolume()

Reset Volume (L)

set volume value to 0

Sensor.resetVolume()

๐Ÿ›ก๏ธ License

This project is licensed under the MIT License - see the LICENSE 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.

flowsensor-arduino's People

Contributors

hafidhh avatar hjmhardsoft avatar maximebruelhart avatar nilbest avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

flowsensor-arduino's Issues

Question : where to find FlowMeter Pulse/Liter

May be stupid but I would like to know how do you know (or calculate) number of pulse by liter in your sensors definition

// Sensor Type
// -----------------------
// YF
#define YFS201	450
#define YFB1	660
// OF
#define OF10ZAT	400
#define OF10ZZT	400
#define OF05ZAT	2174
#define OF05ZZT	2174
//------------------------

Did you calibrated somewhere or measured it?

Looking at datasheet I can't find anywhere where is the number of pulse by liter.
YF-S201 datasheet does not mention anywhere.

Thanks

How can i have several volume or flow rate variables ?

My project is to make a flowmeter with different sessions (with a selector to measure the water consumption of different people).
I measure the flow of a session and I can switch to another.
So I need to have several volume or flow variables!
Example volume 1, volume 2 etc....
(with the pulse counter reset to zero each time I change session)
Do you know how to do this?
Thanks a lot ;)

Runtime configuration

Can you add dynamic configuration of the sensor type and pin?
Would like to have this in the setup before calling Sensor.begin()

Help me with waterflow sensor false data.

I am facing issues with the Waterflow sensor garbage data.
I need help with the following issue:

I am using ESP32, SIM800l, and YF-S401. The idea is to send water consumption data through mqtt protocol using sim800l.
I am getting almost accurate data sometimes, but sometimes getting random consumption values. If the sensor detached, the reading also shows random values.
Is there any interconnection between the hardware serial and digitalPinToInterrupt process?
By the way, I am also using the TinyGSM GSM library mentioned below:
https://github.com/vshymanskyy/TinyGSM

BUG Wrong Flow Data???

Describe the bug
I think there is a significant error somewhere in the Code.
But only to how to read the flow Data. I tested today the code with a 10L bucket. With a contestant flow in the bucked.
But the Flow Rate dropped significantly. My stopped time was around 54secs for the 10L bucked to fill up.
The Result shown on the serial Screen told me by using getFlowRate_s a Number constant lower than 0.00 and the number for l/min was also never peaking over 1.11.
The Flowrate was constantly dropping, witches seems auspices to me. (Because I only opened the valve in one go and I also closed it in one go)
However, the measurement of the Amount was quite accurate.

To Reproduce
Steps to reproduce the behavior:
Measure the FlowRate with a 10L Bucked and stop the time how long it will take to fill up.
Check the Time it took and how much it filled up and compare that with the Data the program Tells you...
Recalculate the flow rate with your measured Time and the amount the bucked is filled. Now you get your average flow Rate.

PicturesOf the Test Setup:
Setup_1
Setup_2

Pictures of what I measured:
Filled_Bucked_after_Time

Stopped_Time

What I calculated:
What_I_calcilated

Expected behavior
To get some Flowrate near my calculations...

Screenshots
My main.cpp void loop() Code I used for the fast test
Simple_Test_Code

How the test started:
Screenshot_Start

How the Test ended:
Screenshot_End

IDE and its version:

  • Arduino (2.1.0)
  • PlatformIO (3.4.4)

Device

  • Arduino Uno
  • YF-S201 FlowSensor

Implement DigitalRead in place of Interrupt

Hi guys,
Thanks for this Library, it's going to help a lot of us.
I have been struggling to have a proper working flow sensor program.
Most of the programs I have come across use attachInterrupt to get the flow sensor readings, however, I have not been able to use this specifically on Arduino Nano (I am using Pin 8), the work around to get the Flow Sensor reading is to use digitalRead.

Would it be worth it to have this implemented just to have the library have more flexibility.

Thanks and regards,
Abdalla

Reset Pulse to 0

Hello,

I am working on a project where I dispense a certain amount of liquid on a press of a button. The pump will pump as long as the flow meter has not reached the desired value. I got everything to work. But when I try to run again (unless I restart the Arduino), I am already above the value as the pulses are not reset.

I didn't find a function in the library and was wondering if that is something that we could implement?
Or am I missing something?

Regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.