Traffic Counter Setup
Things I used:
- A loop under the road, 50 cm apart
- A detector, a Sarasota 215B with an external transformer from 240VAC to 120VAC.
- A Raspberry Pi B+
- 16GB USB memory connected to the Pi
- Every time a vehicle is detected over the loop, the Sarasota is triggered and a relay closes.
This is detected by the Pi which updates its database and also writes
this event to a small textfile which is published on a web page.
- The first event in a new month triggers a creation of a new database and a backup of the old one.
A summary of last month's traffic is published on the web page and the counter is set to zero.
- Every new year a summary of the entire traffic is published to the web page.
I have two detector loops using the same UTP CAT5 feed.
Since the loop cable have multipel leaders I can chose how sensitive I want
the loop to be by connecting each turn in serial, E.G. below the blue and brown
is connected in serial.
I replaced the old connector.
For the second loop, I'm using only the blue cable.
(If these two loops were on the same road and separated by a known distance,
the Pi could theoretically calculate the speed of a passing vehicle.)
Three LEDS and the white cables from the relay.
To protect the Raspberry's GPIO ports and to prevent bouncing,
I added two 2.4k resistors in series and a capacitor and a resistor in parallell.
This is the Python program running on the Pi.