Running Total calculated from flow rate

robtillaart:
when integrating the sum values become larger and you might consider using unsigned longs for

volatile int NbTopsFan; //measuring the rising edges of the signal

An int wraps at 32767 pulses
An unsigned int at 65535
An unsigned long at 4 billion++ pulses

An unsigned long has 10 digits of precision where floats have around 7 d.o.p.

probably why when I got home from dinner the total had creeped up even though there was no flow.
Ill give your way a shot.
thanks!