Showing results for 
Search instead for 
Did you mean: 

Reading Digital Pulses from a Flowmeter

I have a flowmeter that puts out 0 to 5 VDC pulses and has a calibration factor of 50.99 pulses per CC. I do not have a counter card, but have a digital input card and an Analog Input card.

What will be accurate method to read these pulses from the flowmeter?
0 Kudos
Message 1 of 9
What input cards do you have? The sample rates vary widely from model to model.

You said ~51 pulses per CC, but what is the maximum flow rate you need to measure?

What make and model of flow meter are you using?

It may be a simple matter of reading the inputs faster than the pulses. As an example, 50 pulses per CC, at a flow rate of 100CC/sec would be 5000 pulses/sec, or 5kHz. If you use the rule of thumb of 10x the frequency, you'd need to sample at 50kHz. This is just an example.

0 Kudos
Message 2 of 9
The cards that I have are NI 9206 and NI 9425.

If I want to count the number of pulses I get from the flowmeter in 1 sec, I would need a trigger that is a window of 1 sec, and start acquiring the pulses from the flowmeter at the rising edge of the trigger and stop at the falling edge of the trigger. then count the number of edges I get. And this process should be continuous.

How do I do this? How do I count the edgesin the window? My problem is that I do not have a counter card. Can this be done without using a counter card? Can you please provide ax example VI?

0 Kudos
Message 3 of 9

To count the pulses coming from the flow meter, I am trying to use the Basic Level Trigger Detection VI. The VI that I have developed is attached with this post.

I am using a modified version of the Basic Level Trigger Detection VI that I found on this Discussion forum. I tested the VI with a simulated square wave signal and it works very fine. But when I try to read the signal from the flow meter, the trigger count keeps resetting, i.e. I see values like 50, 56, 58, 49, 52, 54, 56, 58, 40 ...etc.  I could not find out the reason why this was happening.

My main aim is to read the number pulses coming from the flow meter and calculate the flow rate in grams/min. Any help in achieving this will be greatly appreciated.

The details about the flow meter are as follows:
Manufacturer: DEA Engineering
Web site:
Calibration Factor: 51 pulses per CC.

0 Kudos
Message 4 of 9
The Detect All is not included, so I cannot tell what it is doing.

Several things may affect your results.

1. It appears that you have the DAQ assistant set to sample at 250,000 samples per second and to acquire 100,000 samples. It creates the task, configures the timing, acquires data, stops and clears the task on every iteration of the loop. The only part which needs to be inside the loop is the acquire data part. All the rest should be outside the loop. You can open up the DAQ Assistant and pull the parts out to do this.

2. The samples you acquire take about 0.4 seconds but you have a 1 second elapsed time test in the loop. It appears that you are only looking at about 40% of the data available because you do not accumulate the data while waiting for the elapsed time.

3. The Detect All Triggers boolean output which connects to the case structure where Counter is updated only allows Counter to increment once pper iteration of the while loop, maximum, regardless of the number of pulses detected in the dataset. Unless you never get more than one pulse in 400 ms Counter cannot accurately represent the number of pulses produced by the flowmeter.

4. Get rid of the local variables. The are not needed and often contribute to race conditions.

5. Learn about dataflow. The "initialization" of the chart history and local variables at the left of the diagram could occur after the while loop has started or even completed. The sequence structure in the True case is probably not needed either. Shift registers are your friend

0 Kudos
Message 5 of 9


Thank you very much for your reply.

I am attaching the Detect All trigger VI with this post. Please take a look at it and let me know why it keeps re-setting the count.

Meanwhile I replace the DAQmx Express VI with the individual VIs and see if works better for me.

If the Detect All trigger VI can give me an accurate count of the triggers I will not need the counter that is incremented using the Boolean output of the VI.

I will also make the other changes suggested by you.


0 Kudos
Message 6 of 9
Hi Controls_Engineer,

Is it necessary to know the counts of the flow meter during your acquisition? In otherwords: can you acquire the data, then determine how many pulses occured afterwards? Doing this will greatly reduce the complexiity of your program. You could simply set up a control loop to handle your data acquisition and write the data to a file, which can the be loaded in a later loop to detect how many pulses occured.

Please post if you have any questions. Have a great day!
Ryan D.
District Sales Manager for Boston & Northern New England
National Instruments
0 Kudos
Message 7 of 9

Do you have a newer version of your vis

0 Kudos
Message 8 of 9

hope this helps. You would need to change the "the flow meter tooth volume constant".

0 Kudos
Message 9 of 9