sekdiy / flowmeter Goto Github PK
View Code? Open in Web Editor NEWArduino flow meter library that provides calibrated liquid flow and volume measurement with flow sensors.
License: MIT License
Arduino flow meter library that provides calibrated liquid flow and volume measurement with flow sensors.
License: MIT License
A possible solution could be to allow access to the internal pulse counter on a lower level and reducing the complexity of the tick()
call in order to shorten the code path.
Please help.. add support for this library to work on Stm32 Bluepil.. thanks
I’m using EKM flow meters for a project that use a reed switch for triggering the pulses from the wheel. It would be nice to be able to supply a debounce interval to work with reed switches over hall sensors.
Currently the flow meters can only be saved and restored partially (and only manually).
In applications that power down between measurements, users should be enabled to continue using a flow meter without losing prior measurement statistics and sensor properties.
In short: an improved serialize and unserialize capability that directly supports dynamically saving and restoring the full state of a flow meter.
Hi,
I review that exist a class FlowSensorCalibration() to change properties, but How can I use it??
How Can I change properties in the setup or loop??
How can I do it if I got 2 sensors?
I am having some trouble monitoring pumped volumes using .getCurrentVolume .
This is a section of my code that runs in a subroutine called from the loop as needed.
unsigned int targetTotal = Ml; //millilitres to be dispensed, Ml is passed when the dispense function is called.
flowMeter.reset();
double aliquot = 0;
while ((flowMeter.getCurrentVolume() * 1000) < targetTotal) { //*1000 to get Millilitres,,
flowMeter.tick(flowMeterPeriod); //flowMeterPeriod is 1000
aliquot = flowMeter.getCurrentVolume() * 1000;
lcd.setCursor(12, 3);
lcd.print(aliquot);
Serial.println(aliquot);
if (digitalRead(setPin) == LOW) { //hardware switch to cancel dispensing
break;
}
currentTime = millis();
if ((currentTime - startTime) > timeOut) { //Time-out function timeOut set by volume of requested dispense
lcd.setCursor(11, 3);
lcd.print("T");
timedOut = true;
break;
}
delay(flowMeterPeriod); // blocking behaviour ok in this function?
}
I expect to see the value of current volume in the variable "aliquot" incremented every second giving a total of the volume dispensed during this dispense cycle, after the reset instruction, ie counting from 0 up.
What I actually see is the volume dispensed in a second displayed every second and not incrementing. ie 5.1, 5.1, 5.3, 5.0 etc.
The totalVolume function works as anticipated and shows the total volume incremented by the dispensed volume at the end of the dispense function.
I am using an Arduino nano.
I've been stuck on this for a while but apologise for any stupidity on my own part in advance
I had to change the example slightly, and use digitalPinToInterrupt
, to make it work on ESP32 using arduino framework:
int pin = 21;
attachInterrupt(digitalPinToInterrupt(pin), TestSR, RISING);
// vs attachInterrupt(INT0, TestSR, RISING);
Very new to programming. Thanks for this great library, I used it to make a great flow rate meter with totalizer. I wanted to re build the sketch and compile it for use with a Huzzah esp8266 module and send data to my Adafruit Io panel.. I have successfully complete this task with other sensors, but the flowmeter.cpp file is throwing me for a loop. The .cpp file seems to drop many issues for the Esp8266 compiling. Adruino IDE 1.8.1
Any help would be appreciated. hopefully the code is attached.
/* hookup instructions::
Compiled for Arduino NANO V3.1 rebuilt for Adafruit Huzzah ESP8266
The meter were using is a FS300A
meter pins: Black to GND, Red to +5v, yellow or signal to D2
reset switch pins: one side of momentary switch to GND the other to D4
power in : gnd and + 5v
Displays: Adafruit .56" 7 segment displays with backpack. I2C
Display I2C pins: VCC - +5v, GND to gnd, SCL to A5 and SDA to A4 -------*/
// Libraries
#include <ESP8266WiFi.h>
#include "Adafruit_MQTT.h"
#include "Adafruit_MQTT_Client.h"
#include <Wire.h>
#include <Adafruit_GFX.h>
#include "Adafruit_LEDBackpack.h"
Adafruit_7segment matrix1 = Adafruit_7segment();
Adafruit_7segment matrix2 = Adafruit_7segment();
#include <FlowMeter.h>
// WiFi parameters
#define WLAN_SSID "***enter here*****"
#define WLAN_PASS "***enter here**********"
// Adafruit IO
#define AIO_SERVER "io.adafruit.com"
#define AIO_SERVERPORT 1883
#define AIO_USERNAME "**username**"
#define AIO_KEY "**user key**"
// define the sensor characteristics here
const double cap = 60.0f; // l/min
const double kf = 5.5f; // Hz per l/min
const int pin = 2; // INT0 pin on most Arduinos
const int ResetButton = 4; //pin that reset switch is attached to
int ResetNow;
// let's provide our own sensor properties (without applying further calibration)(FS300A)
FlowSensorProperties MySensor = {60.0f, 5.5f, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1}};
// now initialize the flow meter with the pin and sensor settings
FlowMeter Meter = FlowMeter(pin, MySensor);
// set the measurement update period to 1s (1000 ms)
const unsigned long period = 1000;
float FlowrateGallons = 0;
float VolumeGallons = 0;
// define an 'interrupt service handler' (ISR) for every interrupt pin you use
void MeterISR() {
// let our flow meter count the pulses
Meter.count();
}
// Functions
void connect();
void publish();
long time = 0;
long sendTime = 30000;
// Create an ESP8266 WiFiClient class to connect to the MQTT server.
WiFiClient client;
// Setup the MQTT client class by passing in the WiFi client and MQTT server and login details.
Adafruit_MQTT_Client mqtt(&client, AIO_SERVER, AIO_SERVERPORT, AIO_USERNAME, AIO_KEY);
// Setup feeds for publishing data totalgallons and flowrate
Adafruit_MQTT_Publish totalGallons = Adafruit_MQTT_Publish(&mqtt, AIO_USERNAME "/feeds/basement.total-gallons");
Adafruit_MQTT_Publish flowRate = Adafruit_MQTT_Publish(&mqtt, AIO_USERNAME "/feeds/basement.flow-rate");
/*************************** Sketch Code ************************************/
void setup() {
// Connect to WiFi access point.
Serial.println(); Serial.println();
delay(10);
Serial.print(F("Connecting to "));
Serial.println(WLAN_SSID);
WiFi.begin(WLAN_SSID, WLAN_PASS);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(F("."));
}
Serial.println();
Serial.println(F("WiFi connected"));
Serial.println(F("IP address: "));
Serial.println(WiFi.localIP());
// connect to adafruit io
connect();
pinMode(ResetButton, INPUT_PULLUP);
ResetNow = HIGH;
// prepare serial communication
Serial.begin(115200);
matrix1.begin(0x70);
matrix2.begin(0x72); // (0x74) if need be
// enable a call to the 'interrupt service handler' (ISR) on every rising edge at the interrupt pin
// do this setup step for every ISR you have defined, depending on how many interrupts you use
attachInterrupt(pin, MeterISR, RISING);
// sometimes initializing the gear generates some pulses that we should ignore
Meter.reset();
}
void loop() {
// ping adafruit io a few times to make sure we remain connected
if(! mqtt.ping(3)) {
// reconnect to adafruit io
if(! mqtt.connected())
connect();
}
// wait between output updates
delay(500);
// process the (possibly) counted ticks
Meter.tick(period);
// convert system variables to Gallons .264 gallon / litre
FlowrateGallons = (Meter.getCurrentFlowrate() / 3.78541178);
VolumeGallons = (Meter.getTotalVolume() / 3.78541178);
// output result to serial monitor for debugging
// uncomment next 2 lines to see results in serial monitor
//Serial.println("Currently " + String(Meter.getCurrentFlowrate()) + " l/min, " + String(Meter.getTotalVolume())+ " l total.");
//Serial.println("Currently " + String(FlowrateGallons) + " G/min, " + String(VolumeGallons)+ " Gal total.");
// if a preset time has elapsed then publish the data to adafruit io
if(millis() - time > sendTime) {
publish();
time = millis();
}
// print result to 7 segment display
matrix1.setBrightness(10);
matrix1.print(FlowrateGallons);
matrix1.writeDisplay();
delay(10);
matrix2.setBrightness(5);
matrix2.print(VolumeGallons);
matrix2.writeDisplay();
// reset button function, will reset meter if pressed
ResetNow = digitalRead(ResetButton);
if(ResetNow == LOW){
Meter.reset();
}
}
// Publish data to adafruit IO
void publish() {
if (! totalGallons.publish(VolumeGallons))
Serial.println(F("Failed to publish Total Gallons"));
else
Serial.println(F("Total Gallons published!"));
Serial.println(VolumeGallons);
if (! flowRate.publish(FlowrateGallons))
Serial.println(F("Failed to publish Flow Rate"));
else
Serial.println(F("Flow Rate published!"));
Serial.println(FlowrateGallons);
}
// connect to adafruit io via MQTT
void connect() {
Serial.print(F("Connecting to Adafruit IO... "));
int8_t ret;
while ((ret = mqtt.connect()) != 0) {
switch (ret) {
case 1: Serial.println(F("Wrong protocol")); break;
case 2: Serial.println(F("ID rejected")); break;
case 3: Serial.println(F("Server unavail")); break;
case 4: Serial.println(F("Bad user/pass")); break;
case 5: Serial.println(F("Not authed")); break;
case 6: Serial.println(F("Failed to subscribe")); break;
default: Serial.println(F("Connection failed")); break;
}
if(ret >= 0)
mqtt.disconnect();
Serial.println(F("Retrying connection..."));
delay(5000);
}
Serial.println(F("Adafruit IO Connected!"));
}
HERE are the error messages::::*******************
Arduino: 1.8.1 (Mac OS X), Board: "Adafruit HUZZAH ESP8266, 80 MHz, 4M (1M SPIFFS), v2 Prebuilt (MSS=536), Disabled, None, 115200"
Build options changed, rebuilding all
/Users/user/Dropbox/Personal/Arduino/libraries/FlowMeter-master/src/FlowMeter.cpp: In member function 'void FlowMeter::tick(long unsigned int)':
/Users/user/Dropbox/Personal/Arduino/libraries/FlowMeter-master/src/FlowMeter.cpp:41:31: error: 'SREG' was not declared in this scope
unsigned int interrupts = SREG; //!< save the interrupt status
^
/Users/user/Dropbox/Personal/Arduino/libraries/FlowMeter-master/src/FlowMeter.cpp:49:99: error: no matching function for call to 'min(unsigned int&, int)'
this->_currentCorrection = this->_properties.kFactor / this->_properties.mFactor[min(decile, 9)]; //!< combine constant k-factor and m-factor for decile
^
/Users/user/Dropbox/Personal/Arduino/libraries/FlowMeter-master/src/FlowMeter.cpp:49:99: note: candidates are:
In file included from /Users/user/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/xtensa-lx106-elf/include/c++/4.8.2/algorithm:62:0,
from /Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/cores/esp8266/Arduino.h:240,
from /Users/user/Dropbox/Personal/Arduino/libraries/FlowMeter-master/src/FlowMeter.cpp:7:
/Users/user/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/xtensa-lx106-elf/include/c++/4.8.2/bits/stl_algo.h:4226:5: note: template<class _Tp, class _Compare> _Tp std::min(std::initializer_list<_Tp>, _Compare)
min(initializer_list<_Tp> __l, _Compare __comp)
^
/Users/user/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/xtensa-lx106-elf/include/c++/4.8.2/bits/stl_algo.h:4226:5: note: template argument deduction/substitution failed:
/Users/user/Dropbox/Personal/Arduino/libraries/FlowMeter-master/src/FlowMeter.cpp:49:99: note: mismatched types 'std::initializer_list<_Tp>' and 'unsigned int'
this->_currentCorrection = this->_properties.kFactor / this->_properties.mFactor[min(decile, 9)]; //!< combine constant k-factor and m-factor for decile
^
In file included from /Users/user/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/xtensa-lx106-elf/include/c++/4.8.2/algorithm:62:0,
from /Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/cores/esp8266/Arduino.h:240,
from /Users/user/Dropbox/Personal/Arduino/libraries/FlowMeter-master/src/FlowMeter.cpp:7:
/Users/user/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/xtensa-lx106-elf/include/c++/4.8.2/bits/stl_algo.h:4221:5: note: template _Tp std::min(std::initializer_list<_Tp>)
min(initializer_list<_Tp> __l)
^
/Users/user/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/xtensa-lx106-elf/include/c++/4.8.2/bits/stl_algo.h:4221:5: note: template argument deduction/substitution failed:
/Users/user/Dropbox/Personal/Arduino/libraries/FlowMeter-master/src/FlowMeter.cpp:49:99: note: mismatched types 'std::initializer_list<_Tp>' and 'unsigned int'
this->_currentCorrection = this->_properties.kFactor / this->_properties.mFactor[min(decile, 9)]; //!< combine constant k-factor and m-factor for decile
^
In file included from /Users/user/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/xtensa-lx106-elf/include/c++/4.8.2/algorithm:61:0,
from /Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/cores/esp8266/Arduino.h:240,
from /Users/user/Dropbox/Personal/Arduino/libraries/FlowMeter-master/src/FlowMeter.cpp:7:
/Users/user/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/xtensa-lx106-elf/include/c++/4.8.2/bits/stl_algobase.h:239:5: note: template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
min(const _Tp& __a, const _Tp& __b, _Compare __comp)
^
/Users/user/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/xtensa-lx106-elf/include/c++/4.8.2/bits/stl_algobase.h:239:5: note: template argument deduction/substitution failed:
/Users/user/Dropbox/Personal/Arduino/libraries/FlowMeter-master/src/FlowMeter.cpp:49:99: note: deduced conflicting types for parameter 'const _Tp' ('unsigned int' and 'int')
this->_currentCorrection = this->_properties.kFactor / this->_properties.mFactor[min(decile, 9)]; //!< combine constant k-factor and m-factor for decile
^
In file included from /Users/user/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/xtensa-lx106-elf/include/c++/4.8.2/algorithm:61:0,
from /Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/cores/esp8266/Arduino.h:240,
from /Users/user/Dropbox/Personal/Arduino/libraries/FlowMeter-master/src/FlowMeter.cpp:7:
/Users/user/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/xtensa-lx106-elf/include/c++/4.8.2/bits/stl_algobase.h:193:5: note: template const _Tp& std::min(const _Tp&, const _Tp&)
min(const _Tp& __a, const _Tp& __b)
^
/Users/user/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/xtensa-lx106-elf/include/c++/4.8.2/bits/stl_algobase.h:193:5: note: template argument deduction/substitution failed:
/Users/user/Dropbox/Personal/Arduino/libraries/FlowMeter-master/src/FlowMeter.cpp:49:99: note: deduced conflicting types for parameter 'const _Tp' ('unsigned int' and 'int')
this->_currentCorrection = this->_properties.kFactor / this->_properties.mFactor[min(decile, 9)]; //!< combine constant k-factor and m-factor for decile
^
/Users/user/Dropbox/Personal/Arduino/libraries/FlowMeter-master/src/FlowMeter.cpp: In member function 'void FlowMeter::reset()':
/Users/user/Dropbox/Personal/Arduino/libraries/FlowMeter-master/src/FlowMeter.cpp:68:31: error: 'SREG' was not declared in this scope
unsigned int interrupts = SREG; //!< save interrupt status
^
exit status 1
Error compiling for board Adafruit HUZZAH ESP8266.
Currently the sensing and the metering functions are merged into one class/object, requiring users to deal with the complexity of the metering interface even if all they need is a simple flow rate value.
When connecting one or multiple sensors, users should have the choice between a lightweight interface to their hardware and a sophisticated metering solution.
I use a sensor fm-hl3012 in a coffee maker.
Here is the datasheet https://datasheet.lcsc.com/szlcsc/1912111437_EPT-TECH-FM-HL3012_C379915.pdf
Based on the datasheet, my settings are
FlowSensorProperties HL3012 = {0.50f, 76.0f, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1}};
Are the settings correct?
When I check the coffee maker without filters, the measurements are approximately correct.
When I insert the filter even without coffee. Measurements are approximately doubled.
Why such big differences in measurements?
Need a more accurate calibration?
Hello, recently I've tried to calibrate my YF-B5 sensor, but when I launch the program for calibration, I face two issues:
My sensor's properties at the beginning of calibration:
FlowSensorProperties MySensor = {30.0f, 6.6f, {0.4, 0.25, 0.2, 1, 1, 1, 1, 1, 1, 1}};
Sensor's datasheet (not sure if this this authenticate and really true, but the flow model is correct):
https://media.digikey.com/pdf/Data%20Sheets/Seeed%20Technology/114991175_Web.pdf
Thanks for the help.
Anyone using the YF-DN32 flow sensor ?
I can't find any reliable specs, some sites tell k=0.45*Q, other 4.5Q, other 0.45Q = l/m and so on
which one is the correct value ?
atm, i'm using the following:
FlowSensorProperties YF_DN32 = {120.0f, 0.45f, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1}};
but don't know if correct
Everything is fine while compiling for ESP8266 on the Arduino IDE.
Arduino IDE 1.8.5 reports warning:
WARNING: Category 'Device Control Sensors Sensor Measurement Liquid Water Flow Meter' in library FlowMeter is not valid. Setting to 'Uncategorized'
**Meter.reset() function not reset totalvolume counter
I'm wanting to use this library with the following meter:
https://www.flows.com/wm-pd-series-low-flow-water-meter/
https://www.flows.com/content/literature/Datasheets/WM-PD%20Datasheet%20V2.pdf
The datasheet states .05 pulses per gallon. I was looking at your docs, and I was wondering if that means the kFactor is 0.0881? 20 pulses per gallon or ~5.284 pulses per liter, divide by 60 and then I came to .0881. The datasheet does provide different error calculations for a few different flow rates. Is that something I need to add as well?
Thanks!
Description
there are a problem with the reset of meter i have a Yf s402 sensor i have make some calibration for it but it in first filling gives required quantity second it is wrong with minus
I tried to connect two flow meters on pins 2 & 3 of an Uno but it only shows the total for the first meter when polled using String(Meter1.getTotalVolume())
I used the simple example and set it up like this:
FlowMeter Meter1 = FlowMeter(2); FlowMeter Meter2 = FlowMeter(3);
Currently, most examples use the delay()
function to simulate time.
This is blocking behaviour which makes the examples short and concise, yet impractical.
When studying the examples and explanations, users should be enabled to schedule tasks without blocking behaviour while still being able to start their own project via copy-and-paste.
The calibration example actually provides non-blocking behaviour, but it is the most complex one to understand (and most users don't seem to use it as a baseline for their own work).
Wouldn't it make sense to clear getTotalVolume() either during the reset() method?
I wanted to calibrate the sensor but it's waaay to technical for me unfortunately.
The flow meter comes with this graph: http://www.microelectronicos.com/datasheets/UCTS0058.pdf
Could you tell me what a reasonable calibration value is based on this graph? Or does it not work like that?
Description
FlowMeter example Simple.ino does not compile for Nano 33 IOT (using pin 2 or 3) and MKR 1010 (using pin 4) boards.
Compiles/Verify correctly for Uno and Nano boards.
Reproduction
Steps to reproduce the behavior:
Detecting libraries used...
/Users/mack/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/arm-none-eabi-g++ -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10607 -DARDUINO_SAMD_NANO_33_IOT -DARDUINO_ARCH_SAMD -DCRYSTALLESS -D__SAMD21G18A__ -DUSB_VID=0x2341 -DUSB_PID=0x8057 -DUSBCON -DUSB_MANUFACTURER="Arduino LLC" -DUSB_PRODUCT="Arduino NANO 33 IoT" -I/Users/mack/Library/Arduino15/packages/arduino/tools/CMSIS/4.5.0/CMSIS/Include/ -I/Users/mack/Library/Arduino15/packages/arduino/tools/CMSIS-Atmel/1.2.0/CMSIS/Device/ATMEL/ -I/Users/mack/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/cores/arduino/api/deprecated -I/Users/mack/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/cores/arduino/api/deprecated-avr-comp -I/Users/mack/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/cores/arduino -I/Users/mack/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/variants/nano_33_iot /private/var/folders/5v/dc3kh_4136g2j560dgjg3vww0000gn/T/arduino/sketches/C68A8D46ABA33F055F35B22017641534/sketch/Simple.ino.cpp -o /dev/null
Alternatives for FlowMeter.h: [[email protected]]
ResolveLibrary(FlowMeter.h)
-> candidates: [[email protected]]
/Users/mack/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/arm-none-eabi-g++ -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10607 -DARDUINO_SAMD_NANO_33_IOT -DARDUINO_ARCH_SAMD -DCRYSTALLESS -D__SAMD21G18A__ -DUSB_VID=0x2341 -DUSB_PID=0x8057 -DUSBCON -DUSB_MANUFACTURER="Arduino LLC" -DUSB_PRODUCT="Arduino NANO 33 IoT" -I/Users/mack/Library/Arduino15/packages/arduino/tools/CMSIS/4.5.0/CMSIS/Include/ -I/Users/mack/Library/Arduino15/packages/arduino/tools/CMSIS-Atmel/1.2.0/CMSIS/Device/ATMEL/ -I/Users/mack/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/cores/arduino/api/deprecated -I/Users/mack/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/cores/arduino/api/deprecated-avr-comp -I/Users/mack/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/cores/arduino -I/Users/mack/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/variants/nano_33_iot -I/Users/mack/Documents/Arduino/libraries/FlowMeter-master/src /private/var/folders/5v/dc3kh_4136g2j560dgjg3vww0000gn/T/arduino/sketches/C68A8D46ABA33F055F35B22017641534/sketch/Simple.ino.cpp -o /dev/null
/Users/mack/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/arm-none-eabi-g++ -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10607 -DARDUINO_SAMD_NANO_33_IOT -DARDUINO_ARCH_SAMD -DCRYSTALLESS -D__SAMD21G18A__ -DUSB_VID=0x2341 -DUSB_PID=0x8057 -DUSBCON -DUSB_MANUFACTURER="Arduino LLC" -DUSB_PRODUCT="Arduino NANO 33 IoT" -I/Users/mack/Library/Arduino15/packages/arduino/tools/CMSIS/4.5.0/CMSIS/Include/ -I/Users/mack/Library/Arduino15/packages/arduino/tools/CMSIS-Atmel/1.2.0/CMSIS/Device/ATMEL/ -I/Users/mack/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/cores/arduino/api/deprecated -I/Users/mack/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/cores/arduino/api/deprecated-avr-comp -I/Users/mack/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/cores/arduino -I/Users/mack/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/variants/nano_33_iot -I/Users/mack/Documents/Arduino/libraries/FlowMeter-master/src /Users/mack/Documents/Arduino/libraries/FlowMeter-master/src/FlowMeter.cpp -o /dev/null
Generating function prototypes...
/Users/mack/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/arm-none-eabi-g++ -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10607 -DARDUINO_SAMD_NANO_33_IOT -DARDUINO_ARCH_SAMD -DCRYSTALLESS -D__SAMD21G18A__ -DUSB_VID=0x2341 -DUSB_PID=0x8057 -DUSBCON -DUSB_MANUFACTURER="Arduino LLC" -DUSB_PRODUCT="Arduino NANO 33 IoT" -I/Users/mack/Library/Arduino15/packages/arduino/tools/CMSIS/4.5.0/CMSIS/Include/ -I/Users/mack/Library/Arduino15/packages/arduino/tools/CMSIS-Atmel/1.2.0/CMSIS/Device/ATMEL/ -I/Users/mack/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/cores/arduino/api/deprecated -I/Users/mack/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/cores/arduino/api/deprecated-avr-comp -I/Users/mack/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/cores/arduino -I/Users/mack/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/variants/nano_33_iot -I/Users/mack/Documents/Arduino/libraries/FlowMeter-master/src /private/var/folders/5v/dc3kh_4136g2j560dgjg3vww0000gn/T/arduino/sketches/C68A8D46ABA33F055F35B22017641534/sketch/Simple.ino.cpp -o /private/var/folders/5v/dc3kh_4136g2j560dgjg3vww0000gn/T/4284101656/sketch_merged.cpp
/Users/mack/Library/Arduino15/packages/builtin/tools/ctags/5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives /private/var/folders/5v/dc3kh_4136g2j560dgjg3vww0000gn/T/4284101656/sketch_merged.cpp
Compiling sketch...
/Users/mack/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/arm-none-eabi-g++ -mcpu=cortex-m0plus -mthumb -c -g -Os -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD -DF_CPU=48000000L -DARDUINO=10607 -DARDUINO_SAMD_NANO_33_IOT -DARDUINO_ARCH_SAMD -DCRYSTALLESS -D__SAMD21G18A__ -DUSB_VID=0x2341 -DUSB_PID=0x8057 -DUSBCON "-DUSB_MANUFACTURER="Arduino LLC"" "-DUSB_PRODUCT="Arduino NANO 33 IoT"" -I/Users/mack/Library/Arduino15/packages/arduino/tools/CMSIS/4.5.0/CMSIS/Include/ -I/Users/mack/Library/Arduino15/packages/arduino/tools/CMSIS-Atmel/1.2.0/CMSIS/Device/ATMEL/ -I/Users/mack/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/cores/arduino/api/deprecated -I/Users/mack/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/cores/arduino/api/deprecated-avr-comp -I/Users/mack/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/cores/arduino -I/Users/mack/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/variants/nano_33_iot -I/Users/mack/Documents/Arduino/libraries/FlowMeter-master/src /private/var/folders/5v/dc3kh_4136g2j560dgjg3vww0000gn/T/arduino/sketches/C68A8D46ABA33F055F35B22017641534/sketch/Simple.ino.cpp -o /private/var/folders/5v/dc3kh_4136g2j560dgjg3vww0000gn/T/arduino/sketches/C68A8D46ABA33F055F35B22017641534/sketch/Simple.ino.cpp.o
Compiling libraries...
Compiling library "FlowMeter"
/Users/mack/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/arm-none-eabi-g++ -mcpu=cortex-m0plus -mthumb -c -g -Os -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD -DF_CPU=48000000L -DARDUINO=10607 -DARDUINO_SAMD_NANO_33_IOT -DARDUINO_ARCH_SAMD -DCRYSTALLESS -D__SAMD21G18A__ -DUSB_VID=0x2341 -DUSB_PID=0x8057 -DUSBCON "-DUSB_MANUFACTURER="Arduino LLC"" "-DUSB_PRODUCT="Arduino NANO 33 IoT"" -I/Users/mack/Library/Arduino15/packages/arduino/tools/CMSIS/4.5.0/CMSIS/Include/ -I/Users/mack/Library/Arduino15/packages/arduino/tools/CMSIS-Atmel/1.2.0/CMSIS/Device/ATMEL/ -I/Users/mack/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/cores/arduino/api/deprecated -I/Users/mack/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/cores/arduino/api/deprecated-avr-comp -I/Users/mack/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/cores/arduino -I/Users/mack/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/variants/nano_33_iot -I/Users/mack/Documents/Arduino/libraries/FlowMeter-master/src /Users/mack/Documents/Arduino/libraries/FlowMeter-master/src/FlowMeter.cpp -o /private/var/folders/5v/dc3kh_4136g2j560dgjg3vww0000gn/T/arduino/sketches/C68A8D46ABA33F055F35B22017641534/libraries/FlowMeter-master/FlowMeter.cpp.o
/Users/mack/Documents/Arduino/libraries/FlowMeter-master/src/FlowMeter.cpp: In constructor 'FlowMeter::FlowMeter(unsigned int, FlowSensorProperties, void ()(), uint8_t)':
/Users/mack/Documents/Arduino/libraries/FlowMeter-master/src/FlowMeter.cpp:18:83: error: no matching function for call to 'attachInterrupt(unsigned int&, void (&)(), uint8_t&)'
attachInterrupt(this->_pin, this->_interruptCallback, this->_interruptMode);
^
In file included from /Users/mack/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/cores/arduino/api/Interrupts.h:8:0,
from /Users/mack/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/cores/arduino/api/ArduinoAPI.h:29,
from /Users/mack/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/cores/arduino/Arduino.h:23,
from /Users/mack/Documents/Arduino/libraries/FlowMeter-master/src/FlowMeter.cpp:5:
/Users/mack/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/cores/arduino/api/Common.h:111:6: note: candidate: void attachInterrupt(pin_size_t, voidFuncPtr, PinStatus)
void attachInterrupt(pin_size_t interruptNumber, voidFuncPtr callback, PinStatus mode);
^~~~~~~~~~~~~~~
/Users/mack/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/cores/arduino/api/Common.h:111:6: note: conversion of argument 3 would be ill-formed:
/Users/mack/Documents/Arduino/libraries/FlowMeter-master/src/FlowMeter.cpp:18:69: error: invalid conversion from 'uint8_t {aka unsigned char}' to 'PinStatus' [-fpermissive]
attachInterrupt(this->_pin, this->_interruptCallback, this->_interruptMode);
~~~~~~^~~~~~~~~~~~~~
In file included from /Users/mack/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/cores/arduino/api/ArduinoAPI.h:29:0,
from /Users/mack/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/cores/arduino/Arduino.h:23,
from /Users/mack/Documents/Arduino/libraries/FlowMeter-master/src/FlowMeter.cpp:5:
/Users/mack/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/cores/arduino/api/Interrupts.h:38:27: note: candidate: template void arduino::attachInterrupt(pin_size_t, arduino::voidTemplateFuncPtrParam<T*>, PinStatus, T*)
template void attachInterrupt(pin_size_t interruptNum, voidTemplateFuncPtrParam<T*> userFunc, PinStatus mode, T* param) {
^~~~~~~~~~~~~~~
/Users/mack/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/cores/arduino/api/Interrupts.h:38:27: note: template argument deduction/substitution failed:
/Users/mack/Documents/Arduino/libraries/FlowMeter-master/src/FlowMeter.cpp:18:83: note: candidate expects 1 argument, 0 provided
attachInterrupt(this->_pin, this->_interruptCallback, this->_interruptMode);
^
In file included from /Users/mack/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/cores/arduino/api/ArduinoAPI.h:29:0,
from /Users/mack/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/cores/arduino/Arduino.h:23,
from /Users/mack/Documents/Arduino/libraries/FlowMeter-master/src/FlowMeter.cpp:5:
/Users/mack/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/cores/arduino/api/Interrupts.h:21:27: note: candidate: template void arduino::attachInterrupt(pin_size_t, arduino::voidTemplateFuncPtrParam, PinStatus, T&)
template void attachInterrupt(pin_size_t interruptNum, voidTemplateFuncPtrParam userFunc, PinStatus mode, T& param) {
^~~~~~~~~~~~~~~
/Users/mack/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/cores/arduino/api/Interrupts.h:21:27: note: template argument deduction/substitution failed:
/Users/mack/Documents/Arduino/libraries/FlowMeter-master/src/FlowMeter.cpp:18:83: note: candidate expects 1 argument, 0 provided
attachInterrupt(this->_pin, this->_interruptCallback, this->_interruptMode);
^
Using library FlowMeter at version 1.2.0 in folder: /Users/mack/Documents/Arduino/libraries/FlowMeter-master
exit status 1
Compilation error: exit status 1
Hardware (please complete the following information):
Software (please complete the following information):
Minimal example to reproduce (please complete the following information):
Additional context
Add any other context about the problem here.
Hi Sebastian,
thanks for your work to put this together.
I am running a hydroponic system in my office growing lettuce based on the Uno Wifi Rev2 with lots of sensors on it. I bought a flowmeter and was happy to find this library. It seems as if its not supporting the Uno Wifi Rev2. When trying to compile your sample sketch in the web editor or also desktop client, me and a friend got the same error on different computers. When we switch to older Arduino versions through Tools->Boards it works. We could not get it to work on our own. Would be great if you would consider supporting the Rev2 or if you could give a hint how to solve it :)
Best regards
Philipp
Hi,
First of all, thanks for the great work on this library! I had a question on sensor calibration in general, and I was hoping you could help since you have a lot of knowledge on this subject.
I'm trying to measure flow/consumption in my garden which uses drip irrigation. I'm using the following sensor on Amazon. I think the sensor has the same specs as the FS400A; however, the constant value is 4.8 on Amazon which I think is too high anyways (4.5 seems more reasonable).
I've hooked up a few flow meters on the supply line to try and verify the results of the sensor from Amazon. I also hooked in a digital flow meter as well in earlier tests.
Onto my question :) In 10 minutes, I see around 4.5 gallons consumed at the water flow meters; however, my Digiten sensor is only showing 1.2 gallons or so. I debugged the output, and I do see around 2 pulses per second which indeed equates to around 4.6L ~ 1.2gal.
If the Flow Meters are measuring flow accurately, it equates to 1.7 L/m which is within spec of 1-60; however, the error is so high! Is there something that I'm doing wrong? Is there a better sensor that yields more accurate results at low flow rates? Thanks so much!!
***EDIT
It's also possible that the sensor is reading a correct value while the other 2 flow meters are incorrect. I saw the Flows.com meter has a min of 6.6 GPH which is still within spec of the 1.2 GPM (7.2 GPH). If the Digiten is correct, then it's out of spec since that ends up being around 0.5L/m. Ahhh!
Description
I am using an 10mm flow sensor connected to a tap line, the water flow is controlled by the Tap, However the tap is supper sensitive and reaches its max in a 40% turn. The max flowrate i am able to record is 5.5L /pm. We are able to measure the the max flowrate by tweaking our K-factor as a start, hence the nominal is just right, then i go about measuring different flowrates for the mfactor values. We have now 7 intervals ( 7 M-factors values, we start with 1 for all 10 Mfactor values and do actual/nominal to the right mfactor values )
How do we decide which interval value should correspond to the M factor value ?
When we put the first 6 values as we have and 1 for remaining, its not giving us right output.
We tried different combinations, its no results. What would be the logic behind how we place the Mfactor values ?
I am able to get the updated values, but dont know how to how place them correctly in the Mfactor String.
Could anyone perhaps shed some light on this ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.