Want to calculate mass flow with weight sensor (logic understanding)

Hi there!

I have a nice setup for my arduino nano, with a HX711 weight sensor + loadcell.

So my setup there is a container on the loadcell.
By hand I am pouring water into the container, and I want to know, how fast am I pouring.

I’m thinking of this:

qv = dm/dt

but I don’t know how to program it.

My main question is not the code, but how to start to think.
IMO I need to know how much mass is pouring in given time. Right? My brain is overloaded :confused:

Thanks in regard

My main question is not the code, but how to start to think.

The millis() function returns the number of milliseconds since the Arduino was powered up or reset. With that in mind you could do something like the following

  save millis() value as start time
  while the weight is less than the target
    pouring rate = current weight / (current millis() - start time)
  end while

I'm curious why you are trying to measure the flow rate using such a crude setup. What value will the results have?

what does the (current millis() - start time) restore in theoretical meaning?

is this how I can make dt?

Sorry if I'm hard to understand, I'm new to this, and have only physics knwoledge :smiley:

XenoBen:
IMO I need to know how much mass is pouring in given time. Right?

Or, how much time it takes to pour a given mass.

Which you use depends on things like how fast mass is changing, how often you want to update the computed mass flow rate, and how close you want the computed mass flow to be to the INSTANTANEOUS rate verses the AVERAGE rate.

PaulS:
I'm curious why you are trying to measure the flow rate using such a crude setup. What value will the results have?

:D:D:D Thanks :smiley:

I know it's a crude setup, but it's a subtask of a scale. I cannot use flow rate sensors.

results are in [g/sec]

gfvalvo:
Or, how much time it takes to pour a given mass.

Which you use depends on things like how fast mass is changing, how often you want to update the computed mass flow rate, and how close you want the computed mass flow to be to the INSTANTANEOUS rate verses the AVERAGE rate.

hmmm, yes I don't know right now if the instantaneous is better or the average :confused: I need to test the two to see which is better for understanding what's happening

So I need to store 2 mass information so I can get the dm.

dm= m2-m1

where m2 = is current weight
and m1 = starting weight

just i don't know how to store these.

what does the (current millis() - start time) restore in theoretical meaning?

It gives you the time in milliseconds that pouring has been taking place.

just i don't know how to store these.

Why don't you?

  double m1 = 0.0;

void loop()
{
   double m2 = readWeightFromScale();

   double dm = m2 - m1;

   m1 = m2;
}

With the change in mass known, and knowing when you got this reading vs. when you got the last one, you have dm and dt, so you can calculate the flow rate.

Post your code. Read how-to-use-this-forum to discover the correct method for that.

PaulS:
Why don't you?

  double m1 = 0.0;

void loop()
{
  double m2 = readWeightFromScale();

double dm = m2 - m1;

m1 = m2;
}




With the change in mass known, and knowing when you got this reading vs. when you got the last one, you have dm and dt, so you can calculate the flow rate.

Ah thanks, I'm really new to programming, this is why, but thank you.