How to get Water Flow Meter to record lpm to computer
-
This is the water flow meter I have. I'm trying to use it to record the LPM differences between different water pumps. The LPM varies, so I'd like to somehow connect something to get that continuous data listed in an excel sheet.
I have soldering and programming experience. I'm just wondering if this has been done before and if a code/ DIY already exists for it.
Thank you
-
I would be interested, too. I found just the sensor on Amazon and it looks like the meter is just timing the pulses per second. With a constant, one can determine the LPM You may be able to tap off of the sensor input, then through a resistor voltage divider make the output of the sensor compatible with your micro controller (Arduino). Using Processing on your computer you can capture the data from the Arduino.
Have fun!
OSD
-
You're amazing, thank you for replying!
-
You got me going, @mschro1! I just ordered a sensor and all the fittings needed to connect it through a hose. 5V minimum voltage may allowing it to work directly connected to an Arduino. I'm going to hook it all up to a hose and then run it into a bucket and measure the pulse width. (I suspect one pulse is 0.nnn liters. Count the pulses, time the how long it takes to fill the bucket, measure the water in the bucket and there's your constant.
If you tap off your flow meter to measure the flow rate, the measure the pulse width, you'll have your constant. c=LPM/60 / (duty cycle in minutes) Duty cycle is leading (trailing) edge to next leading (trailing) edge .... may not be a symmetrical square wave. (I got inspired and wrote this code for an Arduino. <50kHz)
C++ code: (off the top of my head)
void setup() {
Serial.begin(115200);
Serial.println(F("Frequency Measurement"));
}void loop () {
unsigned long timeStart;
uint16_t numberOfCycles=100;
uint8_t currentLevel = digitalRead(2); // get current state of input D2
uint8_t levelToMatch = currentLevel; // doesn't matter which edge.
uint16_t cnt = 0;
boolean blinkLED = false;
while (cnt < (numberOfCycles + 1) ) {
// look for transition
if (currentLevel != digitalRead(2)) {
digitalWrite(LED_BUILTIN,blinkLED=!blinkLED);
currentLevel = !currentLevel ;
if (currentLevel == levelToMatch )
// don't count first cycle because it might not be a full cycle
if (cnt++ == 0) timeStart = millis();
}
}
float timeOf_cnt_Cycles_mSecs= float(millis()-timeStart);
Serial.print(F("Duty Cycle: ")); Serial.print(timeOf_cnt_Cycles_mSecs,0); Serial.println(F(" mSec"));
// 1000 mSecPerSec / mSecPer100 cycles / 100cycles
float Hz = numberOfCycles / (timeOf_cnt_Cycles_mSecs/ 1000.0 );
Serial.print(F("Frequency: ")); Serial.print(Hz,1); Serial.println(F(" Hz"));
}
} // end of main loop
-
@mschro1
I really got inspired. I ordered a flowmeter and the plumbing to check it out. I wrote code that actually works.The 5V from the Arduino can drive the sensor. I'll be putting it all together this weekend.
My goal is to determine how much water I'm extracting from the seep on my property.
I'm having fun