Git Product home page Git Product logo

waterflow's Introduction

Description

Arduino library for Flow Sensor.

Flowrate Formula

The SensorConstant is different for different models.

$$Q = Frequency / SensorConstant$$

Q = Flowrate (Liter/minute)

Usages

initialization

#include <WaterFlow.h>

//SensorConstant is 65
WaterFlow waterFlow(PIN2, 65);

Sensor begin

param userFunc

void count() {
  waterFlow.pulseCount();
}

//The begin function must be called from the setup function
void setup() {
  waterFlow.begin(count);
}

Sensor Read

//The read function must be called from the loop function
void loop() {
  waterFlow.read();
}

Get Flowrate (L/m)

return Flowrate (L/m)

float getFlowRateOfMinute() 

Get Flowrate (mL/s)

return Flowrate (mL/s)

int getFlowRateOfSecond() 

Get Total Volume (mL)

return Volume (mL)

long getVolume()

Clear Total Volume

void clearVolume()

Determine if it is flowing

return true or false

bool isFlowing()

Start and stop the listener

void setListeners(void (*start)(void), void (*stop)(void));

Example

#include "WaterFlow.h"

WaterFlow waterFlow(PIN2, 65);

unsigned long beforeTime;

void count() {
  waterFlow.pulseCount();
}


//Make a sound when starting or stopping.
void buzz(){
   tone(3, 800, 500);
}

void setup() {
  waterFlow.begin(count);
  waterFlow.setListeners(buzz, buzz);

  Serial.begin(9600);
}

void loop() {
  waterFlow.read();

  if ((millis() - beforeTime) >= 1000){
    beforeTime = millis();

    if(!waterFlow.isFlowing()){
      waterFlow.clearVolume();
      return;
    }

    Serial.print(waterFlow.getFlowRateOfMinute());
    Serial.print(" L/m   ");

    Serial.print(waterFlow.getFlowRateOfSecond());
    Serial.print(" mL/s   ");

    Serial.print(waterFlow.getVolume());
    Serial.println(" mL");
  }
}

waterflow's People

Contributors

tobiyouth avatar

Stargazers

 avatar

Forkers

grace-5507

waterflow's Issues

Calibrating the sensor SF800 , Swissflow

Hi,
this is not an issue, but I don´t find any other way to contact the Author.
I have doubts about the formula for the constant.
According to documentation:


Q = Flowrate (Liter/minute)

and also

Q = frequency/constant


¿Could you please help me to calculate the Constant for my sensor for measuring a regular home keg with beer?

I'm confused about the formula.

In my case, my sensor is a SF800, Swissflow.
The documentation of my sensor goes like this:

flow rate = 0.5 - 20 l/min ,
k-factor= 5600 pulses/liter. Flow velocity*:
frequency Output frequency: 100 to 2000 Hz (depending on the flow velocity)

https://www.hemomatik.se/PDF/Datasheet_SF-800-3-8_2012_h.pdf

// My calculations
2.25 (this is my measured flow rate) = frequency/c

To calculate freq ... what function should I use?

Best regards

"

Get a parameter from internet request before setup

Hello,
here is my scenario. I want to do an HTTP request to get the "constant value" so I can set and calibrate the flow sensor remotely without the need of connecting the Arduino.

The problem is that according to documentation , WaterFlow waterFlow(PIN2, CONSTANT) must be called before the setup loop.
Since I can not define the count() function inside loop, I don´t see a way to get the constant value before setup.

void count() {
waterFlow.pulseCount();
}

Thanks in advance

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.