LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Measuring time between pulses to find velocity

Hi all!

 

I'm trying to program a velocity monitor to keep track of how fast a motor is going so that I can start a recording once it reaches my desired constant velocity.  I'm measuring the velocity of my motor with a light sensor that senses a piece of white tape attached to the outer edge of my motor (aka, it pulses once per rotation)  which means that if I know the time between pulses I can calculate the velocity.  I think I understand how to do this for one iteration but I want to keep on measuring the velocity after I tell it to change until it's the constant velocity I desire. Can anyone help me with a program to continually measure the velocity?

 

Thank you,

Lost Student

0 Kudos
Message 1 of 18
(5,712 Views)

Lost,

 

Since you can do it for one iteration, you already know quite a bit.  

 

Please post what you have tried, and point out what does not work. It is much easier for us to help you understand what you are doing that does not work that to try to explain something which might be completely different from what you have in mind.  Also, you learn more this way.

 

Hint: Shift register.

 

Lynn

0 Kudos
Message 2 of 18
(5,707 Views)

Hi Lynn,

 

I think to get the velocity I need to be able to reset the "tick count" whenever the statement is "True."

velocity 3.png

0 Kudos
Message 3 of 18
(5,701 Views)

I would forget the tic counts and base everything on your sample time:

 

velocity.png

Message 4 of 18
(5,697 Views)

I'll try that, what is the first box (the one with three symbols) that you connected the DAQ assistant to?

0 Kudos
Message 5 of 18
(5,665 Views)

Min/Max of an array. The way you had it the event would only trigger if the last digit of the data set was HI. This way you will not miss an event within the array.

0 Kudos
Message 6 of 18
(5,660 Views)

OK, now I have this.  Could you explain what I should put in the "False: box? Also, how do I keep track on the velocity outside of the big while loop?  When it hits the wall of the T/F block it needs something on the false side to exit.velocity v2.png

0 Kudos
Message 7 of 18
(5,633 Views)

Falcon9a,

 

Based off of Citabria's comments in his code, for the false condition you would just wire the integer input of the case structure directly do the exiting integer tunnel on the right side of the case structure. Then another thing to note is that he uses shift registers to keep track of changes to the value after each iteration of the while loop. You can change those blue boxes on the edges of the while loops to shift registers by right clicking on one and then select change to shift register.

 

Regards,

Danny F

Danny Funk -- Senior Group Manager -- Software R&D -- NI
Message 8 of 18
(5,607 Views)

OK, I set it up as follows but I'm not getting very logical numbers.  For a fairly constant rate they vary in series like 6, 3, 1.5, 2, ext which would mean I'd be going something like 1 rotation every ms, which I am not doing. Do I need to change something in the DAQ assistant?  I think Citabria's program is measuring the the total sample times before the T/F is satisfied, which would solve for the time between high voltage pulses but I'm not sure how his program adds the times.

 

Thank you

 

9-1 1.png

 

 

 

This is what I'm measuring, there is a 10v pulse every time the white tape is hit with a light

9-1 2.jpg

0 Kudos
Message 9 of 18
(5,588 Views)

Your "1" represents seconds (Rate is in sec.). Do you want it to be seconds? Maybe you should represent it in ms if that's what you're measuring. Also, are you passing the accumulated time (the blue integer) straight through the false statement?  Also, look what I did with the Min/Max call. You need this! Setup that thing to output an array, not a scalar. The way you have it setup you could completely miss a 10V event.

Message 10 of 18
(5,582 Views)