LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert rotation to rpm in vi

Hello,

 

 I'm working on a labview program and I have an input signal for rotaion currently in position (degree) and would like to convert it to rpm and read them continuously. I've tried a few different ways but would like to find a simple efficient way. I'm sure there's an easy way to do this (delta position / delta time x 60), but I'm still learning. I'm attaching a VI with two loops. The first loop just simulates the rotation at approximately 10 rpm. The second loop has a local variable for rotation and is wired to an idicator. What would be the best methold to use between them to achieve continuous rpm from position. I'm using Labview 8.5.  Any help and suggestions would be greatly appreciated.

 

Thanks,

uddy

0 Kudos
Message 1 of 24
(5,880 Views)

uddy,

 

The question in my mind is this: what kind of an encoder is giving you the angular readout?  Is it an absolute angular reading, or a relative reading?  The main issue is what happens when the encoder passes one full revolution--when it passes 360 degrees or 2 pi, does it reset to zero, or does it keep accumulating the angular change? 

 

If it's the former, you have the problem of what to do if the encoder turns over zero during your time interval.  If it's the latter, you can just use stacked shift registers to look at the angular value during two successive iterations of the loop, take the difference, and divide by the time interval.

 

Ed

0 Kudos
Message 2 of 24
(5,869 Views)

uddy,

 

Take a look at what I've attached.  This works IF the encoder does not reset to zero when it passes 360 degrees. 

 

I hope this works; this is the first time I've tried to post a .vi.

 

Ed

 

0 Kudos
Message 3 of 24
(5,861 Views)

Ed,

 

I will take a look at the vi. The encoder does reset to zero. The signal coming in is 0 to 360 degrees (0 to 10V).

 

Thank you,

uddy

0 Kudos
Message 4 of 24
(5,844 Views)

Ed,

 

I'm just using the first loop to simulate the rotation signal 0 to 360 degrees output. The second loop I'm wanting to have read the rotation signal 0 to 360 degrees (0 to 10V) and convert degrees to rpm and display the rpm continuously as the device rotates. The first loop in the vi attached in the original posting simulates approximately a 10 rpm output signal. I'm using that to try and figure out the best way to convert a rotation signal to rpm (second loop in vi) without being connected to the actual hardware. The first loop isn't going to be in the program, it will be replaced with the signal from the hardware. Hope this helps explain what I'm looking for. Sorry for any confusion.

 

Thanks,

uddy 

0 Kudos
Message 5 of 24
(5,840 Views)

uddy,

 

I understood what you were doing; I just simplified it so it was easier to see what was happening.  You didn't need the conversion from radians to degrees in your first loop--I just started with degrees.  And I could have split my .vi into two loops like you did, but it's cleaner to keep it in one.  Running loops in parallel without any means to synchronize them is risky, and a bad habit to get into.

 

But I think you see the point of my question about the encoder--if the encoder goes to zero once every rotation, you'll get a bad number if you just take the the delta position/delta time, as you proposed in your first post.  Everytime that happens, the difference changes sign.

 

Somehow you need to deal with that case, when the encoder passes through zero.  My guess is you would detect it and ignore that value.  The other thing you need to consider is what if the encoder runs in the opposite direction?  Do you want the .vi to display negative RPM's, or will you correct that in the code?

 

Unfortunately, I don't have time to try it right now; I'm leaving to go on a long weekend vacation in a few minutes, and won't have internet access.

 

Good luck,

 

Ed

0 Kudos
Message 6 of 24
(5,814 Views)

Uddy,

 

Your base problem seems to be with the math.  There is not conversion from Angle to RPM.  Think of it this way - RPM mease Revolutions Per Minute so you need time and revolutions to solve.

 

you need to compare two angles and find the differeance in them then divide by 360 to get the number of rotations.  The elapsed time between the samples give you the correct answer.

 

you will need a shift register or a feedback node in your loop


"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 24
(5,806 Views)

My solution is attached.

I didn't touch the left part, while it could be done easyer.

 

I added some code in the right part.

It's inaccurate and not completely linear, but gives you an easy basic solution.

Message Edited by ST5 on 03-23-2010 10:41 AM
0 Kudos
Message 8 of 24
(5,751 Views)

Hi Uddy,

 

I wrote a small simulator that i think achieves what you are after. I have 2 loops, one that simulates a rotating devices sensor output and another that calculates its RPM.

 

RPM Meter Snippet.png

 

The first loop simply calculates how many degrees the device would of rotated for a given sample rate and RPM. It then calculates the position of the sensor based on the previous calculation.

 

The second loop reads the simulated sensor input and based on its previous reading calculates the RPM.

 

Hope this helps.

 

Regards,

 

Lucither

Message Edited by Lucither on 03-26-2010 10:11 AM
------------------------------------------------------------------------------------------------------
"Everything should be made as simple as possible but no simpler"
Message 9 of 24
(5,709 Views)

Just slightly modified my last VI. I realised that for very fast RPM's and slow sample times the rotational device could actually rotate several times between samples. This VI accomodates for that and still feeds the correct simulated position of the readout:

 

RPM Meter Snippet.png

 

 

Message Edited by Lucither on 03-26-2010 10:52 AM
------------------------------------------------------------------------------------------------------
"Everything should be made as simple as possible but no simpler"
Message 10 of 24
(5,702 Views)