# Flow Sensor, pulse counter and calculation

Discussion in 'The Projects Forum' started by astro power, Oct 3, 2013.

1. ### astro power Thread Starter New Member

Sep 29, 2013
4
0
Hello Eveyone,

Nice to be here.

I need help with some ideas.

I have flow sensor, with output of 0.600 Pulse per second up to 50 Pulse per second.

Means output = 0.600Hz to 50.000Hz (0.001Hz Resulotion) (5V output).

I have 2 flow sensors, Flow sensor A and Flow sensor B.

I would like to calculate the Output of A less Output of B,
means if Flow sensor A = 32.450Hz, Flow sensor B = 27.755Hz
A-B = 32.340-27.755Hz = 4.695Hz output.

Do you have suggestions about do the subtraction between A and B?

Thank you

2. ### Sensacell Well-Known Member

Jun 19, 2012
1,183
276
Use a Micro-controller with a timer-capture engine, calculate the frequency and do the subtraction mathematically.

3. ### wayneh Expert

Sep 9, 2010
12,374
3,226
If you need to stay analog, I suppose you could use a frequency-to-voltage converter on each signal and then an op-amp to do the subtraction.

Since your signal is essentially digital already, I second the motion to use a microprocessor. If you want to avoid the learning curve, you could use a data acquisition device such as DataQ or LabJack and do the math on your PC.

Sep 29, 2013
4
0
Thank you !

Jun 22, 2012
5,143
768
6. ### astro power Thread Starter New Member

Sep 29, 2013
4
0
By op-amp, i think resulotion of 0.01Hz would be very difficult to distinguish.

I think about to handle this with Arduino Microprocessor .

Thank you.

7. ### GopherT AAC Fanatic!

Nov 23, 2012
6,303
4,020
If you have fairly constant flow, you could just run the through an AND gate logic chip. The output of the AND gate should be your difference. How often do you need to update/correct/record the information. What is this device used for and is 5 significant figure accuracy really required if you have a feedback loop for on-the-fly correction?

EDIT: SEE POST #10 below for correction on one possible method - this one has an error as Strantor points out in Post #8

Last edited: Oct 6, 2013
8. ### strantor AAC Fanatic!

Oct 3, 2010
4,302
1,989
How does that work? Wouldn't it depend on the pulse width ? What pulse width are you assuming? I'm thinking, if the pulse width were 1% of the period, the pulses would only coincide once in a blue moon. If it were 50%, well, I don't know, seems like the and gate would be on most of the time.

GopherT likes this.
9. ### Alec_t AAC Fanatic!

Sep 17, 2013
5,968
1,135
That will determine possible methods to use.

10. ### GopherT AAC Fanatic!

Nov 23, 2012
6,303
4,020
Strantor, you are right. I just fired this off without thinking too much. It is a beat frequency issue to calculate the difference.

The correct way to do this, is...

1) Run each signal through a flip-flop to make a square wave out of each

2) Run each flip-flop signal into an XOR gate

3) Run the XOR signal through a flip-flop (optional - depending on how the output is used).

Output frequency of the XOR (or optional third flip-flop) will be proportional to the difference. It will not be a square wave output. Running it through a flip flop will help but not completely

Still, the update/record/adjust period will determine which options are feasible.

strantor likes this.