ESPAR Antenna-Based WSN Node With DoA Estimation Capability

In this paper, we present a low-cost energy-efﬁcient electronically steerable parasitic array radiator (ESPAR) antenna-based wireless sensor network (WSN) node designed for IEEE 802.15.4 standard that is capable of performing direction of arrival (DoA) estimation in real-life outdoor environments. To this end, we propose the WSN node architecture, design and realization that utilizes NXP JN5168 radio frequency (RF) wireless transceiver and a microcontroller integrated with ESPAR antenna beam-switching circuits. To incorporate DoA estimation capability into the developed single-board WSN node, power-pattern cross-correlation (PPCC) algorithm, that relies solely on received signal strength (RSS) values measured by the transceiver at the antenna output for every considered directional antenna radiation pattern, has been adapted and implemented in a simple microcontroller embedded within NXP JN5168 integrated circuit. Measurements conducted in an outdoor environment show that the proposed low-cost WSN node can successfully provide DoA estimation results, which may be used to enhance WSN capabilities in practical applications. The obtained root mean square (RMS) DoA estimation errors are 7 . 91 ◦ , 6 . 58 ◦ and 9.47 ◦ for distances between WSN nodes equal to 3 m , 5 m and 10 m respectively


I. INTRODUCTION
Wireless Sensor Network (WSN) is one of the key technologies behind the Internet of Things (IoT) applications.WSN nodes, which are deployed as standalone devices or integrated within different objects, can be responsible, among others, for sensing, localizing, monitoring, actuating, providing communication means, and performing calculations required by their specific tasks [1], [2].Such an important role of WSNs in future IoT applications impose requirements concerning energy efficiency, acceptable costs, resilience of the network, and scalability, to name a few [3]- [5].Because, in most cases, sensor nodes are powered by batteries, energy efficiency of WSN nodes is usually the most limiting factor in practical The associate editor coordinating the review of this manuscript and approving it for publication was Liangtian Wan .
In practical implementations, when wireless sensor networks are dense or have to operate in real-life, e.g.city, rural or industrial, environments, one can consider WSN nodes with switched-beam antennas (SBA) providing several directional radiation patterns that can be switched electronically [5], [7]- [10].Such antennas are able to send and receive radio frequency (RF) signals from a specific direction more efficiently than commonly used in WSN nodes dipole or monopole antennas, which have omnidirectional radiation patterns.By focusing WSN nodes' antenna beams towards specific directions, one can easily improve the overall network performance, and especially increase its energy efficiency [10]- [14].However, such functionality usually requires that WSN nodes are also capable of detecting direction-of-arrival (DoA) of incoming RF signals.
The direction of arrival estimation is crucial in applications where the position of an object needs to be known and the GPS tracking is unavailable or unreliable.It is useful in maritime [15] or automotive [16] applications as well as for finding the source of jamming signals [17] and, in the majority of the published works, it relies on the channel estimation based on the traditional antenna array, where the downlink channel covariance matrix is calculated [18].Such solutions usually require sophisticated computation and array signal processing [19], [20].For circular and non-circular signals, algorithms such as multiple signal classification (MUSIC) [21] or estimation of signal parameters via rotational invariant techniques (ESPRIT) [22] can be utilized for DoA estimation.However, even though a number of modifications to improve the estimation performance, interpreted as accuracy and how fast the results can be provided, can be found in the available literature [23], [24], both of the algorithms require signal analysis capabilities as well as computational power much larger than those available in simple WSN sensors.
DoA estimation methods, which could be applied within WSN nodes, may rely on WSN node radiation pattern diversity that in its simplest form can be obtained by switching antennas' active or passive elements using inexpensive PIN or varactor diodes [10], [12], [25].This approach allows one to integrate a switched-beam antenna with a WSN node [10], [12] so that the required beam direction can be set by a microcontroller.In consequence, such WSN nodes can increase their capabilities, both in reflectionless and multipath-rich environments.Although this beam steering technique allows one to improve connectivity, according to the authors' knowledge, it has not been reported in the available literature to provide DoA estimation capability in WSN nodes that might be used to further enhance network performance by employing location-based information [4]- [6].The main drawback of implementing PIN or varactor diodes is the fact that they cause a substantial increase in energy consumption, which may have a negative influence on the overall energy efficiency of WSN nodes.
Another way to enable DoA estimation capability within WSN nodes equipped with switched-beam antennas is to use a number of directional radiators facing different directions around a node.In the implementation proposed in [26]- [28], the radiators are switched by a microcontroller connected to a single-pole 8-throw (SP8T) switch.As a result, such antennas not only provide more narrow radiation patterns but can also be used to estimate the direction-of-arrival of incoming RF signals.In WSN systems using such switchedbeam antennas, it is possible to estimate DoA of unknown RF signals with 1.1 • estimation error mean and 10 • precision being the biggest estimation error value [29].
The switched-beam antennas proposed in [26]- [28] can provide DoA estimation capability to a WSN node and consume considerably less energy than digital beamforming employing multiple digital signal processing (DSP) units [30].For this reason, the switched-beam antennas capable of estimating DoA of incoming signals can be incorporated in WSN anchor nodes to provide localization capability to the network [26], [28].In such configurations, acceptable DoA accuracy has been obtained for distances between the base station and a node less than 3 m [27]- [29].However, in many practical WSN applications such as smart city or smart farming, the 3 m distance may be insufficient as sensors can be deployed in wider areas [31].In such cases, one needs a DoA estimation approach able to handle longer distances between installed WSN nodes.Additionally, the total number of switching directions in the switched-beam antennas capable to estimate DoA is limited by available single-pole multiple-throw (SPnT) switches, which limits the total number of antennas used in beam switching and eventually affects the available DoA estimation accuracy.
An interesting alternative to the aforementioned antennas involving switched radiators are electronically steerable parasitic array radiator (ESPAR) antennas [32], which are usually much compact, less complicated and thus less expensive in mass production.The radiation pattern is shaped by changing values of load impedances connected to passive elements surrounding a centrally placed active antenna which is connected to a signal source.This concept has been successfully used in ESPAR antenna prototype having 6 passive elements not only to form steerable directional beams, but also to estimate DoA with 0.67 • estimation error mean and 2 • precision using the power pattern cross-correlation (PPCC) algorithm employing received signal strength (RSS) values [33].It means that precision achieved using the ESPAR antenna is 5 times better than the precision obtained using the switched-beam antenna proposed for a WSN node's base station in [29].However, because independently controlled adjustable reactances in [33] were implemented as varactor diodes, the corresponding bias voltages, required to produce desired reactance values accurately, have been provided by six 12-bit digital-to-analog converters (DAC) incorporated within a DSP-based unit.In consequence, such an antenna system requires more energy than the switched-beam antenna proposed in [29] and could be practically used only in WSN base stations, in which DoA estimation has to be performed with higher accuracy, as battery-operated WSN nodes have to be more energy-efficient.
In order to take advantage of ESPAR antennas in WSN nodes, a simplified beam steering concept has been proposed [34].The concept enables to form the required radiation pattern by using single-pole double-throw (SPDT) switches to provide switchable load impedances close to an open or short circuit connected to 12 passive elements, rather than by applying specific bias voltages to varactor diodes.It means that, by using 12 low-cost and low-current integrated SPDT FET switches, 12 directional radiation patterns are available and such an approach is free from the problem of availability of SPnT switches that would limit the total number of antennas used in [27]- [29].This approach allows considerable reduction of energy consumption in an ESPAR antenna, so it can be integrated with battery-powered WSN nodes, and still accurately estimate DoA with 2 • precision using the PPCC algorithm in anechoic chamber measurements [36].Therefore, by integrating such ESPAR antennas within WSN nodes employing simple and inexpensive transceivers that can measure RSS of incoming packets, one can develop WSN nodes capable of performing DoA estimation accurately and also set the required radiation direction, which can improve connectivity, coverage and energy efficiency of the whole network [4]- [6], [13], [14].
In this paper, we show how ESPAR antenna with simplified beam steering can be integrated into a complete low-cost WSN node in order to provide DoA estimation capability to the node.To this end, we propose the node's architecture, its design and realization including an RF transceiver and a microcontroller together with the corresponding RF switching circuitry of the ESPAR antenna.Because in the available publications DoA estimations based on PPCC method were verified using measurement equipment capable of recording RSS values with high precision followed by PC computations, we propose an adaptation of the PPCC algorithm, so it can be used efficiently together with simple but less accurate RSS measurements performed by an inexpensive RF transceiver followed by computations realized on the embedded microcontroller.The measurements confirm that the proposed ESPAR antenna-based WSN node is able to perform DoA estimations based on packets received from other nodes in real environments.According to the authors' knowledge, this paper presents the first low-cost ESPAR antenna-based WSN node able to perform DoA estimations in practical WSN applications, in which every node has simultaneous DoA estimation and radiation direction steering capabilities.

II. ESPAR ANTENNA FOR A WSN NODE
In order to enhance a WSN node design so that the node can modify its radiation pattern and, in consequence, emitted RF signals are sent towards specific directions, one can integrate it with ESPAR antenna controlled by a simplified lowcost and energy-efficient switching circuit.ESPAR antenna design suitable for such integration [34], [35] consists of 12 passive elements surrounding a single-fed active element, to which transceiver's RF signal output can be connected.In the design, shown in Fig. 1, the passive elements can be individually shortened or opened by dedicated SPDT switches to provide 360 • beam steering with 30 • discrete step using N = 12 directional radiation patterns.
All passive elements in Fig. 1 that are shortened become reflectors, while those that are open become directors for the active element in the middle.Therefore, every antenna configuration can be denoted by the corresponding steering vector , in which v s denotes the state of the sth passive element: v s = 0 is for the shortened passive element, and v s = 1 for opened.Consequently, when control lines of SPDT switches are connected to an external microcontroller, the ESPAR antenna's radiation pattern can be configured digitally.In the ESPAR antenna, which was designed in [34] using FEKO electromagnetic simulation software tool for the center frequency of 2.484 GHz, directional radiation patterns having 73.2 • 3dB beamwidth can be formed for five consecutive passive elements opened.In Table 1, all considered steering vectors V n max have been gathered together with associated main beam directions ϕ n max and corresponding radiation pattern numbers.The first radiation pattern, shown in Fig. 2, have the main beam direction at ϕ 1 max = 90 • (aligned with y axis in Fig. 1) and was formed using steering vector By changing steering vectors of the ESPAR antenna, it is possible to estimate the DoA of incoming RF signals by recording their RSS for each radiation pattern main beam direction [34], [35].However, DoA estimation measurements for ESPAR antenna prototypes available in the literature were conducted in anechoic chambers using precise and advanced equipment and the PPCC algorithm results were calculated on a PC [33], [35], [36].According to authors' best knowledge, such antenna has never been integrated with an inexpensive transceiver and microcontroller in order to develop a costeffective WSN node with beam steering and DoA estimation capabilities.In consequence, real-world performance of such WSN node, in which discrete RSS values are recorded by WSN node's RF transceiver and PPCC method for DoA  estimation is implemented solely within WSN node's microcontroller, together with the necessary main beam steering, is unknown.

III. WSN NODE INTEGRATED WITH ESPAR ANTENNA
The integration of ESPAR antenna and a WSN sensor can be made to obtain a single-board WSN node with an antenna able to switch its radiation beams.For this purpose, we propose a dedicated architecture and electronic design to further discover the performance and applicability of such a solution.

A. ARCHITECTURE
To provide the assumed functionality, the antenna design has to be integrated with an RF transceiver and a microcontroller powerful enough to perform the direction of arrival estimation, but still being as energy-efficient as possible to allow battery operation.Additionally, the transceiver IC and the protocol has to be equipped with the functionality of measuring the received signal strength of each packet and the UART pinout to control the antenna beam.The general concept of an integrated wireless sensor network node is presented in Fig. 3.
The proposed ESPAR antenna-based WSN node consists of an NXP JN5168 wireless microcontroller directly connected to antenna's active element.Passive elements are switched through SPDT switches by a dedicated switching circuit controller, while commands to the controller are being sent directly from JN5168 through UART.The necessary communication with a PC for JN5168 programming and debugging can be obtained by a dedicated data line, as shown in Fig. 3.The sensor is powered through the 5V micro-USB connector or an external 3.7V LiPo battery.The realized WSN node with its key functional blocks is presented in Fig. 4.

B. SENSOR COMPONENTS
For the WSN microcontroller, the NXP JN5168 chip has been chosen for its low cost, adequate efficiency and ease of implementation.JN5168 is an ultra-low power RF module that uses the IEEE 802.15.4 standard in the 2.4-2.5 GHz ISM frequency band with the manufacturer's JenNet wireless networking stack already implemented.It has the transmit power of up to 2.5 dBm and receiver sensitivity of −95 dBm.It is equipped with a 32-bit RISC microcontroller of up to 32 MHz clock rate and 32 kB RAM [37].It is also equipped with integrated ultra-low power sleep oscillator.The RX and TX current is respectively 17 mA and 15 mA, while the deep sleep current is 0.12 µA.For the programming, debugging and data communication with the PC, an external programmer connector is available.
The JN5168 chip's antenna pin is connected to the active element of the antenna through a matching circuit.Antenna's configuration can be changed through UART of the WSN microcontroller by sending pre-set commands to the STM32F74xVx microcontroller responsible for controlling SPDT switches.The actual configuration is set by providing a proper steering vector binary command, as presented in Table 1.An additional STM32 programmer connector is located on the board for programming purposes.The antenna has been manufactured according to the design described in the previous section on inexpensive 1.7 mm FR4 laminate.For active and passive elements, a 1 mm diameter silver-plated copper wire has been used.For SPDT switches, which design details are presented in Fig. 5, NJG1681MD7 GaAs FET MMICs have been chosen, whose typical control current is as low as 4 µA.They are connected to each of the parasitic elements with an additional ceramic inductor for enhancing ESD protection.Also, the additional U.FL connector with the capability of bypassing the integrated RF module has been implemented to provide the possibility of connecting an external transceiver that can be used, for example, to measure the antenna radiation patterns in an anechoic chamber.All the WSN node components together with their placement are shown in Fig. 6.

IV. DIRECTION-OF-ARRIVAL ESTIMATION FOR A WSN NODE USING PPCC METHOD
Direction of arrival (DoA) estimation allows one to determine an angle of a signal impinging the antenna.Although many different DoA techniques have been developed so far [30], those relying on low-cost reconfigurable antennas, which consume low energy for the switching process, and simple yet effective estimation algorithms are particularly interesting for WSN nodes.One of the most promising DoA estimation methods is power-pattern cross-correlation (PPCC) algorithm, originally introduced in [33], that provide accurate results and require acceptable number of simple operations [33], [36].Therefore, it can successfully be implemented in a relatively simple microcontroller embedded within the NXP JN5168 chip chosen as the WSN node integrated transceiver.

A. PPCC ALGORITHM
The algorithm provides DoA estimation based on the crosscorrelation coefficient between the beforehand measured antenna's radiation patterns and the actual antenna output power recorded for each antenna radiation pattern.The cross-correlation coefficient (ϕ) for the considered ESPAR antenna can be written as [35]: where the angle ϕ is the azimuth plane 0 max , ϕ , . . ., P V n max , ϕ , . . ., P V 12 max , ϕ are antenna's radiation pattern values measured during the calibration phase for all the corresponding steering vectors V 1 max , . . ., V n max , . . ., V 12 max with the angular step precision ϕ, while Y (V 1 max ), . . ., Y (V n max ), . . ., Y (V 12 max )} are output power values measured at the antenna output port for all the available radiation patterns and stored during the DoA estimation phase.Therefore, the estimated direction of arrival angle φ corresponds to the largest value of (ϕ) [33].
The antenna's radiation patterns are measured in an anechoic chamber with an angular step ϕ = 1 • , thus the measured antenna radiation patterns P V 1 max , ϕ , . . ., P V n max , ϕ , . . ., P V 12 max , ϕ can be represented as vectors {p 1 , . . ., p n , . . ., p 12  } containing I = 360 measured discreet values , where the superscript T is the vector transpose operator.Thus, the equation ( 1) can be rewritten as [35]: where the '•' denotes the element-wise product of vectors and g = [ (ϕ 1 ) , (ϕ 2 ) , . . ., (ϕ I )] T is a vector of length I = 360 containing discretized values of correlation coefficient (ϕ) for every value of ϕ in ϕ = [ϕ 1 , ϕ 2 , . . ., ϕ I ] T .The estimated angle, represented by φ, corresponds now to the maximum value of g.The PPCC algorithm in this formulation can easily be implemented within WSN node to compute DoA estimation even when less efficient microcontrollers and simple transceiver modules for RSS packet measurements are used.

B. PPCC METHOD IMPLEMENTATION IN THE WSN NODE
In the PPCC method, two phases can be distinguishedcalibration phase, which relies on collecting the necessary data needed for DoA estimation process, and DoA estimation one that uses (2) to estimate the unknown angle φ.
During the first phase, ESPAR antenna's radiation patterns P V 1 max , ϕ , . . ., P V n max , ϕ , . . ., P V 12 max , ϕ are measured with an angular step ϕ in an anechoic chamber before the actual DoA estimation starts.As a result, a set of vectors {p 1 , . . ., p n , . . ., p 12  } consisting of discrete values of radiation patterns are obtained.Those values are stored into microcontroller's memory as an input for the second phase.
The second phase is the actual DoA estimation process, during which the correlation coefficient vector g, defined in (2), is calculated by WSN node's microcontroller as soon as all the necessary RSS values are measured by WSN node's RF transceiver at the antenna output port input and stored in the memory.Because the proposed WSN node relies on the NXP JN5168 module, the necessary code has been implemented in C programming language, which is recommended by the manufacturer as the only language supported by the official software development kit [37].In the implementation, several functions, presented in Fig. 7, responsible for switching antenna configuration, communication, storing the data and estimating the direction of arrival can be distinguished.Although the main aim was to optimize the execution time, making the DoA estimation as fast as possible, due to the hardware limitations of the JN5168 microcontroller, also a limited memory capacity had to be taken under the consideration.Thus, to improve the efficiency, the simple iterative square root function based on the Babylonian method [38] has been implemented.Moreover, the number of loops and variables have been reduced to make the resulting microcontroller program as low effort-consuming as possible.
During the initialization of the node, the lower left part of equation ( 2), namely p INIT = 12 n=1 (p n • p n ), is calculated since this part depends only on the calibration phase data and it doesn't change during the estimation process.This part has to be calculated only once and the result can be stored in the WSN node's memory.Next, the measurement procedure starts by sending the request to the second module to start transmitting the packets.At the same time, incoming data is being parsed to readout the RSS value and store it in a temporary table until 100 packets are received.Then, the mean value is being calculated and the antenna switches to the next configuration repeating the procedure until data for all the configurations are gathered.Then, the correlation coefficient vector g is calculated and the estimated direction of arrival angle φ that corresponds to the maximum value in g is chosen.The computation time of a single DoA estimation based on 1200 collected and stored RSS measurements (100 RSS values times 12 antenna configurations) is 248 ms.For this experimental implementation, no timeouts were included in the algorithm, assuming that for each antenna configuration sensor is able to receive 100 packets.It should be noted though, that in practical implementation the function of switching to the next antenna configuration if no packet is received for a certain amount of time should be implemented to avoid potential freezes during the estimation process.

V. MEASUREMENTS
To verify the concept, a series of measurements have been performed in an anechoic chamber and an outdoor real environment.The performed measurements have been distinguished as separate subsections for a clear separation of particular phases.

A. ANTENNA RADIATION PATTERNS
In the calibration phase, antenna radiation patterns of the integrated sensor have to be measured.For this purpose, we have installed the developed node on the turntable in our 11.9 × 5.6 × 6.0 m anechoic chamber presented in the Fig. 8.To calibrate the PPCC algorithm, we have measured the radiation patterns of the antenna at 2.484 GHz for each of twelve antenna configurations with step ϕ = 1 • using Vector Network Analyzer connected directly to the sensor's U.FL connector and bypassing the integrated RF transceiver.Fig. 9 presents measured radiation patterns in the horizontal plane.One may notice a slight, in comparison to simulations, asymmetry within the obtained characteristics which is the result of the additional to the initial antenna design electronic components placement and the location of ground traces along the circuit.
As one can observe, in each of the measured radiation patterns, a clear main lobe can be distinguished with 30 • angular step between the particular configurations as steering vectors presented in Table 1 were used for beam steering.

B. INITIAL REAL ENVIRONMENT MEASUREMENTS
For the actual DoA estimation measurements using the proposed integrated sensor, a measurement setup was prepared on a dedicated part of the 30 m × 60 m lawn within the university campus.The sensor under the test has been placed in the middle of a circle of radius 3, 5 and 10 meters.The second JN5168 module, equipped with a monopole antenna, was used as a transmitter and placed on the circle.The transmitter was set to a broadcast mode to avoid the risk of disconnections for the possible low-RSS configurations, when the antenna's main beam is set in the opposite direction to the transmitter.
Sensors were installed on 2 meters high tripods to minimise the potential interferences from the ground or the operator performing the tests.Fig. 10 presents the aerial view of the test site.As one can observe, in the close neighbourhood of the test area there is a number of potential interfering objects such as parked cars, trees, metal building walls (with blue roofs) or passers-by, which should be taken into account during the evaluation of the results.
During the initial measurements, verification of the operation of the ESPAR antenna-based WSN node has been performed.To this end, RSS values for different angles of arrival of impinging RF signals for all the antenna configurations and 3 m distance between the transmitter and the receiver have been measured.The purpose of this test was to verify how the signal strength varies when the transmitting module is placed in different positions along the circle with  Similar results were obtained for all considered ESPAR antenna configurations.In consequence, one can record noticeably higher RSS values when the signal arrives to the integrated sensor from the direction, for which the radiation pattern reaches maximum.As a result, there exist diversity in RSS values required for spatial separation between directions, which can be used for beam steering and also for the PPCC-based DoA estimation within ESPAR antenna-based WSN node [33].
After initial measurements conducted for the ESPAR antenna-based WSN node, the distance to the WSN test node was increased and the procedure was repeated.Then, for every radiation pattern, its maximum value was determined and its mean value and standard deviation have been calculated, which, for ϕ 3 max = 150 • , were gathered in Table 2.For all 12 radiation patterns used, calculated standard deviations were relatively low when compared to the corresponding mean RSS values.

C. DIRECTION OF ARRIVAL ESTIMATION IN SINGLE SENSOR SETUP
To verify ESPAR antenna-equipped WSN node DoA estimation capability, a series of measurements in the outdoor  environment introduced in V.B. have been held.To this end, the integrated module was located in the middle of a circle of radius 3, 5 and 10 meters as presented in Fig. 12.The transmitting sensor, which direction will be estimated, equipped with a monopole antenna, was placed on the circle with a 10 • step.In each location, the device transmitted 100 packets for every configuration of the ESPAR antenna (1200 snapshots for each location, 43200 snapshots in total for all the 36 positions).For each packet, RSS values are measured by the integrated node and stored in the memory.After collecting 100 measurements, which takes 5 seconds, a mean RSS value is calculated and the antenna automatically switches its configuration to the next one, until the mean value of 100 RSS measurements for each of 12 configurations is calculated.As a final step, a correlation coefficient is calculated and the direction of arrival is estimated.The resulting DoA estimation errors are presented in Fig. 14 and Table 3, which presents mean value, root mean square error (RMSE), and standard deviation of accuracy cumulated for each of the distances used in the measurements.Additionally, precision, interpreted as the highest value of the estimation error among all the measurements performed for a particular distance, has been presented.The results indicate that for all three considered distances the direction of arrival estimation provides acceptable results.It can be easily noticed, that for all the distances RMSE of the accuracy is below 10 • , what assures accuracy good enough for most of the real-life applications considering the TABLE 3. DoA estimation errors -mean value (mean), root mean square error (RMSE), standard deviation (std) -and precision -calculated for various distances between the transmitter and the receiver.
environment, in which the measurements took place and its potential interferences.It is also worth mentioning that for 3 and 5 meters the results are similar while increasing the distance to 10 meters results in lower accuracy.

D. DIRECTION OF ARRIVAL ESTIMATION IN MULTIPLE SENSOR SETUP
To verify the sensor's capabilities of the direction of arrival estimation in multiple sensor scenarios, we conducted a series of measurements with two and three sensors being localized at the same time.In these setups, we verified the influence of the increase of the number of sensors on the time of the estimation and its resolution.In the two sensor scenario, the first sensor had a fixed position at 0 • while the second one was located in 5 different positions ϕ = {10 • , 30 } away from the first one, which is illustrated in Fig. 15 Table 4 presents the results for simultaneous DoA estimation in two and three sensor setup.It is easy to notice that the results are very similar to those with a single WSN module what proves that, in principle, the increase of the number of localized sensors does not influence significantly DoA estimation accuracy.It has to be emphasized that since the tests covered only 5 locations for each sensor instead of 36 as it was in a single sensor setup, the results should not be compared directly.
Additionally, we have measured the time of collecting the RSS values for one, two and three sensors.The time of measuring and collecting 100 packets for each of 12 antenna configurations is 5 seconds, giving a total of around 60 seconds for the whole measurement in a single sensor setup.This is determined by the transmission delay of 50 ms between the consecutive packets transmitted from the localized sensor.For two and three sensors the measurement time is respectively 127 and 206 seconds.Since the transmission was performed in a datagram mode, the non-linear increase of the measurement time is due to the collisions of transmitted packets -more packets transmitted causes higher possibility of collision and the necessity of packet retransmissions.To reduce this effect, the delay of 50 ms has been added.

E. DoA ESTIMATION TIME REDUCTION
To investigate the possibility of DoA estimation time reduction, we conducted a number of tests to verify the accuracy of the estimation performed with a limited number of packets.For this purpose, DoA estimation was performed using the varying number of packets, namely 50, 25, 10, 5, 3, 2 and 1, collected for each antenna configuration.Additionally, in every case, we measured the total DoA estimation time.Table 5 presents the results for 5 m distance between the transmitter and the receiver, while the errors for different distances are compared in Fig. 16.It is easily noticeable that the total estimation time decreases with the number of packets.This is because the major part of total estimation time is the time of collecting the packets, while the computation time of a single DoA estimation is approximately 248 ms.
The results gathered in Table 5 and in Fig. 16 indicate that the resulting estimation accuracy is only slightly affected by the decreasing number of packets collected during the DoA estimation process.It means, that the proposed ESPARantenna based WSN node can provide acceptable DoA estimation results even when a small number of packets is

VI. CONCLUSION
In this paper, low-cost and energy-efficient ESPAR-antenna based WSN node with direction of arrival (DoA) estimation capability has been presented.To this end, complete integration of ESPAR antenna together with radio frequency (RF) transceiver, microcontroller and switching circuit on a single two-layer PCB has been proposed and presented for both the design and the final prototype.Thanks to low-current SPDT FET switches, used instead of high energy-consuming PIN diodes or DSP units, and an ultra-low power [37] wireless microcontroller, the integrated sensor can be considered as energy-efficient.Additionally, an adaptation of power-pattern cross-correlation (PPCC) algorithm for efficient implementation in a JN5168 microcontroller has been proposed to enable DoA estimation functionality within the WSN node.Measurements in a real-life outdoor environment have shown that the proposed integrated ESPAR-antenna based WSN node is capable of providing acceptable DoA estimation results with 7.91 • , 6.58 • and 9.47 • RMS estimation errors for distances between WSN nodes equal to 3 m, 5 m and 10 m respectively, while the time of a single DoA estimation that requires measured RSS values at the antenna output for each antenna configuration is 248 ms.Moreover, the implemented algorithm has also been successfully verified in a setup involving simultaneous DoA estimation of two and three localized WSN nodes and in a scenario with a limited number of packets recorded at the antenna output port to reduce the overall time required for the DoA estimation process.As a consequence, the proposed low-cost and energy-efficient ESPAR-antenna based WSN node can successfully be used in real deployments, for example smart farming applications, in which IoT devices are placed within wide areas and the use of DoA estimation capabilities may play a vital role in increasing the overall performance of the whole network.

FIGURE 1 .TABLE 1 .
FIGURE 1. ESPAR antenna design together with numbering of its passive elements.All the dimensions are in millimetres.

FIGURE 6 .
FIGURE 6. Components placement on the bottom of the WSN node.

FIGURE 7 .
FIGURE 7. Activity diagram of implemented DoA estimation C code.

FIGURE 8 .
FIGURE 8. Anechoic chamber measurement setup used for the calibration phase of the PPCC algorithm.

FIGURE 10 .
FIGURE 10.Aerial view of the test site [39].Distances between centrally placed ESPAR antenna-based WSN node and WSN sensors used to verify DoA accuracy are marked with yellow arrows, while the red font indicates directions used in DoA estimation measurements.

FIGURE 11 .
FIGURE 11.Test configuration overview: a) side view, b) top view.

FIGURE 12 .
FIGURE 12. Test setup arranged for the measurements in 3 meters distance.

FIGURE 13 .
FIGURE 13.RSS measured by ESPAR antenna-based WSN node in relation to the directions of the WSN test node for the steering vector V 3 max = [001111100000] at 3 m distance between both nodes (see text for explanations).

FIGURE 14 .
FIGURE 14. DoA estimation errors obtained from the measurements in a single sensor setup for different distances between the ESPAR antenna-based WSN node performing DoA estimation and the test sensor node.

FIGURE 15 .
FIGURE 15.Test configuration for (a) two sensors and (b) three sensors for simultaneous DoA estimation in multiple WSN setup.Red crosses indicate test WSN nodes positions (see text for explanations).

TABLE 4 .TABLE 5 .
DoA estimation errors calculated for various distances between the transmitters and a receiver in the proposed multiple sensor setup.DoA estimation errors and total DoA estimation time for various number of packets collected for each antenna configuration (see text for explanations).

FIGURE 16 .
FIGURE 16.DoA estimation errors -root mean square error (a) and precision (b) -calculated with different number of measured packets and for various distances between the transmitter and the receiver.
gathered giving the possibility to significantly decrease the overall DoA estimation time and, in consequence, also energy consumption associated with the estimation process.

TABLE 2 .
RSS measurements results in relation to the distance between ESPAR antenna-based WSN node and the WSN test node for the steering vector V 3 max = [001111100000] (see text for explanations).