-
Notifications
You must be signed in to change notification settings - Fork 0
Home
I wanted to collect hard data on the day-to-day traffic on my single-lane street. I set out to find a low-cost way to automatically detect cars, direction of travel, and travel speed. I initially considered a microwave (aka radar gun) approach, but it proved to be too costly or for much lower speed than what I needed (up to 40mph).
I decided to explore a pressure based system, like the old bell triggers in full service gas stations. By laying two hoses across the street with a known gap, I could easily compute the speed of vehicles as they roll over the hoses.
One of the key design constraints is the very short time required for a car to cross the space between the two pressure hoses. Using a 1ft separation, a car traveling at 15mph will cross that gap in 45ms.
Pressure Sensor
I used two MPS20N0040D-D pressure sensors. This blog helped with the initial concept. I used a pair of simpler non-inverting amplifier, each fed into a MPC3202 ADC. Even though the OpAmps are supplied using 5V, the amplified signals does not go above 3V and thus can be safely fed into the ADC which is powered using 3.3V for direct connection to the CPU.
If you want to build your own, you can simply order a copy of my board from OSH Park. The uphill hose connects to the left sensor.
Processing
The data processing is done by a Next Thing Co.'s C.H.I.P. computer (as it is no longer available, a Raspberry Pi-Zero-W could be used instead). At 1GHz, it has plenty of processing power to process the data in real-time. The PCB for the pressure sensor and ADC plugs directly in one of the header, which also supplies power.
The pressure sensor data is read out using GPIO pins to generate the serial data interface protocol. Initial testing shows that, without any other processing, I can sample both pressure sensors every 0,3ms approximately, which provide plenty of resolution for a 12inch gap between the hoses.
From there, it is a "simple" matter of programming to monitor the data stream, recognize pressure increases, and translate those increases into direction of travel and speed. I even added a measure of the wheel base just for fun. Pressure data is in the first two colummns, and a usec-resolution timestamp is in the 3rd. Note: the caption in the picture below should say "12in @ 48ms".
Because the CHIP has integrated Wifi networking, it is connected to my home Wifi, allowing me to work on the software wirelessly from the comfort of my home while the entire apparatus sits by the roadside. The traffic data is automatically uploaded to Dropbox on a daily basis for safe-keeping.
Once the data is uploaded to my laptop, I can then analyze it and generate pretty graphs that make the traffic patterns easy to identify. Can you spot it??





