We've hooked up a Swissflow sf800 flow meter to our Arudino Uno. The system works, our interrupt callback is triggered and as water flows through the metre, it counts up. The issue is, that the pulse rate is supposed to be 5600/L and we get exactly double that, so we get 5600 per 500ml.

The code is:

if(millis() - lastTime >= 1000) 
  totalCount = pulseCount;
  lastTime = millis();

  if (totalCount >= 5600)
    // Here we have 500ml of water, not the expected litre....?

void InterruptCallback()

For sake of brevity, I've left out variable declarations and globals etc but the code is working as "expected". Is the pulse count not correctly counted in the interrupt callback? We're both fairly new to this, but it seems to be the way people have implemented it in other examples. If it helps, the interrupt is set to trigger on RISING.

Link to the flow meter and spec:



Interrupt code:

attachInterrupt(digitalPinToInterrupt(2), InterruptCallback, RISING);

The interrupt is being triggered and the count increases.

  • 2
    Without seeing the specs of your flow meter it's hard to answer. – Jabberwocky Nov 20 '18 at 8:18
  • 2
    And the initialization of the interrupt. – Mike Nov 20 '18 at 10:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy