LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

RPM Measurement without using Counters

Solved!
Go to solution

I've read several threads on how to measure RPM from optical sensors but they all involve the use of counters on the DAQ terminal board. My issue is that my project involves reading and comparing four seperate RPMs and my DAQ only has 2 counter terminals. Ideally I'd like to just use the analog signal input channels for all four sensors. I've gotten as far as counting the edges of the analog signal using this code snippet.

0 Kudos
Message 1 of 12
(7,961 Views)

Sorry, what's the question here?  If you can count the edges in an analog signal, you know the number of edges in a rotation, and you know the span of time the analog signal covers (if you don't know this you can simply divide the number of samples by the sampling frequency), isn't that all the information you need to calculate RPM?

Message 2 of 12
(7,956 Views)

Thanks for the direction. I understand the concepts of what you are talking about, but I just have difficulty figuring out how to get labview to do it.

0 Kudos
Message 3 of 12
(7,950 Views)

Sorry, I missed the timer for post edit. The fan I'm measuring has 8 hole around it's center that allow for the optical sensor to take measurements.

0 Kudos
Message 4 of 12
(7,944 Views)

Can you share your code?  (If it's not more than the example to which you linked, don't just post that - make an effort to get it working.)

Message 5 of 12
(7,940 Views)

@nathand wrote:

Sorry, what's the question here?  If you can count the edges in an analog signal, you know the number of edges in a rotation, and you know the span of time the analog signal covers (if you don't know this you can simply divide the number of samples by the sampling frequency), isn't that all the information you need to calculate RPM?


If I understand what you are saying, I think that would only work if the RPM were to be constant the run time. I'm trying to make this robust enough to handle varying RPMs and report instantaneous. From what I've read, because my sampling mode here is continuous, my sample rate is 1000 and not the 100 samples per channel.

0 Kudos
Message 6 of 12
(7,913 Views)

@Gzimmer wrote:

If I understand what you are saying, I think that would only work if the RPM were to be constant the run time. I'm trying to make this robust enough to handle varying RPMs and report instantaneous. From what I've read, because my sampling mode here is continuous, my sample rate is 1000 and not the 100 samples per channel.


No, the RPM value does not need to be constant.  You're correct that the sample rate you want is 1000 samples/second.  Every time through the loop you acquire 100 samples = 0.1s of data.  So, each time through the loop you can calculate RPM = # of pulses in the last 100 samples / ( 0.1s * 1 minute / 60 seconds) * 1 rotation / 8 pulses.

 

Couple of LabVIEW style notes.  No need for the Edges Counted local variable; use a wire.  Also no need for the 0/1 in the shift register - store it as a boolean instead.  Remove the Select and use the boolean value directly.

Message 7 of 12
(7,910 Views)


No, the RPM value does not need to be constant.  You're correct that the sample rate you want is 1000 samples/second.  Every time through the loop you acquire 100 samples = 0.1s of data.  So, each time through the loop you can calculate RPM = # of pulses in the last 100 samples / ( 0.1s * 1 minute / 60 seconds) * 1 rotation / 8 pulses.

 

Couple of LabVIEW style notes.  No need for the Edges Counted local variable; use a wire.  Also no need for the 0/1 in the shift register - store it as a boolean instead.  Remove the Select and use the boolean value directly.



Alright, thank you for helping me. I understand what you are saying about how to calculate the rpm for every loop. How would I best store only the last 100 samples? I'm starting to think the way my program is written is over complicating things.

0 Kudos
Message 8 of 12
(7,901 Views)

Your code already gets 100 samples at a time.  When you do the DAQmx Read, it returns only new data, not the previous data, and you're specifying that you want 100 samples.  Maybe I'm not understanding your question?

Message 9 of 12
(7,898 Views)

Alright, thank you for your help. I have a working version attached, but I believe it's 10x higher than it should be. If I make the slightest rotation, I get 1.25rot/sec when it should be .125rot/sec. While I could just divide by 10 to fix this, I don't understand why it's necessary. Also, which sampling rate should i change to increase my resolution so to speak.

0 Kudos
Message 10 of 12
(7,878 Views)