Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Measuring time of arrival with simple circuitry

I am trying to measure time of arrival of a high speed object to then calulcate the velocity of the object.
The kit I will be using is a cDAQ-9174 with which I will either use the NI9401 or the NI9223.
I am want to make the circuit so that when it is broken the time taken is recorded.
The physical switch is easy to create however I am having trouble knowing where to start with labview.
Could anybody give me a point in the right direction, even something simple like which of the two harware would be most appropriate.
Thank you

0 Kudos
Message 1 of 7
(6,222 Views)

You can use 9401 to measure the time between pulse at different points on the track. If the time between pulse is short (<1s), you can use counter measumrent (Help>>Find Examples>>Hardware Input and Output>>DAQmx>>Counter Measumrents>>Period or Pulse Width), for a long period, use digital input (Help>>Find Examples>>Hardware Input and Output>>DAQmx>>Digital Measumrents) together with elapsed time (http://search.ni.com/nisearch/app/main/p/bot/no/ap/tech/lang/en/pg/1/sn/catnav:ex/q/elapsed%20time/)...

0 Kudos
Message 2 of 7
(6,211 Views)

Thanks for the reply, I have started to try to use the 9223.
I am trying to calculate the time difference between two switches being broken/made.
Attached is the vi I have put together.
It does not run and I believe that this is because I am trying to run two voltage aqcuisitions. The top half works as a stand alone but when I added this second section it did not work.
How am I able to get both to run?
Ideally I would like to add even more switches too.
Thanks

0 Kudos
Message 3 of 7
(6,208 Views)

I have been updating some more, and have been able to get somewhere close to where I want to be with the following vi.
My issue is that I want to be able to record time intervals in the order of microseconds rather than miliseconds.
What would be the most suitable way to do this

0 Kudos
Message 4 of 7
(6,198 Views)

Sorry I should note that when I have set it to run through instantaneously the smallest time difference I get is 100 ms.

0 Kudos
Message 5 of 7
(6,197 Views)

Hi T-Pope,

 

I have created a small amount of code to get you started with this issue if you are still struggling with this.

 

The channel 2 triggers off channel 1 and begins to capture data. When channel one voltage > threshold voltage, the task starts (channel 2). Samples are then taken continuously until a sample is > threshold voltage (channel 2). When this occurs the loops stops and the total number of samples are outputed. You will then be able to calculate the total time by dividing the Total number of samples by the Number of samples per second.

 

 

This will give you the time between the two light gates from being broken.

 

Kind Regards,

 

Image_DAQ.png

__________________________
Aidan H

Applications Engineer
National Instruments UK & Ireland
0 Kudos
Message 6 of 7
(6,093 Views)

I can't view the files posted by T-Pope as I'm only running LV 2011 on this computer.

 

AidanH's code won't work.  The code is missing a sample clock configuration, which is fixable.  However, the 9223 does not support analog triggering.

 

 

Either of these choices would work:

 

Use the 9401 and configure a Counter Input (Two Edge Separation) task.  This has several benefits:

 

1.  Easiest to implement in software.

2.  Most precise timing resolution (12.5 ns resolution).

3.  Least amount of data transferred across hardware bus (32 bits per measurement).

 

 

Use the 9223 and configure a continuous analog input task with two input channels.  Process the acquired data in software to determine the time difference between rising edges on each channel.  Compared to the option above, this method has the following drawbacks:

 

1.  Annoying to implement in software (must keep track of an absolute sample index to calculate the time difference--you can't just read one sample at a time and look at loop iterations since data will be coming in faster than the loop can handle). 

2.  Timing resolution is the inverse of your sample clock (max sample rate of 1 MHz gives a 1 us resolution).

3.  Data transferred is proportional to your sample clock rate (1 MHz clock rate * 2 bytes per sample * 2 channels = 4 Million bytes per second).  It would be sustainable but seems wasteful and unnecessary to me.

 

 

The only reason you might want to use a 9223 is if your signal source is not TTL and you need a configurable threshhold between high and low.  However, if this were me I would convert the signal into TTL with a simple comparator circuit and use the 9401 regardless.

 

 

Best Regards,

John Passiak
0 Kudos
Message 7 of 7
(6,086 Views)