Ideas for Traffic Counter

Hi!

First of all, I’m a complete noob about anything Arduino related. In fact, I don’t even have a board… yet.

I work in the transit (traffic?) department of a townhall (in Portugal), and I’ve been searching for cheap, easy to use traffic counters.

On my search, I found this project. I didn’t read it to detail, but I understood it’s principle: there’s a hose connected to a pressure sensor that detects changes in the air pressure inside the hose when a vehicle passes.

It’s chep and easy to use, but I can find some limitations:
1- the hose will eventually break;
2- it requires objects to be layed on the road;
3- it can’t cope with heavy traffic (see 1);
4- I didn’t read the code, but I assume it counts every two pressure changes as one vehicle, assuming two axels per vehicle. So… what about trucks?

(5- it won’t give additional information, such as speed and/or direction - not exactly a limitation, but…)

Having this limitations in mind, I thought about a different design, something that doesn’t requires physical contact with the vehicle. This led me to two options: IR sensors or ultrasonic sensors (or maybe a combination of both)

Idea for IR Sensors

The way I see this working is a continuous IR beam that is interrupted when a vehicle passes between the emitter and the receiver, thus counting one vehicle.
This design requires an emitter and a receiver, since there are no IR sensors that receive their own emissions (or are there?) and cars may not reflect light that well, or even if they do, it might not be in the direction of the sensor.
With this in mind, we have the limitation nº2 mentioned before, because the car has to pass between the emitter and the receiver, wich means one of them has to be placed in the middle of the road.
Plus, it would require at least two boards per way of traffic, one for the emitter and another for the receiver. Either this, or you’d have to lay cable across the road to connect the emitter/receiver to the board (limitation nº2 again)
You might also have the problem described in nº4 (because in some trucks there’s a small gap between the cabin and the trailer).

And there might be some smarta$$ that finds out how it works and interferes with it with a tv remote or something…

Idea for Ultrasonic Sensors

There are two ways I see this working:

With One Sensor

Since ultrasonic sensors can receive their own emissions, this design can work with just one sensor.
The idea here is to use the US sensor as a distance measurement device. The sensor would be place at a distance from the road, such as it’s maximum range is the middle of the road (this way preventing the sensor from measuring both ways of traffic). This can also be achieved by aiming the sensor in an angle, pointing down, allowing you to place the sensor closer to the road’s edge.
It would count a vehicle any time he measures a distance smaller than the one measured when there’s no vehicle passing by. Let’s say the distance without a vehicle is 3m, so everytime a vehicle passes by, that distance will decrease, the sensor will get that change and count a vehicle.

The limitation mentioned in nº4 can be avoided by aiming the sensor in an angle towards the traffic, instead of placing it perpendicularly to the road.

With Two Sensors

The main advantages I see with this designed, compared with the previous, is that with two sensors, I can find the speed of the vehicles, measure the time it takes to pass in front of one of the sensors, and with some math, find out an aproximate size of the vehicle, and with this, the type of vehicle (car, truck, bike, etc).

The idea is:

  • sensor 1 (S1) is aimed in an almost in-line angle with the traffic, obviously pointing “in the wrong way”. This sensor would measure the speed of the vehicle, by measuring how fast the distance from the vehicle to the sensor is decreasing.

  • sensor 2 (S2) would work almost as in the exampe above (One Sensor): it would measure the distance change and trigger a counter that will tell the time the vehicle takes to pass in front of the sensor (and count one vehicle).

  • considering the speed of the vehicle and the time it takes to pass in front of sensor 2, we can find out the size (lenght) of the vehicle and, therefore, the type of vehicle.
    Obviously the vehicle may be aproaching the sensors accelerating or breaking, so the speed measured by S1 may not be the speed the vehicle has when passing by S2.
    This will require some margin of error in the calculations.

With all this, I would like to know your opinions about my ideas. What is ok and what is wrong with them and their concepts. Are they viable?
As I’m sure you understood, I would like to avoid a counter that requires placing objects on the road itself.

Thanks for the help! :slight_smile:

PCanas: The way I see this working is a continuous IR beam that is interrupted when a vehicle passes between the emitter and the receiver, thus counting one vehicle. This design requires an emitter and a receiver, since there are no IR sensors that receive their own emissions (or are there?) and cars may not reflect light that well, or even if they do, it might not be in the direction of the sensor. With this in mind, we have the limitation nº2 mentioned before, because the car has to pass between the emitter and the receiver, wich means one of them has to be placed in the middle of the road.

That's not actually needed. You could use a "reflective light barrier" that has the transmitter and receiver at the same place on the same side of the road. In the middle of the road you then just need a reflector. Such like that: http://www.conrad.com/ce/en/product/156433/Pepperl-Fuchs-H50-Reflector-For-Reflective-Light-Barrier

So the IR beam is sent to the middle of the road to the reflector, reflected back to the origin and detected with a IR-sensor just sitting side by side to the IR transmitter.

But with reflective light barriers you will need a much more powerful IR beam transmitted than you would need with a direct beam light barrier. There are a lot of ready-to-use light barrier products on the market, but they are not really cheap if you need long range detection.

  • sensor 1 (S1) is aimed in an almost in-line angle with the traffic, obviously pointing "in the wrong way". This sensor would measure the speed of the vehicle, by measuring how fast the distance from the vehicle to the sensor is decreasing.

Don't forget the doppler effect. The frequency of the returned signal will be higher (for an approaching vehicle). Something to consider - does this affect the distance measurement?

http://www.mwit.ac.th/~physicslab/applet_04/physics_classroom/Class/sound/u11l3b.html

This website might interest you, although it's model trains not real cars and trucks on real roads.

I suspect a lot of traffic counters now use inductive loops in the road.....

Jurs, that still requires putting things in the road...

Dlloyd, in fact, didn't consider that... since it changes the frequency of the reflected sound, what may happen is the sensor won't be able to detect the new frequency?

JimboZA, yes, I know about inductive loops, but it requires putting things on the road... and is certainly more expensive.

Don't get me wrong, I'm not completely against placing things in the road, but I wan't to avoid it as much as possible, to keep down both cost and parts breaking/wearing.

here in New Jersey, I h ave seen the hose accross the road. and yes, you much perform maintenace on it when it breaks. often lasts up to a week.

I have also seen a box that is about an inch high taped to the road in the center of the road. this senses the metal of the car as it passes. it has to be very heavy as truck can run over it.

here is a similar sensor only much-much thicker, for detecting parking spaces.

http://www.technologyreview.com/news/410505/find-a-parking-space-online/

also found this http://www.rosimits.com/

I can't help feeling that your long original post is, in fact, the justifcation for inductive loops.

You don't seem to have considered using a high-mounted camera and image processing software - obviously not an Arduino solution.

...R

It would be worth trying it out with a IR light barrier setup.

Challenges with IR: - Sunshine is the big enemy, but there are ways to minimise this. - Jamming from TV remotes (they will generally tire of it quickly, after the first few laughs) - pedestrians etc . You would need to create a custom set of profiles of acceptable time patterns for passing, using at least 2 beams to distinguish between the various road users. - multiple lanes & directions will also need filtering. - Unlikely to deliver 100% accurate results, but more than good enough for trends & analysis. - pulsing the IR signal with your own pattern, will help eliminate false positives (and some but not all potential jamming)

Using reflectors & multiple beams at varying heights will help to improve the profiling.

Another approach, would be to use a Raspberry pi (or similar) + camera to do realtime image analysis. I have seen some good approaches for that(not for traffic)....via search. You might be able to tap into existing traffic cams, if available??

You could even try an ANPR type of approach. The number plates will reflect IR very well, but you wouldn't need to do the number recognition (=much less cost).

AnalysIR: - Unlikely to deliver 100% accurate results, but more than good enough for trends & analysis.

When I was a newly graduated civil engineer, working in traffic and transportation, we were doing a big survey in a town about 100km from Johannesburg. We set up in our deck chairs on a corner in the cbd, with clip-boards with clicker thingies to count who turned and went straight.

Some guy with waaaaay too much time on his hands, in a very recognisable car (a lime-green Capri mkI iirc) went round and round the block for ages, smiling broadly, obviously assuming his few counts would totally throw our calcs. All he did was waste fuel and take a bit of life off his clutch.

Did a similar summer job as a student engineer in the traffic dept here in Dublin. .....but we never got chairs.

I also heard stories that some naughty students got bored & started guessing the numbers instead of using the clickers, which of course made them totally unreliable.

You can only guess what happend with access to the city traffic management computer system :)

IIRC, I raided my then girl-friend's parents garage for the deck chairs, not company issue.

JimboZA: When I was a newly graduated civil engineer, working in traffic and transportation, we were doing a big survey in a town about 100km from Johannesburg. We set up in our deck chairs on a corner in the cbd, with clip-boards with clicker thingies to count who turned and went straight.

This is exactly the same how traffic census is done in Germany.

If the politicians decide "we need new traffic data for the road xy", a traffic census is organized with people standing by the road using clicker thingis to count the traffic for 24 hours.

Each road is counted three times in most cases (I think): 24 hours on a typical weekday, 24 hours on a Friday and 24 hours on a Sunday. It should be days selected, so that no construction zones, no events in the street or nearby and no school holidays will lead to more or less traffic on the road that is going to be counted.

So each hour will be summed up by clicker thingies, handled by persons: - number of cars - number of trucks - number of bicycles - number of pedestrians 24 hours = 24 data sets for passing traffic from "left to right" and different values for the other direction "right to left" with traffic values for each hour and seperated for cars, trucks, bicycles and pedestrians.

Then after counting, the data for typical weekdays, Fridays and Sundays will be used for plannings the next couple of years, until the politicians decide "we need new traffic data for the road xy" and the whole thing is repeated.

When I was a student a mate and I did a project where we counted the number of occupants too. Mark1 eye-ball as the sensor.....

Robin2:
I can’t help feeling that your long original post is, in fact, the justifcation for inductive loops.

You don’t seem to have considered using a high-mounted camera and image processing software - obviously not an Arduino solution.

…R

I have considered the camera. Costs?

PCanas: I have considered the camera. Costs?

I understand. But reliability is not cheap for this sort of thing. Otherwise some business would have the gadgets for sale across the counter (could not resist the pun).

...R

air hose is best, hose is cheap to replace, not designed for long term data collection
speed can be calculated by arduino if you use two tubes and space a standard distance apart
tandum axle trucks can be detected by a filter, if it is a car it will say bump—bump, if it is a truck, it will say bump----bump-bump just listen for the signal

Greensprings: air hose is best, hose is cheap to replace, not designed for long term data collection speed can be calculated by arduino if you use two tubes and space a standard distance apart tandum axle trucks can be detected by a filter, if it is a car it will say bump---bump, if it is a truck, it will say bump----bump-bump just listen for the signal

An articulated truck with a 2 axle trailer will give almost the same signal as two cars travelling close together.

3-axle trailers are standard in Europe.

...R

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??

I'm enjoying this brainstorming :)

BTW, does anyone knows a way to print the project I linked in the first post?

On another subject, what board do you recomend for someone who has 0 experience in this, and wants to build this project?

I was thinking about the Mega 2560 , since it has more expansion capabilities than the Uno.

Meanwhile, I thought about using the utlrasound method, but vertically, with the board and sensor placed above the road (like traffic lights). Obviously this would require extra work, but what do you think would be the dis/advantages of this method?