# An Intelligent Parking Management System for Urban Areas
## 3 Description of the System
### Detection of the Passage of Vehicles  
This section describes the method used to detect the passage of a vehicle on a road into or out of a parking area. The method is designed to detect cars, vans or larger vehicles of two or more axles. The sensor node is connected to two sensors that detect the passage of vehicles. Figure 7 shows the solution proposed using the GP2Y0D02 YK0F SHARP (Sharp Corporation, Osaka, Japan) infrared sensor. Each of the two sensors S1 and S2 was placed in a speed bump for protection and as a deterrent to encourage the vehicle's wheels to pass on each side of the speed bump. The distance, L, between the two bumps was fixed in order to detect vehicles longer than a certain length. The exit and entry monitoring process was carried out by controlling the activation and deactivation event of each of the sensors (On/Off). Knowing the precise situation of the two sensors and the distance between them, this configuration allows the passage of a vehicle and its direction to be detected, thanks to the order of activation and deactivation of the sensors (see Table 2). When a car is entering or exiting, the system starts from an idle state, in which no sensor is active. Then, an entering or exiting vehicle activates the first sensor, S1 or S2 respectively. As the vehicle continues its movement, the second sensor will be activated: S2 for entering vehicles and S1 for exiting vehicles. In the final stage before returning to an idle state, only one sensor would be active: S2 for entering vehicles and S1 for vehicles moving in the opposite direction. Figure 6: Structure of data packet sent by the sensor nodes. Figure 7: Deployment of the sensors. However, this configuration of sensor pairs is not sufficient to avoid false positives. To decrease the error rate, two timers, T1 and T2, were added to the monitoring process, one for each sensor, to avoid false positives. False positives can be triggered by a moving object; for instance, a person with a shopping trolley, passing through the sensor system, or if a vehicle reverses at the entrance, or if a vehicle uses the lane to perform a manoeuvre to change direction. Therefore, the distance parameters between the sensors and the timers monitoring the time of passage should be set with precision. The detection algorithm follows the sequence diagram shown in Figure 8. This diagram describes how the T1 and T2 values are associated with each of the sensors to detect different events: passage of a vehicle, vehicle reverses when passing through, or the vehicle is stationary. As the diagram shows, it is necessary to check that the vehicle has been detected by the two pairs of sensors. This avoids false positives in the event that the vehicle reverses and does not enter, or leaves the parking area. As the vehicle enters, a reading is taken from both sensors every second. If sensor 1 is activated, timer T1 is initiated to verify that the sensor has been activated by a vehicle and not a person or other object, and once the wait time has passed, a reading is taken from sensor 2. If sensor 1 is still active but sensor 2 has not been activated, it means that the vehicle has stopped. If, however, sensor 1 is deactivated without sensor 2 having been activated the vehicle has reversed. \begin{table}
\begin{tabular}{c c c c} \hline \hline \multicolumn{2}{c}{**Entry**} & \multicolumn{2}{c}{**Exit**} \\ \hline
**S1** & **S2** & **S2** & **S1** \\ \hline Off & Off & Off & Off \\ On & Off & On & Off \\ On & On & On & On \\ Off & On & Off & On \\ Off & Off & Off & Off \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Map of direction vector control events with two in-line sensors. Figure 8: Vehicle entry detection sequence diagram. If sensor 2 has been activated and sensor 1 remains active, timer T2 is initiated to verify that sensor 2 has been activated by a vehicle. If none of the sensors is then deactivated it may mean that the vehicle is stationary or that a long vehicle is passing.