Flow Meter Pulse Counting


mcowle

Recommended Posts

Hi,

I am a beginner with labjack and DaqFactory express.

I have a flow meter which produces a pulse output, which can be related to the total flow volume by a constant. I would like to use DaqFactory express with a U6 labjack to count and record the number of pulse over a set time period in order to determine the flow rate, although I haven't a clue where to begin

You input would be greatly welcome

Kind Regards

Link to comment
Share on other sites

First decide if you are going to count or time, as the U6 can do either:

http://forums.labjack.com/index.php?showtopic=1105

You described counting. Start by using the test panel in LJControlPanel to see if you can get the counter working there:

http://labjack.com/support/u6/users-guide/2.9

After you have it working in the test panel, then move on to DAQFactory:

http://labjack.com/support/ud/df-lj-app-guide/10

Link to comment
Share on other sites

What sort of frequency are you operating with? IE how often is you gas meter counting

For me I don't see counts very much, though I can get as high as 1 count per minute.

To avoid using a timer/counter channel I just connected my gas meter into an AIO port. My pulse is actually a switch that closes on the count. I have it set to increment when it sees the falling edge.

my code is really basic, enhanced by the help here:

if (DGM[1] - DGM[0] > 1 && DGM[1] > 4 
    DGM_Count++
endif

Normally my DGM voltage reading is -2.4 (labjack default). When the switch is closed it connects the AIO to the Vs source so I read ~5v. Once this drops off it returns to -2.4, though sometimes the reading catches it funny and will read like 2-3v before going back to steady state. This is why I just have the change in voltage to be 1v instead of something like 5.

Since I have it looking for a previous state of greater than 4, the only chance of not catching the edge is if it dropped from 5 to 4.0+ then dropped again to 3ish, never satisfying the 1v change. Though in my experiments this hasn't really occured. I had to add the additional safeguard instead of just having a voltage change only because noise in the system can generate >1v at times.

Link to comment
Share on other sites

You usually don't want to use a mechanical switch in a way that leaves the analog input pin floating. The "labjack default" as you put it is actually just the floating reading, which, for you at this instant, happens to be -2.4, however unless LabJack has some built in pull-down resistor I don't know about, which is entirely possible, that -2.4 is an unreliable reading. A better choice is to connect your analog input to ground through a 10K resistor. This is called a pull down resistor and pulls the input to 0V when there isn't another voltage on the pin. When the switch closes, it puts 5V on the pin, and a very small amount of current (use ohms law to figure out how much if you want) flows through the resistor. You should do this whether its an analog pin or a digital pin.

Also, note that you need to keep your readings somewhat slow, and your switch states long, otherwise you will need to introduce some sort of debounce, either in hardware or software. Technically, reading slowly with long switch states basically does debounce since the bounce is very rapid.

Link to comment
Share on other sites

  • 3 weeks later...

Archived

This topic is now archived and is closed to further replies.