07-27-2011 06:24 AM
Hello,
I am pretty new to Labview in general, I work as a student in automotive company.
My job is to data log signals from various sensors, but I need an information about RPM first. I am using PC, PCI 6123 card and BNC-2110 as block terminal.
My signal is coming from pick-up sensor on main shaft, I already recorded the signal with Labview, now I would like to count the edges of the signal and get an RPM out of that. Every revolution there is 58 edges since the phonic wheel has 58 tooths. I assume I will have to divide the number of edges with 58.
I am attaching the picture of signal and a VI with which I tried to get the RPM showing. Since I have analog signal, I can't get the VI to count the edges, it says it can only count digital signal. I attached the BNC connector to Counter BNC on block terminal.
Any help would be highly appreciated.
07-27-2011 06:55 AM
Assuming you have the data from your picture in an array of DBL, then one way you could do it is to simply use a LESS THAN compare operation with a value of -0.6 or so.
That gets you a boolean array of TRUE where the signal is less than -0.6.
Make a copy of that array, invert it (NOT), and delete one element from the start.
Then AND the two arrays together.
That gets you an array where TRUE means this sample was over the threshold and the previous sample wasn't.
Convert that array from boolean to 0:1 and sum the array - that is how many transitions were in your original.
That is, of course, assuming that your signal doesn't dally around the threshold point.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
07-27-2011 09:03 AM
Hi,
thanks for fast response.
However, English is not my first language and I can't deduce what exactly do you mean. Can you please rephrase your words or show me the way in which should I go in my program that is attached? I modified the program with which I logged the signal and did some things you said.
07-27-2011 09:51 AM
Here is a pic showing what I mean.
Compare the signal array to a threshold value (judging from your pic I would guess -0.6).
That gets you an array of booleans; TRUE = below threshold.
Make a copy, delete the first element, and invert it.
That gets you an array of booleans; TRUE = above threshold.
AND the two arrays; that gets you an array of booleans where TRUE = transition from below to above.
Convert the booleans to 0:1 and count them.
The part in the box is the code you're interested in; the rest is just signal generation and graphing.
The graphs 2,3,4 are zoomed in to a particular pulse.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
07-27-2011 09:53 AM
If you notice the wheel you will see it has 58 teeth and two missing teeth your VI must detect the missing teeth and use them to determine the RPM
07-28-2011 06:05 AM
I built the program as suggested but it doesn't count the pulses. Currently I am testing it on a different sensor and I do get a 0 or 1 on the wavefrom graph if I press on the sensor( I am using piezo pressure sensor for generating analog pulses).
Any ideas?
Thank you in advance.
07-28-2011 06:13 AM
Show some of your data. Your program doesn't graph the raw data read from AI-READ, do that and show us a screen capture.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
07-28-2011 08:15 AM
If I add the raw data graph, others stop working. Actually, sometimes they work and sometimes not.
07-28-2011 08:28 AM
Trust what your data is telling you.
Put yourself in the position of the CPU and do what it does.
Where in that chart 3 data is the level below your threshold of -0.5?
Answer: everywhere.
There are no transitions.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
08-18-2011 05:37 AM
Hi,
I found this working counter on the site and modified it a bit to remove some unnecessery parts and added the divider with 58, as that is how many tooths I have. Now I get the number of revolutions made, now I just need to time it, eg. calculate the revs per minute/second. Which element can do that? I was looking in the Programing section under Timing, but could find nothing useful.