A Street Parking System Using Wireless Sensor Networks

Recently, with the explosive increase of automobiles in cities, parking problems are serious and even worsen in many cities. This paper proposes a street parking system (SPS) based on wireless sensor networks. The system can monitor the state of every parking space by deploying a magnetic sensor node on the space. For accurately detecting a parking car, a vehicle detection algorithm is proposed. And an adaptive sampling mechanism is used to reduce the energy consumption. Eighty-two sensor nodes are deployed on the street parking spaces to evaluate the performance of SPS. By running the system for more than one year, we observed that the vehicle detection accuracy of the SPS is better than 98%, and the lifetime of the sensor node is more than 5 years with a pair of 2500 mAh Li batteries.


Introduction
Due to the explosive growth of automobiles, parking near the center of the city gradually becomes one of the most annoying things to carowners. In most cases, they find the indoor parking spaces nearby are always full, and they have to drive around to search available parking space on the street. Then a traffic jam may occur. With the continuous growth of automobiles, the situation becomes worse and worse [1]. So the demand for street parking guidance service is expected to grow rapidly in the near future. Wireless sensor networks [2] have lots of potential toward providing an ideal solution for street parking service, such as their low power, small size, and low cost.
Almost all road vehicles have significant amounts of ferrous metals in their chassis and engine (iron, steel, nickel, cobalt, etc.), so AMR sensor is a good candidate for detecting vehicles [3][4][5]. It determines whether a space is occupied or not by detecting the presence of a vehicle based on a change in the environment's magnetic field. Some algorithms [6][7][8] have been proposed for parking vehicle detection by AMR sensor. However, these algorithms have the following problems.
(a) A whole parking period of a vehicle can be divided into three phases: entering, parking stop and leaving. Most existing algorithms [6][7][8] only consider the signal's characteristic of the parking stop, phase. These algorithms perform well when the interferences are relatively low. However, if the low SNR (signal-tonoise ratio) is low, they will lead to increased false detection rate. (b) Existing algorithms typically sample the magnetic field at a fixed interval. This interval poses a basic tradeoff. A small interval can obtain more details of magnetic signals, but with higher energy consumption. A larger interval uses less energy but reduces the fidelity of the magnetic signal and may result in a false detection.
This paper proposes a street parking system based on WSN. Our main contributions are given as follows (a) A vehicle detection algorithm is proposed based on the integrated magnetic signal characteristics of a vehicle's entering, parking stop, and leaving phases. (b) To balance the energy consumption and accuracy of the algorithm, we design an adaptive sampling mechanism. (c) We deployed a street parking system which includes eighty-two sensor nodes. The system has been running reliably for more than one year. Experiment results show that the system detection accuracy is better than 98%, and it is energy efficient.
The remainder of this paper is organized as follows. Section 2 introduces the related works. Section 3 describes the overview of SPS. Section 4 proposes the vehicle algorithm. Section 5 describes the adaptive sampling and analyzes the energy consumption. Section 6 conducts experiments to prove the performance of SPS. Finally, Section 7 makes a brief conclusion.

Related Works
At present, the sensors used in vehicle information acquisition mainly include the following types: inductive loop detector [9], image (camera) sensor [10,11], acoustic sensor [12,13], infrared sensor [14], and ultrasonic sensor [15], The image sensor acquires an abundance of information, but it is vulnerable to bad weather and nighttime operation. The acoustic sensor and infrared sensor are vulnerable to noise in deployed environments. Magnetic sensors based on magnetoresistors have recently been proposed for vehicle detection [16,17] because they are quite sensitive, small, and more immune to environmental factors such as rain, wind, snow, or fog than sensing systems based on video cameras, ultrasound, or infrared radiation.
Many algorithms have been proposed for moving vehicle monitoring. The PATH program of the University of California, Cheung and Varaiya [4], had first extensively explored magnetic sensor network based vehicle detection system. Cheung and Varaiya [4] had explored the applications for vehicle detection, speed estimation, and classification. Experiment results show that the vehicle detection accuracy rate is more than 99%, and the accuracy rate to estimate length and speed of vehicle is more than 90%.
Zhang et al. [16] proposed a Similarity Based Vehicle Detection (SBVD) algorithm to detect vehicles in low SNR conditions by calculating the similarity between on-road signals and a referential signal. Besides, data fusion algorithm based on fuzzy logic theory has also been proposed to monitor parking space in the parking lot using magnetic sensor [17]. Both kinds of algorithms have high computational complexity.
The research for parking vehicle detection mainly based on ultrasonic technology. Kim et al. [18] introduced wireless sensor networks based parking management system. They used an ultrasonic sensor as vehicle detection module and adopted a clustered network topology. The system provides monitoring information through individual sensor nodes installed at each parking space.
The works of [15,19] also used ultrasonic sensors to implement a parking system. Additionally, the work of [15] implemented the shortest path algorithm to calculate the shortest distance from the parking berth to the nearest preferred entrance. In [19], Lee et al. implement and deploy a solar powered wireless sensor network in an outdoor car park to provide parking guidance. Although the ultrasonic sensor has a high accurate rate of vehicle detection, its performance is affected by environment, such as air turbulence and temperature change, especially the shielding of leaves or soil. The work of [6] discussed the effect of detecting vehicles by comparing the acoustic, visual light, infrared, temperature, ultrasonic, and magnetic sensors. Their experiments verified that ultrasonic and magnetic sensors have better accuracy and reliability in parking space. Commercial sensors, such as SENSIT system [20], can detect parking occupancy. Each node was equipped with two sensors: infrared and magnetic, and its vehicle detection accuracy rate is nearly 100%.

Overview of the Street Parking System
3.1. System Introduction. The proposed SPS consists of a base station, routers, sensor nodes, and a remote server. The diagram of SPS is shown in Figure 1. Sensor nodes are deployed alongside the roadside and each node is mounted on the center floor of a parking space. Each sensor node detects the earth's magnetic field periodically. When a node detected a car entering or leaving, it transmits a message to the router. The router forwards the packet to a base station that is one or more hops away. In the base station, information from different nodes will be merged, and parking guidance information will be transmitted to LED board and remote server.

Hardware Design.
We adopt ZigBee [21] as the wireless communication stack. Sensor node consists of HMC5883L [22] magnetic sensor. When deploying the sensor nodes in the complicated realistic environment, we faced several problems. One is the crush-resistant issue. Using high-strength PVC-steel material as node shell is a good choice for resisting the crush of the parking vehicles. Figure 2(a) shows the nodes with high-strength PVC-steel material. Another problem is to protect against the permeating rainwater through our node shell in bad weathers, we incised a circled lines around the chip location and fill with waterproof adhesive. As shown in Figure 2(b), considering the power issue, routers are equipped with solar panel for frequent data forwarding.

Test Field Setup.
In the experiments, we place the sensor node in the middle of the parking space. HMC5883L is a 3axis magnetic sensor. Figure 3 describes the deployment of sensor nodes: the -axis is vertical, the -axis is parallel with the direction of vehicle entering, and the -axis is pointing to adjacent space. HMC5883L has temperature drift, and the method of temperature compensation refers to its datasheet [22].

Vehicle Detection Algorithm
Sensor nodes have limited computing power and memory. Therefore the data processing algorithm must be simple. By referring to the prior work [4], an algorithm based on the threshold and state machine was designed for parking vehicle detection. The threshold detection mechanism is used to reduce the computational requirement of the algorithm so that it can be implemented on the sensor node's processor and generate detection results in real time. Figure  4, it is the three-axis magnetic signature of a vehicle parking process. A whole parking period includes three phases: entering, parking stop, and leaving. Initially, the parking space is vacant, and the values of , , are the environment's magnetic fields. Then a car enters the parking space and creates a fluctuation of the magnetic field. After the car parking stop, the car creates a stable disturbance on the environment's magnetic field. The parking space is occupied. Then the car is leaving the parking space and also has a fluctuation signature. Finally, the parking space is vacant, and the values of , , recover to the environment's magnetic field.

Signal Preprocessing.
For vehicle presence applications, the amplitude and direction of the magnetic field are not important, but the detection of a significant shift in the magnetic field is the key factor. The vector magnitude shift from the environment's magnetic field would be the most reliable method. Using digitized measurements of three-axis sensor outputs after amplification, the vector magnitude would be: A smoothing filter, which takes a running average of the signal, is used to smooth the signal. The running average is given by ( ) is the vector magnitude and is the predefined running average buffer size. For implementation, we use buf to store the values of [ ( ), ( − 1), . . . , ( − + 1)].

Fluctuation Detection.
Since the fluctuation of the magnetic signal is a key characteristic of the vehicle entering and

Stable Disturbance Detection.
There is an uncontrollable drift in the magnetic signal, which is mainly caused by the interference of adjacent parking spaces' vehicles. As shown in Figure 5, it is the magnetic signal of a parking space which is vacant in consecutive two days. All the three axes have different drift in two days. The drift has a negative effect on the detection of a vehicle in parking duration. In order to account for the drift in the long term, an adaptive baseline is used to track the background magnetic reading. The adaptive baseline is given by the following equations: disturbance which is incurred by a vehicle parking stop on the space. One has 4.5. State Machine. Figure 6 shows Only when the state machine is in "Occupied" or "C Below down ", ( ) = 1, otherwise, ( ) = 0. The following section is a walkthrough of the state machine's logical flow.

S1: "Init"
Assuming there is no vehicle in the parking space when the sensor node is being deployed. It will go into state S1 and start initializing the baseline with the environmental magnetic field.

S2: "Vacant"
After a predefined initializing time, it will jump to state S2 where the baseline is updated adaptively. It will jump to state S3 that has an Enter fluctuation and a stable disturbance is over threshold up .
S3: "C Over up " It was found that a vehicle signature produces a successive sequence of "1" in ( ) and this state is used to track such a sequence. If there is any "0" reading from ( ), it will immediately jump to state S4. Otherwise, if the number of successive ( ) = 1 has reached a critical value , it will jump to state S5.
S4: "C Below up " Within this state, it will jump back to state S2 after the number of successive ( ) = 0 has reached a critical value . In order not to lose a potential vehicle detection, it will jump back to state S3 again in case there is any ( ) = 1 reading.

S5: "Occupied"
Staying in this state implies the magnetic change is strong as the vehicle is on the sensor node, and the parking space is occupied. It will jump to S6 when the sensor detected a Leaving fluctuation and the stable disturbance is below threshold down .
S6: "C Below down " Within this state, it will jump back to state S2 after the number of successive ( ) = 0 has reached a critical value . In order to filter out spurious signals that are not caused by a car leave, it will jump back to state S5 again in case there is any ( ) = 1 reading.

Adaptive Sampling.
Usually, the time cost of the phase of a vehicle entering or leaving is between 0 s and 60 s. So the sensor requires a much higher sampling frequency to obtain the fluctuation signature. For example, a vehicle traveling at 10 mph will travel 10 feet before it comes to a parking stop. This entering phase will take less than one second. If the sampling frequency is 50 HZ, the sensor can sample about 50 numbers of magnetic data about the entering phase. On the other hand, if there is no a moving vehicle interference, the magnetic signal is stable and the drift in the magnetic field is smaller than 5. To balance the energy consumption and accuracy of the vehicle detection algorithm, we design an adaptive sampling mechanism. When there is one up-ordown fluctuation sample of the magnetic signal, if ( ) = 1, it samples the magnetic field faster until the biggest value (50 HZ). Otherwise, if ( ) = 0, it decreases the sampling rate exponentially until less than the smallest value (5 HZ). Thus, the sensor can quickly respond to the magnetic signal dynamics while incurring low overhead in the long term.

Analysis of Energy Consumption.
For battery powered wireless sensor networks, the network lifetime is a critical factor because replacing batteries for sensor nodes is a laborious task. The sensor node has no specific responsibility for maintaining the network infrastructure because it is an enddevice [21]. So the sensor node does not exchange packet for network maintaining when it has been joined the network. Sensor node samples the magnetic signal periodically. When it detected a car arrival or leave, it transmits one binary detection flag to base station. And it goes to sleep when no task. Ignoring the energy consumption in joining or rejoining the network, the energy consumption of a sensor node consists of energy consumed by detection flag transmission ( tran ), magnetic field sampling ( sample ), and sleep ( sleep ). In energy consumption experiments, a sensor node and a 10 Ω resistor are in series connection. So the sensor node's current can be obtained by measuring the voltage of the resistor ( = /10). We found the greatest contribution of power consumption is sampling unit. As shown in Figure 7(a), the energy consumption of a sensor node whose sampling interval is 50 ms. We can see that the measurement period of magnetic sensor is period = 6 ms, the average current of sample is about sample = 10 mA, and the current of sleep is sleep = 2 uA. According to the adaptive sampling mechanism, the energy consumption of sampling can be described as sample = sample * sample per second * , fast sample = inter * inter * biggest * period , slow sample = ( one day − inter * inter ) * smallest * period , fast sample and slow sample are the total time in one day of sampling using the biggest and smallest frequency, respectively.
inter is the interference times in one day. inter is the average duration of once interference. biggest and smallest are the biggest and smallest frequency, respectively. one day is the total seconds of one day.
As shown in Figure 7 sleep per second = 1 − sample per second − tran per second , (10) Using a pair of 2500 mAh AA Li batteries parallel connected, with the voltage of each battery being 3 V, the lifetime of the sensor node is calculated by (11). Given the parameters in Table 1, we can draw a conclusion that the sensor node can continuously work for 5 years without changing battery.

Experiments
To test the proposed system, we deploy eighty-two sensor nodes in the street parking of SIAT (Shenzhen Institute of Advanced Technology). As shown in Figures 8(a) and 9(b). Devices with magnetic sensors are nailed in the center of the parking spaces. The routers which are equipped with a solar panel for forwarding parking message are fixed on the street light, as shown in Figure 8(c). We developed a server system using Java language and MySQL database. As shown in Figure 9, using the graphical client interface, users can know which parking space is vacant or occupied and the occupied duration of each parking space. As shown in Figure 9(a), the nodes which ID signed as  integer, such as 6, 3, and 5, are router nodes. The nodes are sensor nodes whose ID started with "B, " such as B27 and B26. The sensor node to be colored as a green dot indicates the according parking space is vacant; on the other hand, a red dot means the parking space is occupied. In Figure 9(b), these blue lines with arrow describe the wireless network topology.
In our experiments, parameters related to the vehicle detection algorithm are given in Table 2. Figure 10 shows the detection results of a parking space B19 for successive 8 days.
, , are the raw magnetic field, and their value refer to the right coordinate axis. ( ) is the detection result whose value refer to the left coordinate axis, where value 0 indicates the parking is "vacant, " and 1 stands for "occupied. " As shown in The threshold for fluctuation detection 5  Figure 11, it describes the daily occupancy time of the parking space B19 for successive 8 days.
Our SPS has been deployed in SIAT and worked for more than one year. Table 3 shows the average accuracy of our vehicle detecting algorithm is about 98.5%. The prior work [4] proposed an Adaptive Threshold Detection Algorithm (ATDA for short). Using the magnetic signal collected from sensor nodes, we run our algorithm and ATDA on PC, respectively. Table 4 shows the test results of our algorithm and ATDA. The experiment results show that in the first case two algorithms have best performance. In the case 1-3, interference signal caused by vehicles on neighbor parking spaces has a negative impact on the detection performance.   And our algorithm is more accurate for vehicle detection than ATDA. ATDA smooths out the entering and leaving fluctuation of the magnetic signal, and it is only considers the signal's characteristic of the parking stop phase. As shown in Figure 12, there is no exit a threshold to distinguish the characteristic between parking stop and interference. In the low SNR (signal-to-noise ratio) situation, the frequent upand-down fluctuation of the magnetic signal is a key characteristic for the vehicle detection algorithm. With the feature being designed, our algorithm has a better performance than ATDA.

Conclusions
In this paper, a street parking system based on wireless sensor networks is presented. It focuses on the accuracy of the parking system. A parking algorithm and an adaptive sampling mechanism are proposed. Our SPS has been in operation in SIAT for more than one year. The experiment results show that the system detection accuracy is better than 98%, and it is energy efficient. However, there is a tradeoff between sensitivity and specificity of magnetic signal that may result in the detection of vehicles in adjacent parking  places. In the future, we will concentrate on the characteristic of the interference signal caused by adjacent vehicles and develop more accurate algorithm to improve the system performance.