Jump to content


Photo

Flow Meter Pulse Counting


  • Please log in to reply
6 replies to this topic

#1 mcowle

mcowle

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 13 August 2012 - 02:29 PM

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

#2 LabJackSupport

LabJackSupport

    Advanced Member

  • Members
  • PipPipPip
  • 248 posts

Posted 14 August 2012 - 11:11 AM

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

http://forums.labjac...?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/s...users-guide/2.9

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

http://labjack.com/s...lj-app-guide/10

#3 mkelly

mkelly

    Member

  • Members
  • PipPip
  • 19 posts

Posted 14 August 2012 - 11:48 AM

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.

#4 AzeoTech

AzeoTech

    Guru

  • Administrators
  • PipPipPipPipPip
  • 4532 posts

Posted 14 August 2012 - 11:54 AM

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.

#5 mkelly

mkelly

    Member

  • Members
  • PipPip
  • 19 posts

Posted 16 August 2012 - 09:04 AM

Thanks for the resistor idea. Cleaned up the signal perfectly.

#6 mcowle

mcowle

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 03 September 2012 - 06:22 AM

Hi,

Thanks for your replies, I have it working in the test panel, just need a little help with the DAQFactory.

#7 AzeoTech

AzeoTech

    Guru

  • Administrators
  • PipPipPipPipPip
  • 4532 posts

Posted 04 September 2012 - 10:38 AM

Please see the DAQFactory - Labjack application guide as that will explain exactly how to setup timers in DAQFactory.