07-26-2012 11:56 AM
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.
Solved! Go to Solution.
07-26-2012 12:02 PM
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?
07-26-2012 12:10 PM
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.
07-26-2012 12:40 PM
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.
07-26-2012 12:51 PM
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.)
07-27-2012 10:53 AM - edited 07-27-2012 10:54 AM
@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.
07-27-2012 11:52 AM
@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.
07-27-2012 12:50 PM
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.
07-27-2012 01:14 PM
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?
07-30-2012 09:39 AM
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.