08-02-2018 06:52 AM - edited 08-02-2018 06:58 AM
Hi,
I'm really new with Lab View and I'm trying to measure Water Flow Rate with the sensor YF-S201 ( http://www.hobbytronics.co.uk/yf-s201-water-flow-meter ) I'm using NI 6070E card.
I need to get the flow rate in real time
I'm attaching the simple VI I did. For some reason I'm not being able to make the measurement in the right way.
Any advice will be greatly appreciated.
In advance, thank you for your help.
08-02-2018 07:39 AM
Thank you for attaching your VI. When I went to the site for your Hobbytronics device, it said "The page you are looking for cannot be found". I'm guessing it produces TTL Pulses (0 to 5 v) at a rate proportional to flow, correct? You are sampling it at 10 kHz, taking 1000 points and getting data back 10 times a second. You seem to be using two methods to estimate pulse frequency.
I haven't tried measuring pulses, but what I would do (and may well just try it out!) is to use the Waveform functions to write a little test VI that makes such a pulse train with known parameters and then uses the two methods you used to see what results are returned. Sometimes the best way to test code is to feed in "known" values and see what comes out the other end.
I'm generally "allergic" to Express VIs, especially the Dreaded DAQ Assistant and its Evil Twin, the Dynamic Data Wire. Since you are "really new with LabVIEW" (note the only correct name and way of spelling it), I won't point you to the article "Learn 10 Functions in NI-DAQmx and Handle 80% of your Data Acquisition Applications" ...
Bob Schor
08-02-2018 07:44 AM - edited 08-02-2018 07:46 AM
hi UFLow,
welcome to the forum!
the link you provided is broken some strange characters at then end
http://www.hobbytronics.co.uk/yf-s201-water-flow-meter
i never used the Express VIs, but from the looks, you should start only with the DAQ Assistant,
and check if you get data inside via the "Run" button on top.
what i noticed are your Samples and Rate values, which are extreme (i think).
at the moment you want 1 thousand samples every 10000ths of a second,
that means every second you accumulate 10 million samples.
start with very low values, like 100 samples and 1 Hz and verify that you get data.
there is also the NI Distributed Systems Manager (should be installed with your LabVIEW) where you can see what the current values are, that might also help with verification,
that your device and connection works.
my guess why your VI does not work is, that the DAQ Assistant shouldn't be placed inside a loop as you did, but other people with more knowledge about this should confirm/refute.
regards
EDIT: reading bob's post, i might have got my math wrong
08-02-2018 10:19 AM
I just realized that I'm getting a PWM output...that's the frequency I have to get.
Is there any function for the analysis of PWM output?
08-02-2018 10:55 AM
Hi UFlow,
There's an integrated magnetic hall effect sensor that outputs an electrical pulse with every revolution.
No, your sensor does NOT provide a PWM output!
You need to count the number of pulses per s (or any other time range you like) to get the amount of flow.
Which DAQ hardware do you use? Does it provide a simple counter, even as simple as provided y a USB6008? Then connect the pulse signal (which is TTL by specs) to the counter input and let your DAQmx device do the counting! (There's a huge library of example VIs coming with LabVIEW, and there are examples to count pulses.)
08-02-2018 11:13 AM
Hi GerdW,
Thank you for your response!
Thank you for your help I'm using a NI 6070E.
I saw the examples but I couldn't use them.
I know that it is an easy task but since I'm new I came to this forum.
I'm a bit confused
08-02-2018 12:34 PM
Sorry, was sitting in a Doctor's office with my laptop, and discovered "No Internet"! I whipped up this example to show you how to count pulses with an A/D converter, but GerdW is definitely right, if you really have TTL pulses, a Counter/Timer input is what you want to use. But here's my code, anyway. I used three different routines to estimate Frequency -- fortunately, all gave me the same answer. The first is a Pulse Measurement VI on the Waveform Palette. The other two are the Tone Measurement Express VI that you used (it looks different because I switched to Icon View), and the more-appropriate Timing Measurement Express VI. I'll also attach a LabVIEW 2016 version of the code (but you should be able to code it from just looking at the Snippet ...].
Bob Schor
08-05-2018 07:26 AM
Thank you Bob!
I used the Timing Measurement and I think it's working!
I'm just getting an error when I don't detect a signal but if I run the VI while I have a signal, it gives me the values!
08-05-2018 07:29 AM
08-05-2018 11:13 AM
Of course, what GerdW really wants you to do is the following:
You'll find Clear Errors on the Dialog Palette, or use Quick Drop.
Bob Schor