SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By noctolater
#104165
I work in a parking booth, and I often need to keep exact track of the number of cars that have gone in and out of the parking lot. As such, I am trying to build a device that will let me keep track of the number of cars. The parking lot is for a public park, so I only have one lane of traffic entering and one lane of traffic exiting from the booth (both of which are within feet of my location). Also, I have many pedestrians walking in and out of the park throughout the day.

After looking around online, I figured out that the way traffic sensors work is one of two variations. Either they use the black tube that has a sensor at the end that reads the puff of air from the car running over it, or they create a magnetic field that is disrupted when the car drives over it.

So now, my question is this - how can I best implement some form of car counter? Are the pressure sensors here on sparkfun sensitive enough to read the air from the black tube, and where can I get some of that tube? How could I generate a magnetic field for the car to disrupt, and would a reed switch or all effect sensor be able to pick up on the disruption? Or, could I go completely simpler and use some sonic range finders (though I am worried about the pedestrians throwing off the sensors in that case)?
User avatar
By utoxin
#104166
You could also get one of the force sensitive resistors, and lay it out where the car's nearer tires will run over it. Count the number of tires that roll over it, divide by 2, and you're pretty close to the number of cars. (barring trucks with trailers, etc.)
By noctolater
#104180
My fear with that would be that the force sensor is not designed to take a few thousand pounds of force :P Barring that, I think that would be the most feasible answer.
By emf
#104186
The air pressure sensors here are designed to measure very small pressures, gently blowing on one will register a change. If you put it in a closed tube and ran a car over it, you could destroy it. I guess you could put a big hole in the tube so it can't build up much pressure, but that could make it difficult to handle both slower-moving and faster-moving cars. I'll bet the normal traffic counters use low-tech mechanical pressure switches.

If you're interested in the magnetic approach, honeywell has an app note an218 that's worth a look.

Traffic lights often have a big inductive loop under the pavement, so that may be worth a look too.
User avatar
By utoxin
#104189
noctolater wrote:My fear with that would be that the force sensor is not designed to take a few thousand pounds of force :P Barring that, I think that would be the most feasible answer.
Check the datasheets on them. I know some of them can easily handle 1000 pounds with just a changed resistor, so they can probably take a lot more than that physically. If in doubt, mail the manufacturer and ask what their maximum load is. Also: You're unlikely to get more than 1000 pounds on a single sensor, since a tire only bears 25% of the weigh of the car, and your sensor wouldn't be taking even /that/ whole load all at once. I'd guess that with a narrow sensor strip that doesn't stick up more than a quarter inch or so, you'd be taking 500-600 pounds of load.
User avatar
By utoxin
#104190
For example: My 2004 Pontiac Grand Am is just over 3000 pounds curb weight. That's 750 pounds per tire. Assuming your sensor is large enough to be 50% of the contact patch, you're still only getting 375 pounds of force.
By lyndon
#104200
Since it seems like you're new to electronics why not start out a bit smaller.

You can use an Arduino or other microcontroller to make a counter that takes two pushbutton inputs. One pushbutton will count the cars coming in when you press it, the other will count cars leaving. Using an LCD display you can do something like:
Entering: 56
Leaving: 20

This would be a well-scoped project that you can start with and all the parts can be purchased from SparkFun.
By Sheepdog
#104225
a) By all means, whatever your prior experience, start with Lyndon's suggestion... you'll have a lot of fun, you'll get started with something that can do many, many things down the road. And which you will need WHATEVER sensors you eventually deploy.

Arduino Intro (with "what you have to buy"... not much, etc)...

http://www.arunet.co.uk/tkboyd/ele1psa.htm

b) Are the entry/ exit paths covered? If you can mount sensors on the ceiling, looking down on the path cars will travel, you'll find it easy to do the job. Ultrasonic range finders would be one "answer".

If distinguishing people from cars is vital...

Put TWO sensors about 4 feet apart, along the axix of the car's motion. Even then, a REALLY big person, or two people walking four feet apart could trigger a "car" event... so add to your Arduino something to beep when a car is seen, and two buttons... one to "put back" the "in" count, the other to put back the "out" count as necessary.

===
Oh. Or you could just do the whole thing with one or two webcams and WebCam Looker, using it's ability to run code when motion is detected.

http://webcamlooker.com

(It can have two areas of motion detect, handled differently, and the sensitivity can be set to ignore "litte" events like a person.)

(This wouldn't actually be QUITE as easy as that... but it would be do-able. You'd need programming skills to accept the code sequences triggered by webcamlooker.)
By Grimfox
#104233
My initial thought was the same as lyndon. Once you get something that will react to a push button response getting it to react to a sensor input will be a lot easier.

If the pressure sensors are as sensitive as you say i'm thinking that some gardenhose with a nozzle attached to one end to "blow" on the sensor should be sufficient to trigger a car passing. You may not even need a nozzle. In similar fashion you could use a plunger that pops out and hits a button when the hose is compressed. Saving you some effort in reading the sensor. Either case will require some tuning to either sense a car but not a human or child who tend to like to step on such things.

Range sensors could work too you might have to come up with some arangement that prevents false positives you could probably get away with two, set up to trigger a car event by detecting an object for X amount of time. You could always reprogram your buttons to act as -1.
By ZapWizard
#104258
You can get neoprene rubber tubing at McMaster.com. Just drill a few holes near the actual air sensor such that it doesn't overload it, and lets the air out as the car goes over. However a rubber tubes is not a permanent solution. The types run across roads are typically for temporary counting and have the tubes replaced often.

You can get commercial magnetic sensors, just Google "Driveway sensor".

The amount of pressure exerted from a heavy car depends on the surface area of the tires. You may only have to deal with a few hundred pounds of pressure on a force sensor.
By Sheepdog
#104289
Hose approach: A sealed hose filled with water will have advantages over the "puffs of air" solutions as water does not compress. As for the need to replace the hose frequently...

a) If you design your system well, then a complete replacement of the car sensor, should the hoses approach not work, shouldn't be hard.

b) The ones used for traffic surveys have a harder life than yours will.

===
Be sure your system has a way to adjust the count shown, to compensate for miscounts. In addition to the "add one"/"remove one" feature already discussed, if your garage closes for part of the night, and is empty at the end of the day, you might want a "set it to zero" button... assuming you don't get overnight parkers.
By noctolater
#104306
Thanks for all the wonderful notes! A few things to mention (that I probably should have at the beginning):

I already have the design implemented for a manual count with buttons, with 3 buttons (up arrow, down arrow, display/reset button). Because of the way the booth is positioned, I can not always see every car leaving, and when it gets busy it is hard to continually increment the counter. My ideal would be some sensor that can detect a car entering/leaving that I can add as inputs to the code I already have. That way, I still have manual control when someone comes in, but drives through the park to exit (like a Ranger in their car). My intent in starting this topic was to see what the best ideas for actually sensing a car would be. I think that the force sensors, assuming I can prove they won't overload, would be my best bet. They seem like the relatively cheapest and easiest to implement. Also, and this is something that I should have mentioned at the beginning, I need the system to be able to be rolled up and taken with me since I do not want anyone stealing it when we close at night :P Thank you all so much for your advice and help!
By Nat_Vanish79
#199487
This is not a simple problem at all. Not a DIY 3-6 months project.

I bumped onto quite good blog post on vehicle detection sensor accuracy. The executive summary - you need to use a combination of sensors and build lots of data but it's indeed worth reading in full if you are serious about the topic.