Journal of Electrical and Computer Engineering

Journal of Electrical and Computer Engineering / 2020 / Article

Research Article | Open Access

Volume 2020 |Article ID 5875398 |

Haji Said Fimbombaya, Nerey H. Mvungi, Ndyetabura Y. Hamisi, Hashimu U. Iddi, "Enhanced Magnetic Wireless Sensor Network Algorithm for Traffic Flow Monitoring in Low-Speed Congested Traffic", Journal of Electrical and Computer Engineering, vol. 2020, Article ID 5875398, 8 pages, 2020.

Enhanced Magnetic Wireless Sensor Network Algorithm for Traffic Flow Monitoring in Low-Speed Congested Traffic

Academic Editor: Antonis G. Dimitriou
Received18 Oct 2019
Revised10 May 2020
Accepted28 May 2020
Published28 Aug 2020


Traffic flow monitoring using magnetic wireless sensor networks in chaotic cities of developing countries represents an emergent technology. One of the challenges facing such deployment is the development of effective detection signal-processing algorithm in low-speed congested traffic based on the Earth’s magnetic fields. The proposed algorithm is the performance improvement of the previous algorithm known as the Scanning and Decision Algorithm (SDA). The novel algorithm based on the moving-average model includes an addition of a two-pass moving-average filter to improve the signal-to-noise ratio after analog-to-digital conversion. The improved mathematical capabilities enable us to capture additional features of vehicular direction and classification. Other outputs of the model include vehicular detection, count, speed, and travel time index (TTI). The performance evaluation of a proposed algorithm is conducted through on-site real-time experiments at the designated road segment. The results indicated that the roadside magnetic sensor improved vehicular detection, count, travel time index, and classification during low-speed congested traffic state.

1. Introduction

Wireless sensor networks (WSNs) have been deployed in various sensing tasks in ambiguous conditions where wired sensors are not cost effective. Wireless sensor nodes are deployed along the designated road segment sensing traffic flow physical condition and extract corresponding data [1]. The physical condition represents the ambient Earth’s magnetic field [2]. Each node operates autonomously to extract and transmit the traffic flow data to the traffic management center [3]. Due to the sensor’s limited on-board resources, energy consumption trade-offs remain a significant concern for wireless sensor network designers.

Magnet WSNs for traffic flow monitoring utilize magnetic sensors that capture the ambient Earth’s magnetic fields distorted by the passing vehicles [4, 5]. The programmed signal-processing algorithm processes the distorted signal to obtain the desired data. The trade-off between the signal-processing algorithm, operation duration, and the node’s total available energy is necessary [6]. The energy trade-off in traffic flow monitoring and sensor nodes is necessary since it has to operate continuously generating the traffic flow data for a road segment at all times [7]. The traffic flow data of interest include vehicular count, speed, type, and TTI.

Scanning and Decision Algorithm II (SDA-II) is a signal-processing algorithm improvement of the SDA algorithm [4]. The new algorithm is based on a moving-average model operating in the time domain. It improves the signal conditioning and scanning by adding a two-pass moving-average filter, which eliminates high-frequency noises and smoothens and thus enhances the fidelity of the captured signal. In congested and slow-moving traffic, the proposed algorithm improves the process of separating distortions caused by the nearest vehicles. Therefore, the addition of moving-average filters boosts and filters high-frequency noises of the input signal and hence smoothens the signal that simplifies the scanning and decision to generate required data.

In SDA, the algorithm lacked filters for eliminating high-frequency noises of the input signal. The said noise may become severe and cause errors in vehicular detection. The model validation performance on the simulation platform generated promising results. However, it underperformed in the real-time experiment. The algorithm used three magnetic sensors in three directions of x, y, and z to capture ambient Earth’s magnetic fields in their respective directions. This research found that two directions are enough for the extraction of desired traffic flow data; hence, the energy consumption is minimized. The additional data outputs of the vehicular count, speed, type, direction, and TTI are desired to be extracted from the nodes. Table 1 compares some different parameters between SDA-I and SDA-II models.


1Signal inputx, y, and z directionsX and y directions
2Signal filtersMAF-1, MAF-2
3Energy consumption100%Reduced by 6–8%
4Reset AMRNot implementedImplemented
5Baseline signalAdaptiveFixed
6Data outputCount, speed, TTICount, TTI, type
7Operational blocksScanning, decisionConditioning, scanning, decision

3. Proposed Improvement of Novel Algorithm

The SDA-II algorithm shown in Figure 1, which is an improvement of the SDA, composes three essential parts. First, the conditioning state captures incoming analog signals, is amplified up to 500 times, converts to a 16-bit sigma-delta digital, removes high-frequency distortions, and smoothens the signal using a moving-average filter 1 (MAF-1) [8]. Second, the scanning state uses different equations to extract error signals, calculates energy signal, smoothens the energy signal using a moving-average filter 2 (MAF-2), scans for vehicular detection, and finds its highest energy level that depicts the signature. Third, the decision state contains decision-making blocks that extract vehicular traffic flow data from the filtered signals.

The proposed algorithm deploys two magnetic sensors in x and y directions [9, 10]. The general orientation of the sensor is for a y-direction oriented parallel to the road segment and x direction oriented perpendicularly to the road. The subsequent sections discuss the building blocks within the model.

3.1. Signal Conditioning

The input signals and of Earth’s magnetic field are significantly weak. Therefore, they are conditioned to give digital signals and . The 16-bit resolution digital sequences have rich data content, which enables better performance in subsequent processes.

3.2. Moving-Average Filter-1

The digital sequence passes through the first moving-average filter (MAF-1). The filter removes high-frequency noise due to the Earth’s magnetic field spike storms and smoothens the signals. The filter coefficients are calculated so as to avoid truncation harmonics caused by small moving vehicles. The filters carry out a significant role in separating the harmonics when a congested traffic flow occurs. The moving-average filter mathematical formulas are given bywhere and are the filtered current sensor readings in x and y directions, and are the delayed sensor readings, is the filter coefficient, and is a filter length.

3.3. Difference Equation

The difference equation () calculates the error signal from Earth’s magnetic signal edges. The Earth’s magnetic field is a complicated nonlinear signal with a fundamental frequency of 7.83 Hz [11] where its form changes over time due to different factors such as temperature drifts and magnetic storms. The difference equation separates the incoming signal from the previously delayed signal resulting in error signals and in equations (3) and (4), respectively. The error signals indicate how the magnetic field strength changes in the time domain. The smaller the error, the better the quality of the model parameters. When vehicles are passing near the sensor node, they influence the error signals causing distortions:

3.4. Energy Signal

The energy signal represents the changes in the energy level of the error signal and, hence, the overall changes in the captured signal. The characteristic changes in energy have an impact on the determination of vehicular detection. It is employed as a measure of the quality of estimation. The smaller the , the better the estimation. Notice that, in SDA-II, only one in the y-direction is involved and calculated as shown in equation (5). The calculated is efficient for the vehicular detection algorithm:

In the signal analysis, is used to deduce vehicular detection and classification after passing through the second moving-average filter MAF-2 [12]. The analysis is then performed in the time domain because of the lower processor power demand and sensor node energy consumption [13]. When two or three vehicles at the instant are moving parallel to the sensor node, the false alarm detection happened. This effect is minimized when the multisensor nodes are deployed along the road link. The average of each traffic parameter is then calculated based on data from each node.

3.5. Moving-Average Filter-2

The essential function of this second pass filter (MAF-2) is to recondition and smoothen the generating the best-approximated signal for analysis. The MAF-2 formulation is shown bywhere is the filtered current energy signal, is the delayed energy signal, is the filter coefficient, and is the filter length.

3.6. Vehicle Detection and Maximum Energy

Based on the vehicle energy signal, equation (7) calculates vehicular detection:where is the filtered energy signal and is the fixed baseline threshold.

The value of is fixed and obtained from repeated physical experiment observations. The experiments showed that the energy of the error signal was typically less than unless there are distortions due to the nearby magnetic or metallic object. The Earth’s magnetic spike storms cause distortions that may exceed but most of them occur in a very short time; therefore, they are not encountered as desired vehicular distortions. The SDA-II sampling is more than 2 MHz; therefore, the error signal would become very small if no detection occurred. Hence, the fixed at 1 nT2 controls the detection mechanism. Once the vehicle detected, the vehicular count block increases its value [14].

Maximum energy in equation (8) represents the highest energy level attained by a passing vehicle. In this study, it is used to indicate the vehicular type:where is the function used to mark the maximum energy magnitude of a passing vehicle.

3.7. Vehicle Direction

The direction block activates direction flag dirF for forward or opposite vehicular directions. The error signal sign marks the direction either positive or negative depending on the direction of travel: Forward direction Opposite direction

3.8. Timer Block

The timer block generates vehicular travelled time (TT) which is considered as the time used by the passing vehicle at the sensor observability zone. TT is an important variable because it is used in the calculation of vehicular speed and travel time index (TTI).

3.9. Instantaneous Speed and Travel Time Index

To calculate speed, it is assumed that the sensor observability zone length (L in meter) is constant and proportional to the vehicular size [15] when a vehicle travels across the sensor observability zone length and spends time (TT in mill-sec). Therefore, the vehicular speed across the observability length is given by

As , we take the derivative on both sides, resulting in an instantaneous speed of the passing vehicle:where is the instantaneous speed, changes in distance, and changes in time.

The travel time index is the ratio between the actual travelled time () to the travel time at free-flow speed . Alternatively, is the ratio between the free-flow speeds to the actual vehicular speed as in equation (11), accounting for both recurring and incident delays such as traffic accidents. It determines how long it will take to travel during a peak hour and uses both main and arterial travel rates:where is the actual travelled time and is the travel time at free-flow speed .

3.10. Vehicular Type

SDA-II uses the maximum energy signal of a passing vehicle to determine its type (Classification) from smaller saloon cars to buses, trucks, and lorries. There are seven fundamental types stored in the reference vehicular signatures () database. However, the study of vehicular signatures and classification is considered as an area for further research. The algorithm updates list when the new energy signal range is determined:Type 1: Type 2: Type 3: Type 4: Type 5: Type 6: Type 7:

The experiment setup is shown in Figure 2. A vehicle is passing near the sensor node at an average speed. Four main factors that influence the vehicular magnetic signal include(i)Vehicle position from the sensor node(ii)Temperature drifts(iii)Geographical location(iv)Magnetic spike storms

The MAF-1 suppresses small harmonics and leaves high harmonics.

3.11. Reset Anisotropic Magnetoresistors (AMRs)

The Reset AMR block sets/resets the AMR sensor by a 1 kHz pulse just after detection is completed. The pulse recovers the sensor strongly remagnetized . The Earth’s magnetic variations due to temperature drifts have lesser magnitude; hence, they are neglected. Variations due to sensor location away from the vehicle receive an enormous impact on the captured magnetic field; therefore, they are considered as an area for further research. This research considers vehicles travelling in the closest lane to the sensor node location. Filters help to eliminate the problem due to minute magnetic variations.Therefore, this block demagnetized the AMR sensor and is reenabled to perform high sensitivity measurement again

4. SDA-II Finite State-Flow Machine

The finite state-flow machine in Figure 3 illustrates how the SDA-II model operates. This is parametric modelling that consists of three main states:ConditioningScanningDecision

The conditioning state accepts the incoming analog signals and , is amplified, converts to digital sequences and , filters the noise, and smoothens and creates delayed signals and . Both delayed and current signals are fed to the scanning state, where the error signals and are generated by the difference equations. The error signal is used to deduce the travelling direction of the detected vehicle. The energy signal is generated and passed through MAF-2. The max energy represents the vehicular signature. The vehicular detection is activated by generating a 2-bit detection flag . The has the following outcomes:Decision_00: no vehicular detectedDecision_01: vehicular just detectedDecision_11: vehicular detection is activeDecision_10: vehicle at the end of the detection

At Decision_10, the algorithm generates data outputs (TTI, type, and count) and initializes timer and a magnetic sensor.

5. Experiment

Data collection to evaluate SDA-II was conducted through on-site real-time experiments at the designated road segment with two wireless sensor nodes and a single sink node (KiliNode). KiliNode is a sensor node designed at the University of Dar es Salaam, integrated with powerful features such as a 16-bit PIC24fj128G006 MCU, a 16-bit Sigma-delta ADC, a 120 nT resolution AMR sensor, a CC2520 transceiver unit, a 0.6 W solar panel, and a 100F supercapacitor [16]. The data outputs were captured in different setups, with/without passing vehicles, at various speeds, and during normal or congested conditions. The vehicular manual count and type identification were used to evaluate the algorithm.

5.1. Experiment Setup

Figure 2 shows the experiment setups, where two sensor nodes are localized on the sides of the road segment communicating wirelessly with a sink node. They transmit traffic flow information to the sink node (gateway). Figure 2(a) shows a wide-view of sensor nodes, depending on the size of the passing vehicle. Each node sensed its nearest lane. Figure 2(b) shows a close view at the sensor node. Each node is installed 1 m away from the vehicle and 1 m above the ground. Figure 2(c) shows the sensor node hardware based on KiliNode and Figure 2(d) shows the sink node interfaced to a computer for storing real-time traffic flow data. The sensor nodes transmit traffic flow data wirelessly to the sink node. A small saloon car is used to validate the operation in various scenarios.

5.2. Experiment Observation

There were various experimental observations on data collected, used to plot the subsequence graphs.

Figure 4 depicts Earth’s magnetic fields before and after being filtered by a MAF-1 when no vehicle is passing by. The truncation of high frequencies from the filtered signal is evident.

Figure 5 depicts Earth’s magnetic field energy signal when no vehicle is passing by. The error signal is filtered by MAF-2. No filtered greater than the baseline threshold is detected.

Figure 6 depicts distorted Earth’s magnetic field when a vehicle is passing by. The distorted signal shows that there is a vehicle passing.

Figure 7 depicts of a passing vehicle. It shows vehicular detection marking its start and end, , and travel time observed by the sensor node.

The anatomy of the graph in Figure 7 illustrates the vehicular signatures that inter and leave the sensor zone. The sensor measured the travelled time TT and the maximum energy level of the vehicle.

6. Performance Evaluation of SDA-II

The energy consumption in SDA-II was dramatically minimized by 6–8%. This is achieved by the following two improvements: reduced number of sensing units to two in x-y directions and reduced computational activities by implementing lightweight moving-average filters. Hence, the sensor node operation depends on energy harvesting. Magnetic field sensitivity increased due to the introduction of the set/reset magnetic sensor. The introduction of moving-average filters minimized errors in vehicular detection.

7. Conclusion

This research proposes a novel vehicular traffic flow algorithm (SDA-II) based on magnetic WSNs. The work validated the vehicular detection by magnetic wireless sensor nodes installed on the roadside. The validation was performed by various real-time experiments. The proposed signal-processing algorithm captured the input signal and processed and generated vehicular traffic flow data. The novel algorithm is based on the time-domain moving-average model. Moving-average filters improved the SDA-II operations, especially during the low congested conditions. The research suggested that future work should be carried out in the frequency domain at the expense of high processing power and energy requirements. In general, when the vehicle is moving along the road, it disturbs the ambient Earth’s magnetic field and its characteristic frequency resulting in frequency distortions. The frequency-domain analysis assumed to clearly show the distorted frequencies and power spectrum, which corresponds to the vehicular type. Frequency-domain analysis has additional advantages over time-domain analysis, due to the constraints such as processing power, huge memory, and digital signal processor requirement. Therefore, it is considered for further research.

Data Availability

The data used to support the findings of this study are available from the corresponding author upon request.

Conflicts of Interest

The authors declare that they have no conflicts of interest.


  1. K. Nellore and G. Hancke, “A survey on urban traffic management system using wireless sensor networks,” Sensors, vol. 16, no. 2, p. 157, 2016. View at: Publisher Site | Google Scholar
  2. R. Sen, “Kyun queue: a sensor network system to monitor road traffic queues,” in Proceedings of the 10th ACM Conference on Embedded Networked Sensor Systems (SenSys 2012), pp. 127–140, New York, NY, USA, 2012. View at: Google Scholar
  3. M. Shuai and K. Xie, “An on-road wireless sensor network approach for urban traffic state monitoring,” in Proceedings of the 11th International IEEE Conference on Intelligent Transportation Systems, pp. 1195–1200, Beijing, China, October 2008. View at: Publisher Site | Google Scholar
  4. H. S. Fimbombaya, N. H. Mvungi, N. Y. Hamisi, and H. U. Iddi, “Performance evaluation of magnetic wireless sensor networks algorithm for traffic flow monitoring in chaotic cities,” Modelling and Simulation in Engineering, vol. 2018, Article ID 2591304, 11 pages, 2018. View at: Publisher Site | Google Scholar
  5. M. A. Kafi, Y. Challal, D. Djenouri, M. Doudou, A. Bouabdallah, and N. Badache, “A Study of wireless sensor networks for urban traffic monitoring : applications and architectures,” in Proceedings of the 4th International Conference on Ambient Systems, Networks and Technologies, vol. 19, pp. 617–626, Halifax, Canada, June 2013. View at: Google Scholar
  6. S. Taghvaeeyan and R. Rajamani, “Portable roadside sensors for vehicle counting, classification, and speed measurement,” IEEE Transactions on Intelligent Transportation Systems, vol. 15, no. 1, 2014. View at: Publisher Site | Google Scholar
  7. I. Augé-Blum, F. Yang, and T. Watteyne, “Real-time communications in wireless sensor networks,” in Next Generation Mobile Networks and Ubiquitous Computing, pp. 69–78, IGI Global, Hershey, PA, USA, 2017. View at: Google Scholar
  8. J. Ding, S. Y. Cheung, C. W. Tan, and P. Varaiya, “Signal processing of sensor node data for vehicle detection,” in Proceedings of the 7th International IEEE Conference on Intelligent Transportation Systems (IEEE Cat. No.04TH8749), pp. 70–75, Washington, WA, USA, October 2004. View at: Publisher Site | Google Scholar
  9. V. Markevicius, D. Navikas, M. Zilys, D. Andriukaitis, A. Valinevicius, and M. Cepenas, “Dynamic vehicle detection via the use of magnetic field sensors,” Sensors, vol. 16, no. 1, p. 78, 2016. View at: Publisher Site | Google Scholar
  10. B. Yang and Y. Lei, “Vehicle detection and classification for low-speed congested traffic with anisotropic magnetoresistive sensor,” IEEE Sensors Journal, vol. 15, no. 2, pp. 1132–1138, 2015. View at: Publisher Site | Google Scholar
  11. A. P. Nickolaenko and D. D. Sentman, “Line splitting in the Schumann resonance oscillations,” Radio Science, vol. 42, no. 2, pp. 1–12, 2007. View at: Publisher Site | Google Scholar
  12. Q. Wang, “Traffic analysis & modeling in wireless sensor networks and their applications on network,” Network Protocols and Algorithms, vol. 2, no. 1, pp. 74–92, 2010. View at: Publisher Site | Google Scholar
  13. L. Zhang, R. Wang, and L. Cui, “Real-time traffic monitoring with magnetic sensor networks,” Journal of Information Science and Engineering, vol. 27, no. 4, pp. 1473–1486, 2011. View at: Google Scholar
  14. X. Bao, H. Li, D. Xu, L. Jia, B. Ran, and J. Rong, “Traffic vehicle counting in jam flow conditions using low-cost and energy-efficient wireless magnetic sensors,” Sensors, vol. 16, no. 11, 2016. View at: Publisher Site | Google Scholar
  15. V. Markevicius, D. Navikas, A. Idzkowski, A. Valinevicius, M. Zilys, and D. Andriukaitis, “Vehicle speed and length estimation using data from two Anisotropic Magneto-Resistive (AMR) sensors,” Sensors, vol. 17, no. 8, 2017. View at: Publisher Site | Google Scholar
  16. H. S. Fimbombaya, N. Y. Hamisi, N. H. Mvungi, and H. I. Uledi, “Development of solar powered magnetic wireless sensor node for traffic flow monitoring,” in Proceedings of the 11th IET International Concerence, pp. 23–29, Hong Kong, China, November 2018. View at: Google Scholar

Copyright © 2020 Haji Said Fimbombaya et al. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

More related articles

 PDF Download Citation Citation
 Download other formatsMore
 Order printed copiesOrder

Related articles

We are committed to sharing findings related to COVID-19 as quickly as possible. We will be providing unlimited waivers of publication charges for accepted research articles as well as case reports and case series related to COVID-19. Review articles are excluded from this waiver policy. Sign up here as a reviewer to help fast-track new submissions.