Feasibility of a Stochastic Collaborative Beamforming for Long Range Communications in Wireless Sensor Networks

: Wireless Sensor Networks (WSNs) is a group of spatially dispersed autonomous sensor devices, named motes. These motes have a microcontroller, sensors, are powered by AA or AAA batteries, and mainly have the ability to communicate using the IEEE 802.15.4 standard. The motes communicate between them inside the WSN exchanging packets using a multi-hop routing. They use a very low amount of power (below 100 mW). This limits the maximum communication distance between motes within the WSN. Usually, one mote acts as a gateway to other networks and this mote is also called sink or simply Base Station (BS), and the data collected by the sensors of each mote are sent to this mote. The maximum distance between the BS and the nearest mote is below 100 m because of the power limitations of the motes. If the WSN-BS distance is above this boundary, the communication will surely fail. We propose a new technique in order to achieve a long range communication from the WSN, for instance to communicate to a Low Earth Orbit (LEO) satellite. Many proposals in the literature based on Collaborative Beamforming (CB), also known as Distributed or Cooperative Beamforming, for these long range communications are found, however the synchronization of clocks is an almost impossible task given the simplicity and cheapness of the architecture of the motes. To overcome this problem, we propose a new technique, named Stochastic Collaborative Beamforming (SCB), in which we take advantage of the synchronization errors of the clocks. In SCB, it is possible to obtain the adequate time delay that permits the interference or sufﬁcient gain in the direction of the receiver. This gain is obtained from interfering independent signals coming from each mote of the WSN, using a repetition scheme. Although it does not get all the nominal gain that could be obtained in case of a perfect synchronization, it does get a sufﬁcient gain to reach the BS with limited power consumption.


Introduction
Wireless Sensor Networks (WSNs) is a group of small devices called nodes or motes. These nodes or motes contain a microcontroller to which a multitude of sensors can be attached and which have the capacity to communicate mainly using the IEEE 802. 15.4 [1] standard in the ISM (Industrial Scientific Medical) band. The interest in these types of networks lies in the simplicity of their implementation, the nodes are autonomous elements powered by batteries (AA or AAA of 1.5 Volts), which can be deployed implementing virtually any type of network topology. Once the nodes are of antennas, the dimensions of the cluster determine the pointing capability and ultimately the gain of the cluster. Large antenna arrays have an extraordinary gain, which allows them to sweep the space with a "pencil beam" in radar systems. This improves the possibilities of CB transmission of a WSN, with a large number of motes, spread over a large area, especially considering the eventual cost of such a deployment compared to an antenna of such dimensions.
However, CB transmission has not ceased to be a chimera in the face of the challenges posed to the hardware with which the motes are constituted, as can be seen in [8][9][10][11][12][13], mainly due to inaccuracy of their clocks and their synchronization. We must not forget that they are very economical devices that have not been designed for this purpose, and we must devise the procedure that would allow us to obtain CB with the limitations imposed by its architecture [14].
In order to achieve the typical pointing of beam-forming applications, delays of the order of a fraction of the wavelength or very small delay times (a small fraction of nanoseconds) are necessary. These small delays are impossible to achieve with the motes currently available on the market [14]. A fixed pointing would be possible if the clocks of the motes could be synchronized, with zero offset for all the motes; the fixed pointing would be achieved with the spatial delays associated with the special separation of the motes. This would require a meticulous spatial deployment by adequately controlling the special position of each mote. Even so, it would be difficult due to the errors of synchronization of the motes mentioned above [14] as well as the lack of the perfect location.
Finally, we analyze the viability of these possibilities and propose a form of transmission named Stochastic Cooperative Beamforming (SCB), where it would be possible to achieve pointing gain without the need to demand great features to motes hardware.
The rest of this paper is structured as follows. In Section 2 we put in context the work previously done related to CB, in Section 3 we measure WSN communications in a real deployment. In Section 4 we describe the SCB and its implementation. Finally, in Section 5 we conclude the paper.

Related Work
The techniques known as Cooperative Beamforming (CBF) or Distributed Cooperative Beamforming (DCBF) are not new [15,16]. The idea behind these techniques is to obtain a virtual cluster of antennas by joining the antennas of the WSN motes [17]. An antenna array gets more radiation or more radiation gain in the desired direction thanks to the constructive interference of the emissions of each of the antennas. The same is intended by combining the emissions of the WSN motes, [18]. But an array is powered by a single oscillator, usually connected to a network of unlimited energy while each mote of a WSN has a different oscillator, being powered by AA or AAA batteries or other small batteries; this poses in the CB or DCB many technical challenges.

Beamforming
Initial work was directed to study the effect on beamforming of antenna clusters with random spatial distributions based on the theory of antenna array [15], and also to the study of synchronization [19,20]. Although the CB-DCB proposals are old, little progress has been made in the last 14 years in terms of their practical application in a real WSN deployment [21]. The main problem is the synchronization and the introduction of time delays, the mote cannot introduce the necessary delays for the strict beamforming and electronic steering that an array can perform, and this is because its architecture is very simple and low cost [14]. It needs to be remembered that the hardware of the motes is little more than a microcontroller capable of communicating at short distances with the standard IEEE 802.15.4, [14]. The fundamental difference between CB or DCB in WSN and an array of antennas is that in an array there is only one oscillator that generates the carrier, and with WSN-CB-DCB independent oscillators are treated, one in each mote, and this imposes many technical limitations [14]. This also imposes the use of WSN-CB-DCB in emission but prevents its use in reception, which is why the utility of WSN-CB-DCB is to achieve a higher transmission gain only, to get with sufficient intensity (RSSI) to a receiver that would be at a large distance from the WSN, [22]. The WSN-CB-DCB starting point was the theory of antenna clusters with random spatial distributions, and has been based on the hypothesis that phase (temporal offset) and frequency (frequency offset) synchronization is possible, and they theorize about beamforming from those assumptions. For instance, using the theory of antenna arrays with Gaussian spatial distribution [23,24], with random or arbitrary spatial distribution of the nodes [25,26], using a closed loop with 1-bit feedback to correct the phase offsets [27], or by changing the direction of the beam [28]. The control of the radiation pattern by a proper adjustment of nulls and sidelobe levels was theorized [29,30], because the power that is radiated in the undesired directions is wasted (as are the side lobes). The final objective of these proposals is to save battery power [31]. Finally, it was also proposed that the CB-DCB sends the signal to multiple directions [32]. At the same time, the development of CB-DCB techniques seeks an intelligent choice of emitting nodes to minimize energy consumption [33,34]. Battery power is extremely important for the survival of the WSN. If one of the nodes depletes its energy it can no longer monitor or transmit. This node is lost to the network, and if more nodes are lost the WSN may cease to be useful. The energy of the nodes is therefore a precious asset that must be used to the maximum because this will determine the longevity of the WSN. In this way a line of work arises that focuses on looking for synchronization procedures and choice of nodes for CB-DCB that are very efficient in order to minimize energy consumption, for example [35,36]. In [37], a convex optimization procedure is formulated to maximize the network lifetime taking in account other miscellaneous sources of battery depletion different from that of communications, and genetic algorithms are also used to obtain the maximum lifetime [38], looking for optimal phase and amplitudes at each node. However, there is no clearly defined and widely accepted metric to evaluate the energy and longevity of a WSN. There are several metrics used by different researchers that also change their definition according to the author, for example for some authors the longevity of the WSN is the period of time that the WSN can attend a QoS, [37]. For others, it is defined as the number of operational motes, with enough battery, after a CB-DCB, and finally other researchers calculate it as the time it takes to remain inoperative (without battery) the first node [38].
Another metric used in WSN is the total energy consumed in a CB-DCB transmission, so one way to minimize it would be to minimize the number of internal transmissions within WSN and also in a CB-DCB, [37].
The fundamental objective of CB-DCB is to reach large distances in the transmission, to transmit to a BS far away from the WSN area. Therefore, a very suitable metric to evaluate the range is the signal-to-noise ratio (SNR) in the receiver. The SNR is related to the power emitted in CB-DCB mode towards the receiver, and the received signal strength (RSS) in the receiver, this is in turn related to the capacity of the transmission channel C = log 2 (1 + SNR). In these cases, the energy consumption in the WSN is not taken into account, being the objective to reach enough energy to send the signal with sufficient quality to the receiver.
But the main problem presented by CB-DCB is synchronization. Most of the work published to date that presents CB-DCB algorithms and that intend to optimize the targeting, radiation pattern, and energy, they consider that a perfect synchronization of the motes is possible. However, without a perfect synchronization of the motes, all of these algorithms cannot be effective. Usually, the motes are not synchronized, there are offsets of carrier and time, and this offset depends on the battery level in each node, as well as environmental parameters such as temperature, [14], without a perfect synchronization the CB-DCB is impossible. (1) The above expression is the CB-DCB gain, which is the metric we use to evaluate the power in the direction of the receiver, which would be in the direction θ, ϕ, and which depends on the frequency and time offsets ∆f k and ∆t k . The WSN would be deployed on the ground (z k = 0), in positions x k , y k , with carrier f c , and with emission powers related to a k , and phases α k . The ∆f k and ∆t k offsets are unknown due to the lack of synchronism. Without an adequate correction of these phase shifts it is impossible to apply all the previous CB-DCB procedures. This metric is linearly related to the received signal strength (RSS) and the normalized received signal strength (NRSS) which in turn is related to the synchronization of the motes through ∆f k and ∆t k . This is the metric that will be used in this work. The previous expression contemplates the possibility that the motes emit with different power, and the normalized CB-DCB gain would be G/N, being N the total number of motes.
A great deal of effort has been put into proposing synchronization procedures. Synchronization procedures can be divided into two groups: closed loop and open loop. In closed-loop procedures there is an exchange of information between WSN and BS. BS evaluates the RSS of the signal received from WSN and according to a certain criterion responds to WSN so that the motes correct the phases [19]. Depending on the bits used in the feedback and the phase selection procedure, these procedures can take time to converge, and can be costly in terms of energy consumed, thus the energy necessary to know the channel state is avoided in [39]. Although 1-bit closed-loop convergence is demonstrated in [40], it consumes energy and is susceptible to improvement as demonstrated in [41,42]. For that reason, techniques are introduced that in closed loop send more information (in addition to RSS) to make convergence faster [43,44], introducing phase predictors such as the Kalman filter [45], which show significant computing power needs, in some cases requiring the use of Digital Signal Processors (DSP), [46]. This type of closed-loop synchronization procedures is not applicable to our case since in principle BS would be out of reach of the WSN motes individually, so it would not be possible to exchange WSN-BS information. Other researchers propose an open loop synchronization, in which there is no feedback from the receiver, a main node is established within the WSN that is the master who coordinates the synchronization of all slave nodes, depending on the procedure these techniques can consume many resources and energy, and are carried out in groups of motes selected within the WSN to decrease globally the energy consumption, [47], this depends strongly on the operating system and the algorithm implementation [48]. Energy consumption and effective beamforming algorithms are closely related, for instance in null avoidance [49], and a very recent work where a new adaptive beamforming time with round-robin MAC was presented [50].

Practical Implementations
We could end this section by saying that the most objective indicator of the state of the art in CB-DCB is the number of practical applications in which it has been carried out, and we come to the conclusion that its viability is limited, mainly by the difficulties of synchronization [14]. The first work that reports results that are close to 90% of the theoretical estimates uses three emitting nodes with FPGA (Field Programmable Gate Arrays), [20] and synchronizing in closed loop with transmission from the receiver to the WSN of 1-bit, an FPGA presents more complexity for the developer than a commercial mote. The second is for a WSN transmitting at 60 GHz [51], but no details are given of the hardware to reproduce the results. In 2010 with a time-slotted round trip synchronization method, a prototype is built with acoustic signals, called Acoustic Cooperative Communication Experimental Network Testbed [52], but it is not the same to perform beamforming with acoustic signals where the speed of sound is 340 m/s that with radio frequency with the speed of light 2.99792 × 10 8 m/s, because the offsets in beamforming are related to the wavelength, λ = c/f. In [53] a WSN was introduced that used analog signals to synchronize but was unstable. Finally, in 2012 [54] the first CB-DCB that synchronizes time phase and carrier with closed-loop synchronization with 1-bit exchange was introduced. It was implemented with Software Defined Radio and used a Kalman filter predictor [54], which is obviously very complex to perform on a simple commercial mote like the ones we use. In a work published in 2011, [55], a prototype was implemented without feedback from the receiver and without synchronization in phase and carrier with two emitting nodes. This work was extended to four nodes later [56].
From the analysis of the experimental set-ups, it can be seen that Universal Software Radio Peripherical (USRP) are the preferred hardware elements when implementing CB-DCB. The networks contain at most four elements with a single destination, and the experimental results presented are close to the theoretical calculations on which they are based. But only Sklivanitis et al. [55,56] show experimental results with WSN developed with very simple and basic motes in line with the work presented in this article. In our work we make use of a synchronization signal coming from the BS that reaches all the motes of the WSN, the BS plays the role of master node that requires the synchronization of all the nodes of the WSN.
In this paper we present a way to circumvent the problem of time synchronization in CB-DCB, with very simple motes, very basic low-cost hardware. In our case the evaluation metric will be SCB gain that is related to RSS in the receiver. We obtain time offsets measured experimentally in low-cost commercial motes and use them to derive the gain under various experimental assumptions. We demonstrate in a semi-empirical way that around 60-80% of the ideal theoretical results could be obtained. The SCB we propose is semi-blind open-loop synchronization, in which a master node is defined within the WSN that coordinates the synchronization of all slave nodes with the information they will transmit [16], when they receive the activation bit from the BS. A simple algorithm is presented and this algorithm is tested by means of a Monte Carlo procedure. This work also presents real measures of signal range in various situations of real deployment to monitor parameters of agricultural interest and the previous procedure is proposed and tested for a future practical implementation, on the ground.

Energy Issues
In a typical application of temperature monitoring with the ZigBee RF transceiver, TI CC2420 chip, this consumes 17.4 mA for an emission power of 0 dBm, emitting in ideal conditions, 50 Ω on a balun, according to the specifications (www.ti.com/lit/ds/symlink/CC2420.pdf, p. 54), and consumed 8.5 mA for a minimum emission of −25 dBm. In a typical application of sampling the temperature and sending the temperature every second, between 18 and 23 mA is consumed according to our experimental measurements [47]. For our motes that are fed with two AA batteries with maximum capacity 2200 mAh the available energy is E = V·As = 23,760 Joules, being V = 3 Volts the voltage that they supply and As = 2.200 × 3600 the Ampers-second. This seems to indicate that a mote that is continuously consuming 23 mA has a longevity of four days. However, it is very important to say that the motes are not going to be continuously consuming 23 mA, and that consumption also depends on the operating system and the operations it performs with the implemented program. If the program is optimized, the consumption can fall to values between 0.7 and 5.23 mA [47]. In addition, the consumption depends on the size in number of symbols of the message. On the other hand, as the difference between emitting −25 dBm and 0 dBm (300 times more power) is reflected by a double current consumption, we think that for practical purposes it is convenient to emit with the maximum power to get as far as possible. It is more convenient to use a subset of motes in transmission than to use all the motes with less power to save energy globally. In this situation, the proper metric is not the longevity of a WSN. We think that in order to evaluate the energy consumption in SCB we have to evaluate the number of transmission attempts that allow to reach the distant BS, assuming that all the nubs transmit 0 dBm, the maximum that our motes can emit (TI CC2420 chip).

Maximum Distance between Motes in Experimental Deployments
For the study of the maximum experimental distance, we use Cypress motes with the Programmable System on Chip (PSoC) Starter Kit [3]. These motes use the ZigBee standard, which is a wireless communications standard designed by the ZigBee Alliance. ZigBee is based on the IEEE 802.15.4 standard and is aimed at applications that require secure communications with low data rate and maximization of battery life, using AA batteries, as shown in Figure 1. These motes are used to study the maximum distance as well as analyze the performance of this kind of IEEE 802.15.4 based communications. In particular, measurements are taken in an outdoor real deployment of a WSN to monitor soil moisture and other environmental parameters in a typical area of the interior of the Valencian Community (Spain), in a wood area, following a procedure similar to [57,58] (Figure 2). Table 1 shows the measurements in different terrains and environments. It must be noticed, as it could be expected, that the communication range is less than 100 m, except when we lift the motes and then we reach 120 m. On the basis of the measurements of the maximum distance, a WSN is planned with the aim of monitoring the degree of humidity of the soil in a plot of 20 Ha, as shown in Figure 3, in the vineyards of the Sierra de Negrete (València). The communication between motes within the WSN will be done by multiple hop transmission. But additionally, if a transmission is raised to a BS located 30 km or a LEO satellite as we previously said, we will proceed with the approach of the following section. We must find out the way to get a constructive interference in the direction of the receiver. These motes are used to study the maximum distance as well as analyze the performance of this kind of IEEE 802.15.4 based communications. In particular, measurements are taken in an outdoor real deployment of a WSN to monitor soil moisture and other environmental parameters in a typical area of the interior of the Valencian Community (Spain), in a wood area, following a procedure similar to [57,58] (Figure 2). Table 1 shows the measurements in different terrains and environments. It must be noticed, as it could be expected, that the communication range is less than 100 m, except when we lift the motes and then we reach 120 m. These motes are used to study the maximum distance as well as analyze the performance of this kind of IEEE 802.15.4 based communications. In particular, measurements are taken in an outdoor real deployment of a WSN to monitor soil moisture and other environmental parameters in a typical area of the interior of the Valencian Community (Spain), in a wood area, following a procedure similar to [57,58] (Figure 2). Table 1 shows the measurements in different terrains and environments. It must be noticed, as it could be expected, that the communication range is less than 100 m, except when we lift the motes and then we reach 120 m. On the basis of the measurements of the maximum distance, a WSN is planned with the aim of monitoring the degree of humidity of the soil in a plot of 20 Ha, as shown in Figure 3, in the vineyards of the Sierra de Negrete (València). The communication between motes within the WSN will be done by multiple hop transmission. But additionally, if a transmission is raised to a BS located 30 km or a LEO satellite as we previously said, we will proceed with the approach of the following section. We must find out the way to get a constructive interference in the direction of the receiver.  On the basis of the measurements of the maximum distance, a WSN is planned with the aim of monitoring the degree of humidity of the soil in a plot of 20 Ha, as shown in Figure 3, in the vineyards of the Sierra de Negrete (València). The communication between motes within the WSN will be done by multiple hop transmission. But additionally, if a transmission is raised to a BS located 30 km or a LEO satellite as we previously said, we will proceed with the approach of the following section. We must find out the way to get a constructive interference in the direction of the receiver.

Cooperative Stochastic Transmission Planning
As stated, without lack of generalizability, and to ease the understanding, we will assume the BS is placed in a Low Earth Orbit (LEO) satellite, with an altitude between 200 and 2000 km. In this scenario, we must find a way to achieve constructive interference in the direction of the receiver. It is assumed that the distant BS has enough energy to communicate with the motes (non-cooperative reception), but the motes independently do not reach the BS or satellite. Thus, the motes need to make a coherent transmission with constructive interference in the direction of the BS.
We are facing an asymmetric or non-reciprocal situation in which the BS would have enough power to send a signal of sufficient intensity to the motes, but not the other way around. It is assumed that the WSN is distributed on the ground, and the BS are in some direction above them at a great distance, in a LEO a satellite. So, the BS transmits a beacon to the WSN motes to indicate that it is above them, because the BS (with more powerful hardware and a precise clock) knows where it is at all times and where the WSN is too. This broadcast communication is done directly from the emitter to all the motes. The motes when receiving the beacon are aware that the satellite or BS is in its upper space. This communication takes place for all the motes at the same time, except for the small delay associated with their different spatial positions. The reception of the beacon starts the synchronization and the transmission from all the motes of the WSN simultaneously. Thus, the motes start to emit the same message, following a loop until the BS receives the message as shown in the next algorithm:

Cooperative Stochastic Transmission Planning
As stated, without lack of generalizability, and to ease the understanding, we will assume the BS is placed in a Low Earth Orbit (LEO) satellite, with an altitude between 200 and 2000 km. In this scenario, we must find a way to achieve constructive interference in the direction of the receiver. It is assumed that the distant BS has enough energy to communicate with the motes (non-cooperative reception), but the motes independently do not reach the BS or satellite. Thus, the motes need to make a coherent transmission with constructive interference in the direction of the BS.
We are facing an asymmetric or non-reciprocal situation in which the BS would have enough power to send a signal of sufficient intensity to the motes, but not the other way around. It is assumed that the WSN is distributed on the ground, and the BS are in some direction above them at a great distance, in a LEO a satellite. So, the BS transmits a beacon to the WSN motes to indicate that it is above them, because the BS (with more powerful hardware and a precise clock) knows where it is at all times and where the WSN is too. This broadcast communication is done directly from the emitter to all the motes. The motes when receiving the beacon are aware that the satellite or BS is in its upper space. This communication takes place for all the motes at the same time, except for the small delay associated with their different spatial positions. The reception of the beacon starts the synchronization and the transmission from all the motes of the WSN simultaneously. Thus, the motes start to emit the same message, following a loop until the BS receives the message as shown in the next algorithm: In this case, the motes are trying to receive from the BS. Then, when the BS sends the broadcast beacon, the receiving motes will be synchronized (assuming their internal accuracy). The motes are ordered to synchronize with a relative delay between them due to their different spatial position in receiving the triggering signal from the BS. The synchronization process is carried out between the motes of the WSN, which adjust the offsets of their respective clocks communicating with each other. The errors of clock and synchronism mean that the time offsets vary randomly between all the motes. These random time offsets have a certain probability of generating a constructive interference and to give rise to a random pointing. The pointing direction in which the constructive interference is achieved varies randomly for each instant due to clock errors. In this way, a random pointing or stochastic pointing is achieved, which in principle, and after a number of M repetitions of the message, manages to be high enough to get the signal to the BS. Finally, when the BS receives the message, it will send a new beacon (acknowledgment) to the motes of the WSN to notify of the correct reception and put an end to the repetition.
It is important to highlight, that due to the half-duplex communication scheme of the motes, as well as their limited energy, the receiving process is always done asynchronously and in duty-cycles. This must be taken into account, both at the initial beacon from the BS and the acknowledgment. In both cases, once a mote had received the message (beacon from the BS), it will spread the information among their neighboring motes in the WSN. Also, notice that meanwhile the motes are transmitting in order to make a CB, they will switch periodically to reception mode in order to receive the acknowledgement of the BS.
In addition, if the BS on the satellite knows the position of the WSN, it can send the beacon when it is on the vertical to minimize the distance of transmission. However, if the position of the WSN is unknown, the BS can periodically send beacons to activate the transmission from the WSN. In this case, it is very probable that the transmission will be activated outside the zenith of the WSN, ascending the BS or descending the BS. In any case, as long as BS does not receive the message, WSN will not cease on the transmissions. In some attempt of transmission M, the signal will manage to reach the BS because a cooperative gain will have been achieved in the angular direction where the BS is located, and this BS will not necessarily be found in the zenith of the WSN.

Array Theory Concepts
The term beamforming derives from the fact that early spatial filters were designed to form pencil beams in order to improve the reception of a signal radiated from a specific angular location [59], also for transmitting a signal to a target in a narrow angular direction avoiding the waste of power by sending signals to other undesired directions. Electromagnetic waves and also acoustical waves were used in sending signals, and beamforming is the term that names the phenomenon by which the interference of a number of diferent signals provides a given radiation pattern. If in some angular directions the interference increases the signal level relative to a single radiator, we say that we have a positive interference or beamforming gain.
In radiofrequency communications, the signal is sent using electromagnetic waves and beamforming is achieved by interference of the signals received (beamforming in reception) or emitted (beamforming in emission). The interferences are produced by the superposition of the waves coming from a large number of antennas which are usually located in a regular spatial stencil. These radiating structures are called antenna arrays.
The precise location and current feed of every antenna in an antenna array permits the constructive and destructive interferences at particular angles, thus tailoring a specific radiation pattern, in emission and reception, and providing an improved directivity or gain compared with omnidirectional antennas or radiators [59]. Almost omnidirectional antennas are usually used in array implementations to avoid undesired nulls of the radiation pattern. The antennas of motes are almost omnidirectional antennas, thus are well suited for beamforming applications.
The signal coming from an array of identical antennas located at positions x k , y k (planar distribution) can be written as, where a k is related to the current feed of the k antenna, and AF is the array factor. The oscillator is the same for every antenna, thus there is no frequency deviation between different antenas. For a WSN in a planar distribution constituted by N motes, we have different oscillators, one for each mote. Also, synchronization mismatches exist, therefore when every mote tries to send the same signal trying to imitate the beamforming of an antenna array we say that we have CB or DCB, and a more appropiate expression to describe the beamforming gain is above (Equation (1)). For an ideal WSN perfectly synchronized deployed along a line, we would have Equation (3) having an ideal Gain G = (AF) N = N, for a k = 1, the same as an uniform linear array. Also, an ideal WSN perfectly synchronized deployed along a planar distribution N x × N y would have an ideal Gain, G = (AF) Nx×Ny = N x × N y , for a k = 1, the same as a uniform two-dimensional array given in Equation (4).
Beamforming is a comment term employed in RAdio Detection And Ranging (RADAR), and Sound Navigation And Ranging (SONAR) technologies. At the begining of RADAR technology, beamforming was achieved using large parabolic reflectors, later on with the development of electronics the use of arrays using electronic steering was extended [59].

Uniform Linear Distribution
The maximum theoretical gain for this case is G N = N, where N is the number of motes. This would be achieved with perfect synchronization without delays and it is obtained from the theoretical antenna Array Factor (AF) for the "broadside" case [59], θ = 90 • , being θ the angle with respect to the array axis. We consider a spatial separation between motes d k = 70 m, and α k would be the temporal offset by desynchronization. It is also considered the parameter a k that would be a power correction factor for each mote that may differ within the motes of WSN by the level of load of the batteries or the characteristics of the terrain where each mote is located. This parameter would include possible blockage, reflections in objects around or soil properties such as moisture. Thus, the general expression for the gain of N motes is: The delays or time offsets of the clocks in the synchronization process are measured in the motes and these are used to simulate their operation. Figure 4 presents the distribution of the time offsets after a process of synchronization of the motes of the WSN [14,15]. The measured time delays are adjusted to a normal distribution whose result corresponds to (µ, σ) = (0.03, 165. 22  These results are used to launch a large number of Monte Carlo simulations of SCB transmissions in which the gain is calculated, in each transmission attempt from attempt n = 1 to n = 100, and the radiation behavior of the WSN is analyzed. The behavior of WSNs is studied with several numbers of motes, from N = 2, 3 ... to 20 motes, in which the temporal delays are introduced following the distribution function obtained experimentally. Figure 5 shows the broadside gain obtained in the case of a WSN with 20 motes. This is the case in which it would be expected to achieve greater gain, because the greater the number of motes and the more signal would be added in phase in case of constructive interference. Figure 5 shows the distribution of results for 100 transmission attempts, where the theoretical maximum achievable would be G = 20. We observe a Gaussian distribution, in which a gain of 20 is not reached, but in which an acceptable gain is obtained, G = 3.7 ± 1.9, (95% CI [3.3, 4.1]). But, more importantly, we also observe that the right tail of the distribution approaches 10, reaching a maximum value of 8.5. That is to say, the maximum gain is not reached, which is logical because the synchronization of all of them is not possible, but if the WSN successively launches transmissions, following the procedure described above, there would be a hope of obtaining a gain of 3.7, with a confidence interval CI 95% [3.3, 4.1]. Moreover, by making 100 transmissions, a gain greater than 8.4 would be achieved in transmission attempts n = 52, 53 and 90. Although there is a significant average gain, we are clearly interested in obtaining the maximum gain, or at least a large percentage of the maximum gain. Thus, a WSN with 20 motes has a gain greater than 40% of the maximum gain in n = 52 (G = 8.4), n = 53 (G = 8.5), and n = 90 (G = 8.4). Figure  6 shows the WSN gain for each attempt, and also presents the results for a WSN of five motes and a WSN of nine motes, that is N = 5 and N = 9 as well as N = 20 already defined and the WSN are denoted as WSN-5, WSN-9 and WSN-20 respectively. It is interesting to see what happens when we increase the number of motes that make up the transmission. From Figure 6, the greater the number of motes, the greater the gain in an SCB, but there is no linearity between the increase in the number of motes and the gain. A WSN with 9 motes (N = 9) has a gain greater than 60% of the maximum gain in n = 2 (G = 5.5), n = 3 (G = 6.2), n = 4 (G = 5.9), n = 26 (G = 6.6), n = 88 (G = 5.4), and n = 94 (G = 6.0), and a WSN with five motes (N = 5) has a gain greater than 60% of the maximum gain in n = 27 (G = 4.2), n = 41 (G = 4.1), n = 63 (G = 4.3), and n = 69 (G = 4.2). The WSN-9 case approaches the WSN-20 case in gain, and the WSN-5 case approaches the WSN-9 case. These results are better understood when normalized. Figure 7 presents the results from Figure 6 normalized to the maximum theoretical ideal gain, which for a WSN-20 is 20, for a WSN-9 is nine and for a WSN-5 is five. The results for these cases are better shown in Figure 8, where the adjustment of the results to a normal distribution is also presented. A WSN with N = 9 motes has an average value of the gain (100 attempts) G = 2.8 ± 1.5, (95% CI [2.5, 3.1]), and a WSN with N = 5 motes, has an average value of the gain (100 attempts) G = 2.0 ± 0.9, (CI 95% [1.8, 2.2]). These results are used to launch a large number of Monte Carlo simulations of SCB transmissions in which the gain is calculated, in each transmission attempt from attempt n = 1 to n = 100, and the radiation behavior of the WSN is analyzed. The behavior of WSNs is studied with several numbers of motes, from N = 2, 3 ... to 20 motes, in which the temporal delays are introduced following the distribution function obtained experimentally. Figure 5 shows the broadside gain obtained in the case of a WSN with 20 motes. This is the case in which it would be expected to achieve greater gain, because the greater the number of motes and the more signal would be added in phase in case of constructive interference. Figure 5 shows the distribution of results for 100 transmission attempts, where the theoretical maximum achievable would be G = 20. We observe a Gaussian distribution, in which a gain of 20 is not reached, but in which an acceptable gain is obtained, G = 3.7 ± 1.9, (95% CI [3.3, 4.1]). But, more importantly, we also observe that the right tail of the distribution approaches 10, reaching a maximum value of 8.5. That is to say, the maximum gain is not reached, which is logical because the synchronization of all of them is not possible, but if the WSN successively launches transmissions, following the procedure described above, there would be a hope of obtaining a gain of 3.7, with a confidence interval CI 95% [3.3, 4.1]. Moreover, by making 100 transmissions, a gain greater than 8.4 would be achieved in transmission attempts n = 52, 53 and 90. Although there is a significant average gain, we are clearly interested in obtaining the maximum gain, or at least a large percentage of the maximum gain. Thus, a WSN with 20 motes has a gain greater than 40% of the maximum gain in n = 52 (G = 8.4), n = 53 (G = 8.5), and n = 90 (G = 8.4). Figure 6 shows the WSN gain for each attempt, and also presents the results for a WSN of five motes and a WSN of nine motes, that is N = 5 and N = 9 as well as N = 20 already defined and the WSN are denoted as WSN-5, WSN-9 and WSN-20 respectively. It is interesting to see what happens when we increase the number of motes that make up the transmission. From Figure 6, the greater the number of motes, the greater the gain in an SCB, but there is no linearity between the increase in the number of motes and the gain. A WSN with 9 motes (N = 9) has a gain greater than 60% of the maximum gain in n = 2 (G = 5.5), n = 3 (G = 6.2), n = 4 (G = 5.9), n = 26 (G = 6.6), n = 88 (G = 5.4), and n = 94 (G = 6.0), and a WSN with five motes (N = 5) has a gain greater than 60% of the maximum gain in n = 27 (G = 4.2), n = 41 (G = 4.1), n = 63 (G = 4.3), and n = 69 (G = 4.2). The WSN-9 case approaches the WSN-20 case in gain, and the WSN-5 case approaches the WSN-9 case. These results are better understood when normalized. Figure 7 presents the results from Figure 6 normalized to the maximum theoretical ideal gain, which for a WSN-20 is 20, for a WSN-9 is nine and for a WSN-5 is five. The results for these cases are better shown in Figure 8, where the adjustment of the results to a normal distribution is also presented. A WSN with N = 9 motes has an average value of the gain (100 attempts) G = 2.8 ± 1.5, (95% CI [2.5, 3.1]), and a WSN with N = 5 motes, has an average value of the gain (100 attempts) G = 2.0 ± 0.9, (CI 95% [1.8, 2.2]).

Random Linear Distribution and Stochastic Transmission Activation
This type of spatial distribution would not be the one initially proposed to monitor the area of study, but it is interesting to analyze it because it would be applicable to a deployment of motes made from the air by a helicopter or a drone over an inaccessible area. We consider up to N = 20 motes in which the clock offsets are obtained from measurements ( Figure 4), but now these are located in a random way along a line of length of 1.0 km. We make a Monte Carlo simulation in which we introduce again the random delays measured in the motes [13,14]. In addition, 20 cases are considered in which the number of distributed motes that are activated to transmit change from i = 2 to i = N/2 motes. For example, the WSN can activate the emission of 2.3, ... N/2 motes randomly for each WSN-N case. This case would respond to the possibility that not all motes transmit at every attempt, because the motes do not have enough energy in the battery, because they have deteriorated over time or because some physical obstacle blocks the trigger signal from the BS or its own signal. Figure 9 shows the maximum gain obtained in the broadside direction as a function of the number of motes, and the maximum gain normalized to the theoretical maximum as a function of the number of motes used. It is observed how the gain increases logarithmically when the number of motes increases. If we take into account the maximum achievable gain, normalizing the maximum gain, this decrease from N = 5, but always being above 40% of the theoretical maximum gain. This result indicates that it is necessary to look for a trade-off solution: with a number of motes that allows a sufficient gain, from a certain number of motes that the gain increase is reduced. The activation of the transmission would be stochastic, given that a priori the state of the motes would not be known, nor all have received the trigger correctly from the BS.

Random Linear Distribution and Stochastic Transmission Activation
This type of spatial distribution would not be the one initially proposed to monitor the area of study, but it is interesting to analyze it because it would be applicable to a deployment of motes made from the air by a helicopter or a drone over an inaccessible area. We consider up to N = 20 motes in which the clock offsets are obtained from measurements ( Figure 4), but now these are located in a random way along a line of length of 1.0 km. We make a Monte Carlo simulation in which we introduce again the random delays measured in the motes [13,14]. In addition, 20 cases are considered in which the number of distributed motes that are activated to transmit change from i = 2 to i = N/2 motes. For example, the WSN can activate the emission of 2.3, ... N/2 motes randomly for each WSN-N case. This case would respond to the possibility that not all motes transmit at every attempt, because the motes do not have enough energy in the battery, because they have deteriorated over time or because some physical obstacle blocks the trigger signal from the BS or its own signal. Figure 9 shows the maximum gain obtained in the broadside direction as a function of the number of motes, and the maximum gain normalized to the theoretical maximum as a function of the number of motes used. It is observed how the gain increases logarithmically when the number of motes increases. If we take into account the maximum achievable gain, normalizing the maximum gain, this decrease from N = 5, but always being above 40% of the theoretical maximum gain. This result indicates that it is necessary to look for a trade-off solution: with a number of motes that allows a sufficient gain, from a certain number of motes that the gain increase is reduced. The activation of the transmission would be stochastic, given that a priori the state of the motes would not be known, nor all have received the trigger correctly from the BS.

Random Linear Distribution and Stochastic Transmission Activation
This type of spatial distribution would not be the one initially proposed to monitor the area of study, but it is interesting to analyze it because it would be applicable to a deployment of motes made from the air by a helicopter or a drone over an inaccessible area. We consider up to N = 20 motes in which the clock offsets are obtained from measurements ( Figure 4), but now these are located in a random way along a line of length of 1.0 km. We make a Monte Carlo simulation in which we introduce again the random delays measured in the motes [13,14]. In addition, 20 cases are considered in which the number of distributed motes that are activated to transmit change from i = 2 to i = N/2 motes. For example, the WSN can activate the emission of 2.3, ... N/2 motes randomly for each WSN-N case. This case would respond to the possibility that not all motes transmit at every attempt, because the motes do not have enough energy in the battery, because they have deteriorated over time or because some physical obstacle blocks the trigger signal from the BS or its own signal. Figure 9 shows the maximum gain obtained in the broadside direction as a function of the number of motes, and the maximum gain normalized to the theoretical maximum as a function of the number of motes used. It is observed how the gain increases logarithmically when the number of motes increases. If we take into account the maximum achievable gain, normalizing the maximum gain, this decrease from N = 5, but always being above 40% of the theoretical maximum gain. This result indicates that it is necessary to look for a trade-off solution: with a number of motes that allows a sufficient gain, from a certain number of motes that the gain increase is reduced. The activation of the transmission would be stochastic, given that a priori the state of the motes would not be known, nor all have received the trigger correctly from the BS.  Figure 9 also shows the case in which not all the motes radiate the same energy. This is the case of the WSN with a linear distribution with random spacing but with an emission power lower than the maximum at all the motes. This case would be similar to the previous one, but instead of several motes not being operative, all of them would be, but with a power lower than the maximum. This would correspond better with a real deployment in which the motes are not at the same distance, and in which by different circumstances associated to the characteristics of the terrain and the environment, they transmit with less energy. The results show deterioration in the WSN's gain, but still gain is achieved in this case, that we consider as the most unfavorable.

WSN with Two-Dimensional Distribution
We are now going to study the case of a WSN with two-dimensional spatial distribution, since theoretically it would lead to a greater gain (ideal case). If we have a distribution of N x = four motes along a horizontal line, and N y = four motes along the perpendicular horizontal line, assuming the motes are identical and the separation is the same, we can expect an ideal maximum gain of N x × N y = 16.
To see if a higher gain is really achieved, the SCB procedure of the previous case is repeated. A Monte Carlo simulation is carried out in which the random delays are introduced as we did before according to [14]. It is considered a WSN with N = N x × N y motes, N x = 4, N y = 4 separated dx = dy = 70 m in which ideally there would be phase shift x = y = 0, with which the maximum pointing would be obtained at, θ = 90 • , ϕ = 90 • , in the direction perpendicular to the plane that contains the motes, k = 2 f /c, (c = 2.9978 × 10 8 m/s). Thus, the expression of the gain is as follows: a nm e jk(x nm cos ϕ sin θ+y nm sin ϕ sin θ−α nm ) (4) Figure 10 shows the normalized gain in the direction θ = 90 • , ϕ = 90 • , versus the number of attempts. It is observed that a gain higher than 50% of the maximum theoretical gain is achieved in 3% of the attempts. Figure 10 shows 100 transmissions, where random clock offsets result in a gain greater than 50% of the maximum gain in transmissions n = 20, 39, and 41. In addition, the maximum stochastic gain is 9.8, achieved in transmission n = 39, and the average gain value is G 2D = 3.7 ± 1.8, (95% CI [3.4, 4.1]). Figure 11 shows the distribution function of the gains where an acceptable adjustment to a Gaussian distribution is observed, and where the right side of the tail is observed with gain values displaced to the right of the mean, approaching the theoretical maximum value.  Figure 9 also shows the case in which not all the motes radiate the same energy. This is the case of the WSN with a linear distribution with random spacing but with an emission power lower than the maximum at all the motes. This case would be similar to the previous one, but instead of several motes not being operative, all of them would be, but with a power lower than the maximum. This would correspond better with a real deployment in which the motes are not at the same distance, and in which by different circumstances associated to the characteristics of the terrain and the environment, they transmit with less energy. The results show deterioration in the WSN's gain, but still gain is achieved in this case, that we consider as the most unfavorable.

WSN with Two-Dimensional Distribution
We are now going to study the case of a WSN with two-dimensional spatial distribution, since theoretically it would lead to a greater gain (ideal case). If we have a distribution of Nx = four motes along a horizontal line, and Ny = four motes along the perpendicular horizontal line, assuming the motes are identical and the separation is the same, we can expect an ideal maximum gain of Nx × Ny = 16.
To see if a higher gain is really achieved, the SCB procedure of the previous case is repeated. A Monte Carlo simulation is carried out in which the random delays are introduced as we did before according to [14]. It is considered a WSN with N = Nx × Ny motes, Nx = 4, Ny = 4 separated dx = dy = 70 m in which ideally there would be phase shift x = y = 0, with which the maximum pointing would be obtained at, θ = 90°, ϕ = 90°, in the direction perpendicular to the plane that contains the motes, k = 2 f/c, (c = 2.9978 × 10 8 m/s). Thus, the expression of the gain is as follows: (4) Figure 10 shows the normalized gain in the direction θ = 90°, ϕ = 90°, versus the number of attempts. It is observed that a gain higher than 50% of the maximum theoretical gain is achieved in 3% of the attempts. Figure 10 shows 100 transmissions, where random clock offsets result in a gain greater than 50% of the maximum gain in transmissions n = 20, 39, and 41. In addition, the maximum stochastic gain is 9.8, achieved in transmission n = 39, and the average gain value is G2D = 3.7 ± 1.8, (95% CI [3.4, 4.1]). Figure 11 shows the distribution function of the gains where an acceptable adjustment to a Gaussian distribution is observed, and where the right side of the tail is observed with gain values displaced to the right of the mean, approaching the theoretical maximum value.   Table 2 shows the case 5 × 5, 6 × 6, 7 × 7, and 8 × 8. The gain increases in increasing the number of motes, however this increase in gain does not follow a linear relationship with the number of motes Nx × Ny similarly to the one-dimesional deployment. What is important in the results is that maximum gain is achieved in a reduced number of transmission trials, which is important in order to make a reduced consumption of energy which in turns is positive for the lifetime of the WSN.

Conclusions
In this work we have presented and analyzed the different options to make a Stochastic Collaborative Beamforming (SCB) using conventional motes. With this, we have demonstrated the possibility of implementing communications from WSN to BS, when it is at a great distance.
In order to be able to implement communications at great distances (long range communications), it has been seen that the transmission power of the motes, as well as the techniques based on multihop routing protocols are insufficient. Thus the need arises to introduce the technique proposed and described in this article.
We have considered the implementation of collaborative transmission by assuming random retransmissions of the motes that make up the WSN network, introducing synchronization errors that are imperfections inherent to real motes existing in the market. These imperfections allow to obtain the offsets and the consequent pointing that allow the constructive interference after many repetitions of the emission. The necessary gain is obtained for the communication under the imposed limitations. The operation of SCB has been demonstrated using different types of topologies: uniform linear, irregular linear, as well as for a two-dimensional WSN. From all of them, it can be seen that the key factor is the number of motes, N, which forms the network. In all cases, N is the parameter that most influences the gain achieved, but this increase is asymptotic, and a trade-off must be found between the cost of a greater number of motes and their effective gain. Using the proposed Stochastic Collaborative Beamforming (SCB) algorithm, one can definitely think of locating the mote sink (or BS) at great distances, of the order of tens or hundreds of kilometers.  Table 2 shows the case 5 × 5, 6 × 6, 7 × 7, and 8 × 8. The gain increases in increasing the number of motes, however this increase in gain does not follow a linear relationship with the number of motes N x × N y similarly to the one-dimesional deployment. What is important in the results is that maximum gain is achieved in a reduced number of transmission trials, which is important in order to make a reduced consumption of energy which in turns is positive for the lifetime of the WSN. Table 2. WSN with two-dimensional distribution N x × N y motes, SCB transmission with 100 trials. It is shown maximum gain, iteration in which maximum gain is achieved, average gain, and 95% Confidence Interval.

Conclusions
In this work we have presented and analyzed the different options to make a Stochastic Collaborative Beamforming (SCB) using conventional motes. With this, we have demonstrated the possibility of implementing communications from WSN to BS, when it is at a great distance.
In order to be able to implement communications at great distances (long range communications), it has been seen that the transmission power of the motes, as well as the techniques based on multihop routing protocols are insufficient. Thus the need arises to introduce the technique proposed and described in this article.
We have considered the implementation of collaborative transmission by assuming random retransmissions of the motes that make up the WSN network, introducing synchronization errors that are imperfections inherent to real motes existing in the market. These imperfections allow to obtain the offsets and the consequent pointing that allow the constructive interference after many repetitions of the emission. The necessary gain is obtained for the communication under the imposed limitations. The operation of SCB has been demonstrated using different types of topologies: uniform linear, irregular linear, as well as for a two-dimensional WSN. From all of them, it can be seen that the key factor is the number of motes, N, which forms the network. In all cases, N is the parameter that most influences the gain achieved, but this increase is asymptotic, and a trade-off must be found between the cost of a greater number of motes and their effective gain. Using the proposed Stochastic Collaborative Beamforming (SCB) algorithm, one can definitely think of locating the mote sink (or BS) at great distances, of the order of tens or hundreds of kilometers.
Finally, it must be pointed out that the distribution of the motes could a priori be chosen quasilinear or two-dimensional, but this choice would not exist de facto since it would be determined by the geographical area to be monitored. For example, an almost regular two-dimensional distribution would be the most suitable for monitoring agronomic data in crops and a quasi-linear distribution for monitoring hydraulic parameters in watercourses or road traffic. In any of the cases analyzed it is demonstrated that it is possible to obtain cooperative gain, within the limitations imposed by the mote clocks, and the maximum attainable gain would be limited by N, being N the number of motes of the WSN, regardless of whether the distribution is linear, linear with uniform separation, linear with irregular spacing, linear with irregular spacing and random activation, or two-dimensional. In either case, gain is achieved by following the SCB algorithm described in this paper.