LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Measuring vechicle speed using two IR Sensors

Hi Everyone,

 

My program has to calculate the speed of passing vehicles based on interrupting the connection between the two IR transmitters and receivers. Also program has to count the number of passed vehicles. Devices are plugged into the Arduino UNO, and i use a LINX to connect Arduino to LabVIEW. The program detects infrared waves intervals but I don't know how to calculate the time between the termination on one wave and the other to calculate the speed. Distance between two sensors is permament. Please give me some suggestions.

0 Kudos
Message 1 of 4
(5,950 Views)

Hi!

 

As far as I understand you problem, you could successfully detect the pass on each sensor but you need help in measuring time. 

 

In order to do this you have to get a timestamp, when the car passed the first sensor, then another when the secon sensor signal, then subtract the values.

 

In order to get time I suggest using the Tick Count (ms) VI. Detailed description:

http://digital.ni.com/public.nsf/allkb/6F6B9F4E149C80578625652800784764

 

In order to remember the value through loop iteration you can use shift registers:

http://www.ni.com/getting-started/labview-basics/shift-registers

 

I hope this helps,

András Bükkfejes

National Instruments

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

LINX is fairly slow and uses asynchronous communications so make sure the sensors are far enough apart that the timing latency and jitter due to communications does not introduce unacceptable errors.

 

Lynn

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

I would change the code in the Arduino to do all of the calculations for you and just pass the needed information up to the LabVIEW interface via the serial port.  The arduino on its own will have a lot better resolution than reading the sensors with the Arduino, sending the data via the serial port, and reading in the PC application.  So in the end, the Aruino does all of the heavy work and then just pass the speed and number of vehicles passed up to LabVIEW.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 4
(5,778 Views)