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!