Yes I use this sensor in my Garden Watering system.
Check out my project here: Release Minor fixes and remove SimpleTimer · jaminNZx/Garduino-ESP-Blynk · GitHub
The code you need is here: https://github.com/jaminNZx/Garduino-ESP-Blynk/blob/v0.1.5/functions.h#L48
TL:DR
void setup(){
// ... insert in to setup
// FLOW METER
pulseCount = 0;
flowRate = 0.0;
flowMilliLitres = 0;
totalMilliLitres = 0;
attachInterrupt(FLOW_SENSOR, pulseCounter, FALLING);
// start the timer
timer.setInterval(1000, flowSensor);
// ...
}
/**************************************************************
Flow Sensor
**************************************************************/
/*
pulseCounter() -
- attached to an interrupt counting the pulses from the sensor then used to calculate the rate
*/
void pulseCounter() {
pulseCount++;
}
/*
flowSensor() -
- uses interrupt on the sensor pin
- calculates the flowRate in mL/s then converts to L/s
- update Blynk virtual pins with the data
- calculate and compile the water cost based on the price set in settings and usage
- calculate and compile the monthly water cost and usage
*/
void flowSensor() {
detachInterrupt(FLOW_SENSOR);
flowRate = pulseCount / FLOW_CALIBRATION;
pulseCount = 0;
attachInterrupt(FLOW_SENSOR, pulseCounter, FALLING);
//calc totals
flowMilliLitres = (flowRate / 60) * 1000;
totalMilliLitres += flowMilliLitres;
totalMilliLitres_month += flowMilliLitres;
Blynk.virtualWrite(vPIN_WATER_TOTAL, (float)totalMilliLitres / 1000);
Blynk.virtualWrite(vPIN_WATER_FLOW, String((float)flowMilliLitres, 0));
Blynk.virtualWrite(vPIN_WATER_TOTAL_MONTH, (float)totalMilliLitres_month / 1000);
waterCost = waterCost + ( ( ( (float)flowMilliLitres / 1000 ) * WATER_PRICE ) / 100);
Blynk.virtualWrite(vPIN_WATER_COST, String(waterCost, 6));
waterCost_month = waterCost_month + ( ( ( (float)flowMilliLitres / 1000 ) * WATER_PRICE ) / 100);
Blynk.virtualWrite(vPIN_WATER_COST_MONTH, String(waterCost_month, 6));
}