LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Finding the frequency of a digital 1/0

Good evening.

I apologize for asking a completely beginner question which has been asked before in many forms, but I cannot seem to find a solution which I have been able to properly utilize. 

 

I am trying to find the rpm of a pinwheel/anemometer, which has blades passing through an optical interrupt, which gives me a simple 1/0 digital pulse. The expected rpm ranges from 0 to, say, 1000 or so. All of my efforts thus far have met without success. 


How can I do this?

0 Kudos
Message 1 of 11
(3,542 Views)

If you tell us what hardware you are using we could probably give a more precise answer but to me it just sounds like you are using some sort of encoder.  We have a lot of good encoder examples that you can find by going to Help > Find Examples > Hardware Input and Output > DAQmx > Counter Input(?).  The first link here is what you physically need to do, the second link is a step by step guide to setting up a quadrature encoder in LabVIEW.

 

http://www.ni.com/tutorial/7109/en/

http://www.ni.com/getting-started/set-up-hardware/data-acquisition/quadrature-encoders

 

Again, not sure what you are using just kind of sounds this way to me (also not exactly sure where that example is, use the search bar if you have to).

Matt J | National Instruments | CLA
0 Kudos
Message 2 of 11
(3,531 Views)

Thanks for the response!

It is sort of an encoder, although not a formal one. the fan is a literal fan with blades passing through an interrupt sensor. At any rate, the business end is a 1/0 output, which changes when the blade interrupts. The links provided are not quite focused on my problem as much as other things. Basically, I just want to find out how, given an irregular 1/0 signal, to figure out how many pulses in a minute. The programming side of this has me stopped dead.

0 Kudos
Message 3 of 11
(3,521 Views)

Could you just count the number of 0->1 for a certain timeframe and get the frequency from there? You are going to need a sampling rate able to reliably detect your zeroes and ones.

0 Kudos
Message 4 of 11
(3,494 Views)
You need to provide the type of data acquisition hardware that you have.
0 Kudos
Message 5 of 11
(3,475 Views)

Dennis is right.  Without knowing your hardware, it's entirely likely you're not going to be successful.  You mentioned needing up to 1000Hz, that tells us you need a minimum of a 2000Hz sampling rate to detect the frequency.  If you're not using a hardware timed device, you won't succeed in your task.

 

Once you have the hardware timed device, follow Jacobson's advice and find one of the several examples included with LabVIEW to detect frequency.

0 Kudos
Message 6 of 11
(3,452 Views)

I think all you need to do is connect it to a counter input and read out the count at regular intervals. From the count increment since the last read, the number of blades per revolution, and the time interval, you can calculate the frequency. You can probably even configure it to output frequency directly.

 

Have a look at this tutorial.

 

 

 

Of course this does not tell you anything about direction of rotation, but that might not be needed if the motor can only spin in one direction. This is similar to a speedometer on a bike, where the wheel magnet generates a pulse with each revolution. 

Message 7 of 11
(3,440 Views)

I'm sure it's obvious to you that if you know the "blade rate" (number of blade pulses per minute), you need to divide by the number of blades on your fan to get rpm ...

 

BS

0 Kudos
Message 8 of 11
(3,412 Views)

@ tomstar, that is exactly what I am trying to do, I just need to figure out how to put "# of 1/0pulses/seconds" into LV code. As for my hardware, I simply have an arduino with an optical interrupt which will count the number of fan blades. The tutorials provided have required DAQ and DAQ assistant which I do  not have (apologies for leaving important info out). I do not require 1000 hz, but was thinking of 1000rpm with 4 pulses (fan blades) per rev. However, this is a very high estimate, I am now thinking 300rpm (1200 pulses per minute) would be more than adequate

 

I have the interface with the microcontroller all set up and everything, so the programming is all that is giving me trouble. At the moment, all I have is a little green indicator light in the front panel which turns on when a 1 is returned. I hope simply to figure out how to count these pulses, and put that number over a given time period.

 

Thank you all for the responses.

0 Kudos
Message 9 of 11
(3,390 Views)

I see you already posted to the LabVIEW interface for arduino page, you will probably get a much better answer there.  LabVIEW has a lot of specific toolkits that people will not know about unless they have used them.

 

A tip for future posts though, always start out with what you are using, what you are doing, and then what you are having trouble with.

Matt J | National Instruments | CLA
0 Kudos
Message 10 of 11
(3,377 Views)