Ideas for Traffic Counter

For starting out, any Arduino model should suffice. It is unlikely that your first attempt will be the final version so maybe start with a UNO or Mega2560. If I were doing it I would try something like the Teensy 3.1, which is quite powerful & great value for $17 in OSHPARK.

My experiences with ultrasound sensors has been mixed, particularly with varying surfaces.

Yet another sensor type to look at would be the ones used in lighting systems (not PIRs, but the alternative radar/microwave based ones). It may be possible to get a good signal/signature from them?

Microwave is what police speed radars use, right?

That's a more complex sensor, but certainly more accurate than ultrasound a less susceptible or even "immune" to the doppler effect (I think...). How small and cheap can it get? How would it be implemented in the counter, the same way as the ultrasound?

Microwave is what police speed radars use, right?

That's a more complex sensor, but certainly more accurate than ultrasound a less susceptible or even "immune" to the doppler effect (I think...). How small and cheap can it get? How would it be implemented in the counter, the same way as the ultrasound?

I think they use lasers in more recent speed detection equipment.

A simple search for "pir radar" on eBay reveals lots :slight_smile:
You will have to play with them to see how well they work (Bear in mind they are designed to detect people in offices, behind cubicles/partitions etc. Maybe a dual sensor will yield good results.

PCanas:
Euro truck designs usually have 2 OR 3 axles in the cabin, and 2 OR 3 axles in the trailer, depending on their size and weight, and sometimes trailers with 3 axels travel using only 2, if they're empty or with low weight (the 3rd/1st axle can be lifted from the road). So it's not that linear and simple to detect a truck. Plus, the short distance between the 2 axles from the trailer can be confused by sensor as a car passing by really fast.

Another way would be to detect how much the pressure changes in the hose, although I think the pressure will change the same regardeless if it's a truck or a car or even a bicicle, beucause, in my understanding, when you pinch the hose to the point it "closes", it's indiferent if you do it with 1Kg or 1000, since it won't change the air pressure any further even if you increase the weight. (not sure if I explained myself well...)
Maybe it changes with different speeds, so the heavier the vehicle the faster the change??

Think of the tyre width. A bicycle has narrow tyres, a car has wider tyres and a truck has the widest (or sometimes multiple) tyres. The amount of air squeezed out of the tube will vary, depending on the width of the tyres (= length of tube squeezed).
The old type of traffic counter had a U tube of mercury connected to the air tube. As the air was squeezed, it would push the mercury up the tube to make an electrical contact. These aren't used any longer, due to the dangers of using mercury.

PCanas:
Microwave is what police speed radars use, right?
That's a more complex sensor, but certainly more accurate than ultrasound a less susceptible or even "immune" to the Doppler effect (I think...). How small and cheap can it get? How would it be implemented in the counter, the same way as the ultrasound?

Police speed radars - and to some extent radar "people detectors" on automatic doors and such - are based on the Doppler effect.

They are actually dead simple. A small module contains the Gunn Diode and diplexer cavity, the detector diode output is processed to extract the Doppler shift frequency (in the sub-sonic or audio range) and that is fed to a counter.


Oh, and there is a reason that the rubber hoses are the standard equipment for traffic counting.

Henry_Best:
Think of the tyre width. A bicycle has narrow tyres, a car has wider tyres and a truck has the widest (or sometimes multiple) tyres. The amount of air squeezed out of the tube will vary, depending on the width of the tyres (= length of tube squeezed).
The old type of traffic counter had a U tube of mercury connected to the air tube. As the air was squeezed, it would push the mercury up the tube to make an electrical contact. These aren't used any longer, due to the dangers of using mercury.

Got it;)

Meanwhile I got the code from the counter I mentioned in the initial post. Now, I'm not very good at coding, so I have some doubts, mainly related with this part of the counter (counting trucks).

As I understand (much likely, wrong) there's some kind of TTL when counting a vehicle, i.e., if ot detects a change in pressure but after a few seconds there's no other change, the counter will discard/ignore that change, right.
So, what about trucks, will it consider all axles as one truck or will it consider as 2 trucks driving very closely to each other?

Code here.

Basicly, my main doubt is, how will this actually work?

if ot detects a change in pressure but after a few seconds there's no other change, the counter will discard/ignore that change, right.

Unless you need to count the number of unicycles, yes. :slight_smile:
But think of a car travelling at 50 MPH.
50 MPH = 33ft/sec.
A car has an approx. 6ft wheelbase.
Therefore, the two pressure peaks will be about 1/5 second apart (~200ms).
Waiting "a few seconds" may miss several cars.

I have seen something like this that was taped to the roadway. very thick tar tape.

Henry_Best:
Waiting "a few seconds" may miss several cars.

If they are tailgating.

Ok, so most people do ignore the recommendation on timing between cars following.

Wooops!
A car travelling at 50 MPH travels 80 ft/sec, not 33 ft/sec as I stated above.
A 6 ft wheelbase car will give pressure peaks 75 ms apart.

60 mph = 88 ft/sec.
50 mph = 50/60 * 88 = 73.3 ft/sec

60 miles/hr * 5280 ft/mile * 1 hr/60 min * 1 min/60 sec = 88 ft/sec

CrossRoads:
60 mph = 88 ft/sec.
50 mph = 50/60 * 88 = 73.3 ft/sec

60 miles/hr * 5280 ft/mile * 1 hr/60 min * 1 min/60 sec = 88 ft/sec

88 ft/sec
3 second rule, 3*88=264 feet or 1/20th of a mile
a soccer field is 100 m (110 yards) or 330 feet.
I cannot remember the last time I stayed a football field behind the guy in front of me whilst in traffic.
A Cadillac is about 15 feet long. that is roughly 6 cars end to end for 90 feet. so, 5 car lengths would be about a second.

Cadillac sedan is 202", nearly 17'.
At highway speeds, I bet most people are well under 100' apart. Especially at rush hour - more like 2-3 car lengths.
A lot closer at slow speeds.

Ok, so unless the vehicle is going really slow, there's no risk of the counter ignoring the first pressure change or count the first 2 as a vehicle and the other 2 as another vehicle (in the case of trucks), right?

Overall, the counter will count a 2+ axles truck as one vehicle, right.

BTW, the counter assumes a distance between axles of 2.75m, and uses this to calculate the speed, right?

(I'm sorry there's so much time between answers and questions, but I'm working on different things at the same time, and, for now, this is not a priority, although I need your expertise :wink: )

PCanas:
Ok, so unless the vehicle is going really slow, there's no risk of the counter ignoring the first pressure change or count the first 2 as a vehicle and the other 2 as another vehicle (in the case of trucks), right?

Overall, the counter will count a 2+ axles truck as one vehicle, right.

BTW, the counter assumes a distance between axles of 2.75m, and uses this to calculate the speed, right?
(I'm sorry there's so much time between answers and questions, but I'm working on different things at the same time, and, for now, this is not a priority, although I need your expertise :wink: )

To measure speed, it's usual to have two parallel tubes placed about 10" (25cm) apart in the roadway. The time delay between the two tubes being squeezed tells you the (approximate) speed of the vehicle.

I have made it using ultrasonic sensors ,tested and it is working properly for vehicles moving at moderate speed.
Here is the video:

RajatKalyan:
I have made it using ultrasonic sensors

My Internet is painfully slow today, but I've bookmarked that to watch later.

I have made it using ultrasonic sensor ,node mcu and arduino nano. It detects all the vehicle that are moving at moderate speeds.
Here is the video : - YouTube
Here is the blog: imrajatkalyan.blogspot.in/

Henry_Best:
Wooops!
A car travelling at 50 MPH travels 80 ft/sec, not 33 ft/sec as I stated above.
A 6 ft wheelbase car will give pressure peaks 75 ms apart.

This is why the metric system was invented.