Academic Hardware Products (myDAQ, myRIO)

cancel
Showing results for 
Search instead for 
Did you mean: 

2 ways to obtain RPM from encoder?

I'm new to labview programming and myrio hardware.

 

I want to get rpm from encoder. I did it. successful. But I have some other issue. So I need advice on doing it another way.

 

Method 1 (my current method)

Preset a time duration. Count the number of pulses that occurs in that time duration.  Do some simple math. Done! I got the rpm. and it works. (I used a while loop with a wait of 50ms, and manage to read approx 170 pulse within that timing, correctly translating to about 70rpm for my motor)

 

Method 2 (the method I want to try but failed to do it)

Is there an exisiting vi/function that will directly give me the frequency of the square wave from the encoder coming in from the input pin of myrio? I tried to use tone measurement, but I saw nothing at the "Frequency" output of the "tone measurement" block. Posted code below. Can this actually work? Or should I try some other function?

 

Capture Using tone measure to get freq.JPG

 

0 Kudos
Message 1 of 4
(6,621 Views)

look them 

Download All
0 Kudos
Message 2 of 4
(6,585 Views)

Thanks, I was able to get freq.vi to work and I was able to view the simulated square waves' frequency. I will try that again with a physical input.

 

However I encounter some error when opening the 2nd vi. I do not have the NI-DAQmx Driver? Is it a alternative hardware driver? My hardware is MyRIO. Is it compatible?

 

Capture error.JPG

0 Kudos
Message 3 of 4
(6,570 Views)

with myRIO you need to write some FPGA code, perhaps starting from an example, to do the DAQ portion.  The nice thing about myRIO is the FPGA, which can sample the digital inputs very very fast, giving you great phase resolution when measuring speed.  Here are some links you might review:

 

This example, is pretty straight forward, just put in the I/O nodes and timing in the example:

http://www.ni.com/example/31206/en/

 

When you want to advance and make the speed (RPM) measurement a pure digital high speed input, you may consider adding this as a separate look.

http://www.ni.com/white-paper/3230/en/

 

Hope these examples help you get going. 

 

Preston

Preston Johnson
Solutions Manager, Industrial IoT: Condition Monitoring and Predictive Analytics
cbt
512 431 2371
preston.johnson@cbtechinc
0 Kudos
Message 4 of 4
(6,562 Views)