Vehicle Counter
Sunday, April 04, 2021
We live near a highway that is well travelled by tourists in the summer, so I wanted to get a count of how many vehicles pass by, so I built this vehicle counter.   Laser is best but requires a reflector across the highway.  It's best because it is On-Off.  My LIDAR sensors didn't have the range, and the ultrasonic (shown below) is "noisy", i.e. NOT On-Off, so filtering and multi-sampling must be done.


Copyright 2021 Queenidog - All Rights Reserved

 

 

 

 

 11.1 m/s

 13.9 m/s

 16.7 m/s

 

 

 

 

 40kph

 50kph

 60kph

 Vehicle

 Typical

 Length

 Length

 Transit

 Transit

 Transit

 

 

 meters

 feet

 sec

 sec

 sec

 motorcycle

 Harley

 2.2

 7.26

 0.20

 0.16

 0.012

 car

 Mustang

 4.8

 15.84

 0.43

 0.35

 0.026

 SUV

 Escape

 4.4

 14.52

 0.40

 0.32

 0.024

 Pickup

 F150

 6.2

 20.46

 0.56

 0.45

 0.033

 bus, semi

 72 pass

 10

 33

 0.9

 0.72

 0.6

Transit times are based on average length of vehicle shown in table,  at 3 speed limits.  Very crude determination because speed is assumed,   not necessarily followed and vehicle lengths are averages.  Speed not  measured (another project).

The posted speed limit where the sensor is located, is 40 kph, or 11.1 meters/second.
Update
Monday, November 15, 2021
Update: (Nov 14, 2021)  Project is complete, ie it is working on the bench...field trials starting soon.

I went back to LIDAR, using a Benewake TF-Mini sensor, good for 36+ feet (12 M) under good conditions.  The LIDAR (an acronym for Light Detection and Ranging)  generates  an infrared light of 850 nM wavelength, so it is invisible.  The unit has electronics to help discriminate from false signals and has a tight focused beam with a refresh rate of 100Hz.  I'm not using it as a range device, I'm using it as a detector, so I had to do some coding to make that happen.

See new  (last 4) photos below.


How it works (Theory of Operation)
Monday, November 15, 2021
The LIDAR sends out an invisible infrared light  that reflects back when it hits an object, the object in this case being a vehicle.  If there is no vehicle, there is no bounce back (as long as nothing is in the way and within the range of the LIDAR, e.g. grass in the ditch across the highway).  This is the "idle state" where the system waits for a block.   When a vehicle blocks the way, a timer starts and when the vehicle passes, the timer stops.  The transit time is an indication of what type of vehicle it was, e.g. a motorcycle will "fly" past the sensor faster than a 70 passenger bus.   See table after the photos for transit times.

The sensor does provide me the range, i.e. the distance to the object, so I can use this to determine if traffic is in near lane or far lane, an indication of direction of flow. (Not implemented yet).

Download Arduino (C++) file