Multiple Flow Sensors on interrupt pin

Hi. I would like to ask if it is possible to connect multiple sensors in a single pin in an arduino, given that I will only be using it one at a time. I have an arduino nano and I am planning on using 4 flow sensors. I just found out that it uses hall effect, thus the need for interrupts so that it can immediatly detect the change in signal. But the uno/nano only has 2 interrupt pins so I plan on paralleling 2 sensors in one pin, similar to the drawing attached. A signal diode will be placed between the pin and sensors so that the signal of one sensor wont go to the other, hoping that the voltage drop wont affect the signal too much. Is it possible? Thank you very much in advance.

Screenshot 2021-08-16 145127

Without know more details it is not possible to say whether this is true or not

How about using pin change interrupts ?

Oh. Sorry. I will be using a YF-S402 flow sensor.

Oh. yes! Thats a great suggestion! I was able to do that a long time ago with a sensored bldc motor using also hall effect sensors. I forgot about it. Thank you very much!

Do you will make the dedection of the event only, or do you will make a measurement of the transport volumen?

I will be using in measuring the volume.

This looks like the data sheet for the sensor:

Apparently, depending on the flow rate, it gives up to 100 pulses per second (100Hz)

Try this sketch and study the coding.
I love the usage of arrays and structs. The sketch is scanning three input pin with update rate of 100hz and act on changes. You may have to modify to four pin very easy.
DonĀ“t hesitate to ask in case of questions.

#define ProjectName "Multiple Flow Sensors on interrupt pin w/o interrupt"
// you may need to change these constants to your hardware
const byte Input_[] {A0, A1, A2};
enum {FS1, FS2, FS3};
struct FLOWMETER {
  int name;
  byte pin;
  bool state;
  float flowRatePerPulse;
  float counter;
  String text;
} flowmeters [] {
  {FS1, Input_[FS1], 1, 0.02, 0.0, "Flowmeter 1 "},
  {FS2, Input_[FS2], 1, 0.02, 0.0, "Flowmeter 2 "},
  {FS3, Input_[FS3], 1, 0.02, 0.0, "Flowmeter 3 "},
void setup() {
  Serial.print(F("File   : ")), Serial.println(__FILE__);
  Serial.print(F("Date   : ")), Serial.println(__DATE__);
  Serial.print(F("Project: ")), Serial.println(ProjectName);
  for (auto Input : Input_) pinMode(Input, INPUT_PULLUP);
void loop () {
  unsigned long currentTime = millis();
  digitalWrite(LED_BUILTIN, (currentTime / 500) % 2);
  static unsigned long flowMeterMillis;
  const unsigned long flowMeterduration {10};
  if (currentTime - flowMeterMillis >= flowMeterduration) {
    flowMeterMillis = currentTime;
    for (auto & flowmeter : flowmeters) {
      bool stateNew = digitalRead(;
      if (flowmeter.state != stateNew) {
        flowmeter.state = stateNew;
        if (!stateNew) {
          flowmeter.counter += flowmeter.flowRatePerPulse;
          Serial.print(flowmeter.text),  Serial.println(flowmeter.counter);

Have fun and enjoy coding.