# Designing and Managing a Smart Parking System Using Wireless Sensor Networks
## 3 Architecture of the Smart Parking System  
The proposed system contains three essential parts: parking detection centre, parking monitoring centre, and global information management centre. * The parking detection centre is composed mainly of hybrid sensor nodes (sensors + RFID readers) that are installed in each parking space in each area, these sensor nodes form a wireless sensor network (WSN) allowing to collect the states of all the parking spaces (available or occupied) to send them to the gateway (Sink) of this area, this information will be sent afterwards to the central server to store them in the global database. * The parking monitoring centre is responsible for identifying and checking the cars that have just parked in a reserved or available space. This centre uses the RFID technology to control and monitor the one hand the parked cars, and the other hand, for identify and manage the payment of parking time. * The global information management centre is a database where all information detected and collected from all car parks in the city is recorded and exploited in real-time by web or mobile applications. In this way, drivers will have all the information on the available spaces in all the car parks of the city, to consult these spaces according to their destination, and to pay the parking fees. Figure 5 shows the architecture of the proposed smart parking system:  
Figure 5: The proposed architecture of smart parking systems based on a WSN. To form a network topology by the sensor nodes in an outdoor parking, all the nodes send their coordinates to the gateway which executes Algorithm 1 making it possible to calculate and detect the type of topology to be formed. In the case of linear parking, the gateway detects that all the nodes have the same X coordinate or the same Y coordinate as a function of the distribution of the nodes in the parking area. In this case, the gateway requests the nodes to create a chain topology in the network to minimize power consumption between the nodes using the multi-hop communication to the gateway (Figure 8). Figure 8: Example of a distribution of the sensor nodes in a linear parking area. Figure 7: Formation of cluster topology in the mass parking area. In the contrary case (mass parking), the gateway detects that all the nodes do not have similitude in one of the coordinate parameters (X or Y), so it will order the nodes to form a cluster topology to increase the longevity of the network knowing that, in this case, there are a large number of nodes scattered in the parking area (Figure 9). After the execution of the adaptable self-organization algorithm (Algorithm 2), a chain of the sensor nodes will be formed in the city's linear car parks, where all the nodes dispersed in each parking area will send their detected data via multiple hops to the node leader, who will gather and transfer all data from the parking to the gateway of each parking area. In the case of mass car parks, a cluster topology will be created in each parking area in the city where all sensor nodes will form clusters and in each cluster a CH will be elected to receive the detected data from all nodes in its cluster, and transfer them via a single hop to the Gateway (sink). The formation of the chain or the formation of clusters will be based on the residual energy of the nodes and the overall energy of the network to maximize the lifetime of the nodes and increase the longevity of the network WSN. Figure 9: Example of a distribution of the sensor nodes in a mass parking area. The sensor nodes are installed in each parking space and in each of the parking areas, which makes it possible to detect the presence or the absence of the vehicles in the latter. Each parking area (parking) is identified by an IDzi, and each parking space in a parking area is identified by IDpj, so each sensor node is identified by two pairs of the identifiers (IDzi, IDpj).