Reading multiple sensors and reacting to their readings simultaneously (continuosly)

Hi all,

I have a project that requires using
Arduino mega,
a couple of pumps,
7 load cells and 7 HX711 modules (basically 7 weight scales)
that are supposed to run together and also when reached to a certain value react by sending a signal to switch off another thing (valve).

I have no problem with the basics, I just would like to see your opinions on how to approach this. And actually, is it doable? like I want to read all these cells at the same time (and continuously) and as soon as any one of them has reached the threshold I need to stop the valve that is connected to that specific load cell.

I looked at the HX711 library but I'm still confused with its concept.

I really need some input regarding how to approach this

Maybe pseudocode or just a few points would help.

Thanks in advance

What type of interface does this module use ?

Reading several things at the exact same time can be done as port readings for digital inputs.
For analog ports, not possible.

Am I understanding this correctly ? You don't need to read them at the same time, you want to read all them continuously and as soon as a certain weight is measured, then you want to close the corresponding valve.

We see "at the same time" as something different. It could mean doing multiple things within 1ns (1/1000000000 of a second).

While you cant read them at the EXACT same time, you can read them all in sequence in a very short time. That should be sufficient.

Yes exactly I need to read them continuously and the project I'm working with needs an instant reaction from the valve as soon as the desired weight has been achieved.

I'm not sure, but anyway here is a link and a picture

Yeah in fact i have thought about using millisec and keeping a little bit of gab between opening the valves and then adjusting my readings within this gab so that I can signal the valve closure while I still have time to read the next load cell before it had reached the desired weight.

HOWEVER, as I kept reading about the HX711-multi library, I'm somehow got convinced that it is possible to read multiple load cells at the same time, So, I need your opinions about this. Is it actually possible or I better go with my initial thought?

Any idea on how to do that?
I need to keep reading the 7 signals continuously and react as well

If you mention something, then please give a link to it.
This HX711-muli library ? https://github.com/compugician/HX711-multi

It reads multiple HX711 data pins and uses the same clock for all HX711 chips. It saves time, so it can be handy.

The rest is a matter of programming. You can start by putting the pins of the Valves in a array, and make an array for the HX711 data.

Yes, this is it

Thats nonsense; you need to think realistically about what you are asking. Weight does not change "instantly" even if you drop an elephant on a weigh scale. Valves dont open "instantly".
You need to assess how the "weight" is changing and how much error you can tolerate.
How long does it take to do a single reading on an HX711?

Agreed, But please note that the flow is quite slow so it kinda makes sense that the moment the load cell reads the desired weight I can switch off the valve and I can still have great accuracy.

Actually, I thought of timing the software, like, reading every valve every 0.05 second, and then when one of them has reached the desired weight I can just close the valve with an IF statement. However, I'm afraid this is going to result in a delay for, say, the last valve which will result in a big error there.

I have looked through the entire thread and I can find NO indication of how or when or why any of the valves gets turned on. Is this program a one-time process?
Paul

I will improve on the original post and add more info.

The valves are going to open be originally and then close accordingly and as we repeat the whole process we will cycle through that again.

7 * 0.05 sec = 0.35 sec. If you want a "smaller error" read the scales sequentially every millisecond. 7* 1 millisecond = 7msec.

You need to assess how the "weight" is changing. Its easy. What is the flow rate from the pump, and the density of the liquid?