LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Measuring duration of a true value and/or time between two events and/or storing time variables

Hello everyone!

I'm currently a student at college and currently working on a conception project using LabVIEW and an ELVIS prototyping board for my final project.

My project consists of a bicycle wheel (with no tire) to which are attached neodymium magnets at an equal distance from each other (as you shown in the picture attached). One or more electromagnets (represented by the red rectangle on the picture) are used to apply a force on the magnets attached to the wheel to either accelerate it, decelerate it, or to keep it going at a constant speed. In order to achieve an acceleration, it is necessary for the electromagnet to change polarity when it is aligned with the center of a magnet and to go back to it's original polarity once it's between two magnets. To do so, a first photogate is used to send a Boolean signal read by the NI ELVISmx Digital Reader VI when the magnet is aligned with a magnet (See INPUT 1 in the picture), and is being saved in an AND-OR LATCH, until the second photogate resets the output (See INPUT 2 in the picture). For deceleration, the exact same process is used, but with a NOT gate to invert the resulting output. 

 

Here comes my problem: I need to be able to measure the speed at which the wheel is rotating. To do so, I see two options, but I'm not experienced quite enough with the software to figure it out. The first option would be to measure the elapsed time during which one captor sends a signal, and to latch on the value of the total time only and use it to calculate it's speed, knowing the length of a magnet. The second would be to have a timer continuously running and to capture the time current time when an event occurs(when a signal goes from false to true, in this case), to finally subtract t1 from t2 in order to have my total time. I'm pretty sure my solution involves the Elapsed Time VI, but I cannot seem to get it to work the way I want it: only the total time has to be used to calculate the speed, since a photogate does not take movement in consideration and therefore not using the total duration would mean having an incorrect speed (Ex: 2,5cm in 10ms, which is totally false).

 

There may be some other alternatives that I do not know of, of course..

 

I thank in advance all of those who will be willing to take a moment to help me with my issue.

Manuel

Download All
0 Kudos
Message 1 of 5
(4,184 Views)

Just up-ing the subject in case someone has an answer..

0 Kudos
Message 2 of 5
(4,099 Views)

I'm a little confused by your physical setup.  Don't you have a single sensor that goes High when a magnet is near and Low when a magnet moves away?  This would give you a digital pulse train with the pulse width related to speed by "how long is the magnet near the sensor" and the pulse frequency also related to speed by "how long does it take to move from Magnet N to Magnet N+1", with the second method probably giving you a more accurate and more precise reading.

 

I'm not so familiar with the Elvis system, but does it have a Counter-Timer input function?  This is what you want to use for your timing, as you absolutely do not want to rely on the clock in your PC, but rather want to use a Hardware Timer such as the one the comes with most DAQ equipment and controls the timing of sample acquisition and output.  Most Counter-Timers have a TTL input, and can be programmed to give you an accurate (often using a MHz clock) time between pulses.

 

Bob Schor

0 Kudos
Message 3 of 5
(4,090 Views)

The photo-gates I use actually send a high signal when nothing is in it's way and a low signal when something blocks the infrared laser. I currently send this signal to through the ELVISmx Digital Reader VI, which translates it into a true/false value. 

For the Counter-Timer input function, I looked it up on google and it seems like it has it, I just need to figure out how to use it. Also, I was not talking about using my PC clock but instead the Elapsed time VI and capture time values at precise times, but I do not know if that would work or how I would do it.

About your first proposition, how would I do that in LabVIEW? Am I using the T/F signal from the Digital Reader and translating it into a graph, or are you thinking about some other way to do it? I would like to know a little bit more about it, that would be very helpful.

 

Thank you,

Manuel

0 Kudos
Message 4 of 5
(4,085 Views)

The Elapsed Time VI uses the PC Clock.  All of the functions on the Timing Palette use the PC clock (at least when running on a Windows platform).

 

I've not used the Counter-Timer functions myself, but if you put "Elvis Counter-Timer" in a Web Search, you'll find some NI Help Pages that discuss how to use these functions to do the things mentioned in my previous post.  [It might reference a myDAQ, which uses the same drivers as the Elvis].

 

Bob Schor

0 Kudos
Message 5 of 5
(4,074 Views)