Tutorial: Reading Water Flow rate with Water Flow Sensor

Hello,

I have a flow meter and have everything wired up to an arduino uno. the signal is coming in at digital port 4. my problem is that when i power the arduino and upload the code, without having the pump on i get values like 520, 512 etc. I am testing the system with a small fish tank pump and when i turn it on, i now get values like 240, 304, 248 etc.



Three questions,

1)why am i getting 520 when there is no water flowing through the meter? I would expect this to be zero not a value like 520

2)Why do values vary so much on every sample? i can see 224, 280, 356, 404, 232,288 etc when the pump is just pumping the same amount more or less.

3)In the sample code the equation is



Calc = (NbTopsFan * 60 / 4.5); // (Pulse frequency x 60) / 4.5Q, = flow rate in L/hour



but in the comments above, it seems that the 4.5 suppose to be 7.5. Which one is correct?



Thanks