Anyone would like to assist with flow rate

Hello , I would like some assistance with my simple project , I am using scales for some fluid . I am measuring the weight using the HX711 device. I am having trouble trying to work out how I can detect flow rate as the fluid has a tube that varies in flow rate and can not have a flow meter attached. is there someone who can help with some formula or some steps I can work out how I can add flow rate either using the raw info from the scales in the project loss weight vs time as I am not sure if able in implement pulse as in time v loss .

Serial.print("read: \t\t");
Serial.println(scale.read()); // print a raw reading from the ADC

Serial.print("read: \t\t");
Serial.println(scale.read()); // print a raw reading from the ADC

Serial.println("Readings:");

// Read the initial weight
previousWeight = scale.get_units();
}

void loop() {
Serial.print("one reading:\t");
Serial.println(scale.read());

// For caluculating loss
// Read the current weight
weight = scale.get_units();

// Check if the weight is increasing
if (weight > previousWeight) {
isIncreasing = true;
} else if (weight < previousWeight) {
if (isIncreasing) {
// If it was increasing before, reset the total loss and change the state
totalLoss = 0;
isIncreasing = false;
} else {
// If the weight is not increasing, calculate the weight loss
totalLoss += (previousWeight - weight);
}
}

// Print the loss of weight

Serial.print(" kg\tTotal Weight Loss:\t ");
Serial.print(totalLoss);

// Update the previous weight
previousWeight = weight;

delay(5000);
}

/**
*basic weight system

this sketch will only read raw values

things to change is the pin outs.
*
**/

#include <Arduino.h>
#include "HX711.h"

// HX711 circuit wiring
const int LOADCELL_DOUT_PIN = 17;
const int LOADCELL_SCK_PIN = 16;

// VARIABLES

// Variables for weight measurement
float weight = 0;
float previousWeight = 0;
float totalLoss = 0;
bool isIncreasing = false;

HX711 scale;

void setup() {
Serial.begin(57600);
Serial.println("HX711 Demo");
Serial.println("Initializing the scale");

scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);

Serial.print("read: \t\t");
Serial.println(scale.read()); // print a raw reading from the ADC

Serial.print("read: \t\t");
Serial.println(scale.read()); // print a raw reading from the ADC

Serial.println("Readings:");

// Read the initial weight
previousWeight = scale.get_units();
}

void loop() {
Serial.print("one reading:\t");
Serial.println(scale.read());

// For caluculating loss
// Read the current weight
weight = scale.get_units();

// Check if the weight is increasing
if (weight > previousWeight) {
isIncreasing = true;
} else if (weight < previousWeight) {
if (isIncreasing) {
// If it was increasing before, reset the total loss and change the state
totalLoss = 0;
isIncreasing = false;
} else {
// If the weight is not increasing, calculate the weight loss
totalLoss += (previousWeight - weight);
}
}

// Print the loss of weight

Serial.print(" kg\tTotal Weight Loss:\t ");
Serial.print(totalLoss);

// Update the previous weight
previousWeight = weight;

delay(5000);
}

You mean that the tube varies in diameter? :thinking:

if the flow is continuous, the tube is full and whatever the flow rate, the weight will be the same : the weight of the tube + the weight of the fluid contained in the tube.

HI , the water flow varies , tube does not change , example about 100ml will flow over ten minutes and then stops then after an hour or so about another 100ml will flow , I am having trouble trying to work out how to calculate this .. I would like to calculate this on the scales when the measurement drops. maybe a average per hour or so.

Hi , the flow is not continuous. I have to use the HX711 weigh for the mass of fluid. as some times there is fluid coming out of tube I am looking for some help working out how to calculate flow rate with the loss of fluid via the scales.

does the tube have a constant section ?

(once the tube is full, the mass will be maximum and any change in the flow rate won't be detected)

you say

do you mean the tube is leaking ?

Hi , this is a fluid that needs to leak from the tube from time to time , I am trying to work out what the flow is. sometimes it can be around 5liters over a 48 hour period or 1 liter over a 48 hour period. its a purpose drain tube project. I am scratching my head how I can have readout on flow over 24 hours or ml per hour with the code I posted.

does the flow happen only because you leaked? ie the first 10 minutes you filled up the tube, then slowly the tube got empty or to a level it needed a refill ?

does the flow always stop when the tube is full or does the surplus leak ?

I'm still confused on the process.

As it's in the "willing-to-pay"-section of the forum: what's the budget?

On calculating the flowrate by measuring the leaking volume/h: not a good idea - the process is highly non-linear and most likely caotic.

Hi , imagine a tap at the bottom of the bucket , you fill the bucket , once and a while you open the tap water flows out and liquid pours out from the tap , you close the tap.. the difference water level , can water flow from the tap be calculated water from the tap via the scales ?

you can't know the water flow if you weight the bucket and it's full (the weight does not change regardless of the flow unless the leakage is not from the top of the bucket but a hole somewhere and you fill up not as fast as the fluid is going away).

I hope this helps. is there a calculation I can add to my code as above that when the water flows and the scales decrease raw value it can calculate , or something like previous raw value and new value a calculation over time. or add in a pulse that is time as there is no flow meter, something like liters per hour , ml per hour or something , I have been scratching my head for a solution.

If it's water flow, 1ml of water weighs very close to 1 gram, if you lose 750 grams in one hour, the average flowrate would be 0.75 liters per hour.

1 Like

if you know

  • the volume V of the tank in m3
  • the mass Me when the tank is empty in kg
  • the mass Mf when the tank is full in kg

Then you know that (Mf - Me) is the mass of V m3 of your fluid and thus the density is ρ = (Mf - Me) / V kg.m-3

now, if during ∆t (expressed in seconds) you measure a drop of mass ∆m you know that (∆m / ρ) m3 have gone away durint ∆t so your flow is (∆m / (ρ x ∆t)) m3s-1

1 Like

@J-M-L beat me to it by 5 minutes :wink:

What'd I say? :grin:

1 Like

ok thank you for your help , I will try add this to the above code somehow , I appreciate the input thanks,

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.