Searching for sensors to count cars in parking areas

Hi,

I'm working on selecting parts for a project to count cars in parking areas.

The project parts for now:

  1. STM32 or ESP32 controller
  2. P10 led panels with required power supply
  3. Suitable sensors for the project

I think this method is a good one:

image

But I don't know what kind of sensors to use.

I want to know if there are other better sensors in the market ? what kind or method to choose ?


More information about the project:

  1. For main parking entrance/exitance gate
  2. Asphalt street type
  3. Count entering/exiting students' cars
  4. Use led P10 panel information sign to inform students about the available parking slots; like this one:

A google picture for the parking shape:


a

1 Like

Car Counters - ParkHelp

1 Like

do the above pictures represent your actual project or just something you found that uses sensors to detect cars? Are your sensors just counting cars or are they part of something else such as a gate opener. You need to give far more detail. Like will the cars be stationary at a gate or moving. Are you counting in and out or are you counting for each space. Will there be pedestrians to account for? What number of cars are you counting, how fast will they be going, what surfaces do you have to mount the sensors, is it indoor or outdoor, etc etc.

If it is just the above picture then there is plenty of off the shelf solutions. Google is your friend. ultrasonic/beam break etc could work

1 Like

No, it's just an image I found on Google image, but I think it's a very good design as also I'm not specialized in these types of projects. I've done some small college projects, but not big ones that works in real life.

And it's a challenge for me to do a project that works in real life situation and also test if the project is prone to errors and failures.

No, just to count cars and display the information on a matrix display.

I'm sorry I should've put some more information in the main post. Let me add some more explanation to my project idea.

count moving cars.

Both in and out.

[quote]Will there be pedestrians to account for?[/quote] No just cars.

Good points, didn't think of these details because I thought it should work ok.

In my project case:

  1. it's outdoors
  2. for college parking
  3. asphalt streets type
  4. main target in the main student parking gate entrance/exitance
  5. cars' speed is the normal parking gate entering/exiting speed; like, 5-20 km/h
  6. mounting the sensors depends on where to mount them, under the asphalt or in those modules in the picture in the main thread post

Could you provide me with some examples ?

If cars have one way in and a different way out it is easy. You need 2 sensors for each to detect in/out. These should be positioned far enough apart that both sensors will be blocked by a car but are unlikely to get blocked by, for example, a person. The sensors can be either an ultrasonic distance sensor or a beam break sensor (the later either requires a reflector or the beam/sensor to be on opposite sides of the road). In your code if both sensors are activated at the same time you can assume a car has passed. You may have problems with trailers being counted as a second car. You might need to code some delay between sensing 1 car and another to prevent this.

If cars use the same entrance and exit then you need to detect in your code which sensor was activated first and second to determine the direction of travel but also to only count if both sensors were active at the same time

eg sensor:
RS PRO Through Beam Photoelectric Sensor, Barrel Sensor, 20 m Detection Range | RS (rs-online.com)
Waterproof Ultrasonic Module JSN SR04T Water Proof Integrated Distance Measuring Transducer Sensor for Arduino|Sensors| - AliExpress

1 Like

... or, just count the number of times the entrance gate opens and count the number of times the exit gate opens. These devices account for small vehicles and trailer drawn vehicles.

What is not accounted for is tailgating behind an authorized automobile.

[quote="pmagowan, post:6, topic:1025914, full:true"]
If cars have one way in and a different way out it is easy.[/quote]

Yep, there is a way in and a way out. But I've done a project to count people with one door. As if sensor A triggered then B, in this case the program count it as entering count. And if B triggered then A, this case it's exiting count.

Alright, that's a good point ! That's different than the method I used in people counter project, and it's more proof to ensure than a person doesn't trigger the system.

I got you, so you mean that both sensors must be triggered at the same time to register entrance/exitance.

So do both offer same functionality and efficiency ?

That's an important point in the design, but I don't know about putting another part on the other side, maybe the ultrasonic is better in this regard.

Thanks for the advice to put into consideration.

Yep, I worked with this code and I still have it, of course I have to do some modifications to improve it.

What you mean ? how to do this ?

That would be difficult, because the gate sometimes is open for a long time to pass multiple cars.

The ultrasonic sensors are cheap and already come with all that is required to get them up and running on an arduino. I would work with one sensor initially on the breadboard and make sure you can get an input from it. Then add the second one. I don't know what you are doing with your count but you will have to decide how you want to read it. It is easy to code it in a variable.

It will be easy to rig up a prototype with some basic hardware. The sensors can be mounted in a junction box and connected by electrical conduit. It depends how close the in and out are as to whether it is easier to use 1 or 2 arduinos. It also depends on what the purpose of the project is. If you wish to display a carpark full/spaces available sign then you must have a way to reset your counter from time to time otherwise any errors in the count could eventually add up over time.

1 Like

Yep, my previous project was using those small IR modules:

image

Yep, that should be easy to do, this is part of the code I've done previously:

void ir_people_count_set(void)
{
	if(!digitalRead(BUILDING_GATE_IR_1) && (ir1_trigger_flag == 0) && (ir1_trigger_flag == 0)){
		ir1_trigger_flag = 1;
		Serial.println("ir1_tri is triggered");
	}
	
	if(!digitalRead(BUILDING_GATE_IR_2) && (ir1_trigger_flag == 0) && (ir2_trigger_flag == 0)){
		ir2_trigger_flag = 1;
		Serial.println("ir2_tri is triggered");
	}

	if(!digitalRead(BUILDING_GATE_IR_2) && (ir1_trigger_flag == 1) && (ir2_trigger_flag == 0)){
		entering_state = 1;
		digitalWrite(ENTERING, HIGH);	
	}
	
	if(!digitalRead(BUILDING_GATE_IR_1) && (ir1_trigger_flag == 0) && (ir2_trigger_flag == 1)){
		exiting_state = 1;
		digitalWrite(EXITING, HIGH); 	
	}
	
	ir_trigger_set_st = ir_trigger_set_cr;
	
	if((entering_state == 1) || (exiting_state == 1)){
		ir_trigger_reset_cr = millis();
		if(ir_trigger_reset_cr - ir_trigger_reset_st >= ir_trigger_reset_prd){
			ir_people_count_reset();
		}
	}
}

It will be easy to rig up a prototype with some basic hardware.

That's what I want to do before putting it outdoors.

The sensors can be mounted in a junction box and connected by electrical conduit.

The wiring should be done this time with wires, I've thought of using wireless but in the next plan using ESPs.

Or, use high distance wireless modules; like, LoRa.

It depends how close the in and out are as to whether it is easier to use 1 or 2 Arduinos.

I think one Arduino should be enough.

It also depends on what the purpose of the project is. If you wish to display a carpark full/spaces available sign then you must have a way to reset your counter from time to time otherwise any errors in the count could eventually add up over time.

I'm planning to put some control buttons in the control box for the college officials, and put a card of instructions of how to do stuff; like, adjustments, set the system, reset the system, ... etc.

I found this image:

What you think of this method ? I think it's using electromagnetic signals like the ones in some traffic light systems to detect the car existence and give it green light priority instead of waiting if the other traffic sides are empty.

But I think this one is a bit difficult because we have to put holes in the asphalt. Using ultrasonic sensors should work the same and easier to install.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.