LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Time between digital inputs?

Hi, I would like to measure the time between a digital input being true.
Basically I have a prox picking put a point on a rotating shaft (to determine RPMs).

What I want to do is measure the time between consecutive input signals from the prox, divide 1 rev by the time, multiply this by 60 to get RPMs. Then compare that value to a set value ( say 300 RPM ). If it is equal or great, contine onto the rest of the program, if it is less than the set value, keep looping until it is greater than or equal to the set value.

Thanks in advance for the help!
Ryan

LV 7.1
0 Kudos
Message 1 of 10
(3,451 Views)
If you need to measure accurately the rotation speed on a single turn, software timing may not be accurate enough, since the Window internal clock readings have lags (read "errors") of more than 10 ms (= 100 rps, about 2 rpm error), even when no other application is running. So either you count (and wait) for a given number of rotations, and calculate an average, or you use hardware timing with a counter on the DAQ card (if any)...

Otherwise, if you only need an estimate of the rotation speed, you can read the digital line and wait for 2 consecutive changes. The period can be calculated from the time stamps. See the attached vi. Wait a few seconds to observe the variations generated by Windows.

Merry Christmas, and Happy Wiring !

CC
Chilly Charly    (aka CC)
0 Kudos
Message 2 of 10
(3,438 Views)
chilly, I have a pci-6110 (which has 2 counter inputs) and I have a pci-6514. I currently have the prox wired to the 6514 to use it as a digital input...
would it be better to wire it to the 6110 as a counter???

Also, I should have mentioned this, I have 7.0 so I am unable to view the example you posted for me (which I appreciate!) so if you or anyone could take the time to save it in 7.0 I would be very grateful.

Thanks and happy holidays!
Ryan

LV 7.1
0 Kudos
Message 3 of 10
(3,435 Views)
or is there a way i can convert the files???
Ryan

LV 7.1
0 Kudos
Message 4 of 10
(3,429 Views)


@esa_paranoid wrote:
chilly, I have a pci-6110 (which has 2 counter inputs) and I have a pci-6514. I currently have the prox wired to the 6514 to use it as a digital input...
would it be better to wire it to the 6110 as a counter???

Also, I should have mentioned this, I have 7.0 so I am unable to view the example you posted for me (which I appreciate!) so if you or anyone could take the time to save it in 7.0 I would be very grateful.

Thanks and happy holidays!




Here is the converted vi. Try it and see if it satisfy the kind of accuracy you need. Otherwise, use a trigger input on the 6110.

CC
Chilly Charly    (aka CC)
0 Kudos
Message 5 of 10
(3,420 Views)
Chilly - I threw this together while I was waiting...do you think this would work?

I will take a look at yours.

I am not too familiar with trigger inputs...I am assuming you mean to use the counter inputs??? and trigger on rising edges???
Ryan

LV 7.1
0 Kudos
Message 6 of 10
(3,421 Views)
sorry forgot to attach vi.
Ryan

LV 7.1
0 Kudos
Message 7 of 10
(3,418 Views)
The main issue in your (and mine) vi is that there is no guarantee that reading the digital line will be fast enough to pick the transitions of the proximity sensor, or low enough to avoid reading twice the line before the sensor signal has changed...
So you should use the counter/timer of your DAQ card. Since you are not that familiar with counters (nor am I), you should read the LV tutorial.
Load the NI-DAQ help and search for "Counter Signals", "Connecting Counter Signals". There is a lot of interesting stuff there.

If you are still stuck with your measurement, post a new question, asking for help with counters, and I promize not to answer 🙂

Trying to help,

CC
Chilly Charly    (aka CC)
0 Kudos
Message 8 of 10
(3,416 Views)
well i know mine wont pick it twice (that is why i check the i-1 index is = 0 before I use it). I tried mine out (will try yours now) and it works...sorta, i get some fluctuation, which is what you were worried about. i have an idea how to fix it. i will let u know.

thanks
Ryan

LV 7.1
0 Kudos
Message 9 of 10
(3,413 Views)
Hey Chilli, hope you had a good Holiday break.
Here is something I put together while I was away for the Holidays...it seems to be accurate withing +/- 1 RPM....

Obviously the drawbacks are that you need 5 revs to calculate RPM...therefore the refresh rate is dependent on RPM.
My application is at 300 RPM so I am getting RPMs updated every second. And of course, as you said this is all assuming the prox/digital scan is capturing all of the revs (which it seems to be).

If you (or anyone) has any suggestions on how to improve this I would be more than willing to listen!

Thanks again,

Ryan
Ryan

LV 7.1
0 Kudos
Message 10 of 10
(3,385 Views)