LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Counting the RPM from analog signal

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.

Download All
0 Kudos
Message 1 of 15
(5,680 Views)

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.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 2 of 15
(5,677 Views)

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.

0 Kudos
Message 3 of 15
(5,654 Views)

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.

 

 

Screen shot 2011-07-27 at 10.42.07 AM.png

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 4 of 15
(5,631 Views)

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

0 Kudos
Message 5 of 15
(5,630 Views)

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.

0 Kudos
Message 6 of 15
(5,593 Views)

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.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 7 of 15
(5,589 Views)

If I add the raw data graph, others stop working. Actually, sometimes they work and sometimes not.

Download All
0 Kudos
Message 8 of 15
(5,584 Views)

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.

 

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

Message 9 of 15
(5,579 Views)

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.

0 Kudos
Message 10 of 15
(5,538 Views)