Abstract
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.
1. 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–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–8] have been proposed for parking vehicle detection by AMR sensor. However, these algorithms have the following problems.
A whole parking period of a vehicle can be divided into three phases: entering, parking stop and leaving. Most existing algorithms [6–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-to-noise ratio) is low, they will lead to increased false detection rate. 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.
2. 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%.
3. 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.

Diagram of street parking system.
3.2. 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.

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

The coordinate position of the sensor.
4. 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.
4.1. Characterization of Magnetic Signal
As shown in 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 x, y, z 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 x, y, z recover to the environment's magnetic field.

Three-axis magnetic signature of a parking space.
4.2. 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
4.3. Fluctuation Detection
Since the fluctuation of the magnetic signal is a key characteristic of the vehicle entering and leaving. Exact detection of the fluctuation signature is important for the vehicle detection algorithm.
//F_count counts the number of F(i) = 1 //Entering_fluctuation is a flag of detection of the entering fluctuation //Leaving_fluctuation is a flag of detection of the leaving fluctuation //COUNT is a threshold if(C(i) = l) { if(F(i) = l) F_count++; } else if(C(i) = 0) { F_count = 0; } if(The space status is vacant && F_count > COUNT) { Entering_fluctuation = 1; } Else if(The space status is occupied && F_count > COUNT) { Leaving_fluctuation = 1; }
4.4. 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:

Drift in the magnetic signal of a parking space.
4.5. State Machine
Figure 6 shows the block diagram of a state machine which is designed for detecting parking vehicles in SPS. The state machine consists of
State: {Init, Vacant, C_Over_ Input [ Output[

Detection state machine.
The Boolean flags 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 S3: “C_Over_
It was found that a vehicle signature produces a successive sequence of “1” in S4: “C_Below_
Within this state, it will jump back to state S2 after the number of successive 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 S6: “C_Below_
Within this state, it will jump back to state S2 after the number of successive
5. Adaptive Sampling and Energy Consumption
5.1. 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-or-down fluctuation sample of the magnetic signal, if
5.2. 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 (
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 (

Energy consumption (a) sampling and (b) transmitting.
As shown in Figure 7(b), the period of one packet's transmission is about
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.
Related parameters.
6. 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).

Devices are deployed in roadside parking spaces. (a)-(b) Senor nodes in parking spaces. (c) A solar powered router is mounted on the roadside light.

Pictures of the management system. (a) Sensor nodes deployed on the parking spaces. (b) Topology of the network.
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. X, Y, Z are the raw magnetic field, and their value refer to the right coordinate axis.
Experiment parameters.

The detection results of a parking space for successive 8 days.

The occupied time of a parking space.
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 up-and-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.
Car parking detection result.
Car parking detection result: group 2.

The signal comparison of parking and interference. (a) The signal of a car parking. (b) The signal of interference.
7. 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.
Footnotes
Acknowledgments
This work was supported by the National Natural Science Foundation of China (Grant no. 61271005), the Key Laboratory Project (Grant no. CXB201104220033A), the Technology Research and Development Project of Shenzhen (CXZZ20120831173053551), and the research Projects KQC201109050096A and JC201005270368A of Shenzhen.
