The hardware simulation of ratio metric vector iteration algorithm in wireless sensor networks

The most significant challenge in Wireless Sensor Networks (WSNs) is determining the location of sensor nodes for localization and tracking moving targets. There are some approaches to determining a location. One consideration is using a global positioning system (GPS) for each sensor node deployed. We report the implementation of RVI to determine the localization of the WSN model, which uses the actual hardware equipped with GPS to deal with the physical parameter constraints, including hardware characteristics and environmental conditions. We investigated two critical parameters: the Received Signal Strength Indicator (RSSI) and the location coordinated by GPS. The measurement results show that the environmental conditions influence the value of RSSI, like shadowing, which causes path loss. The verification experiment shows that the RVI algorithm significantly gives correction in determining the localization using RSSI. The increasing iteration number decreases error: iteration 70 resulted in an error of about 26% compared with iteration 15, with an error of about 64%. This method can also determine the location coordinates five times faster than the used GPS. In summary, the RVI method, by using RSSI data, can inform the location coordinate close to GPS information. Therefore, the location coordinate can be determined without using GPS modules.


INTRODUCTION
A wireless sensor network consists of sensor nodes with sensing, signal processing, and communication capabilities to collect data by monitoring and detecting environmental variables.Sensor nodes collect data and send it to gateways that can process it locally or redirect it to other networks for various purposes (Lee et al., 2006;Zhang and Pan, 2018).
The Network (WSN) has many advances and applications because it can distribute node data transmission and self-organization, but they also face some challenges (Zhu et al., 2021).There are many challenges in the WSN application as node coverage area, energy consumption of sensor nodes and data routing.Locating sensor nodes is most important for detecting and tracking moving targets (Lee et al., 2006;Zhang and Pan, 2018;Strumberger et al., 2019).
In recent years localization has become a significant attraction for research where assigning a location to each node is a key requirement.There are several ways to determine the location.One idea is to equip each sensor node with a GPS module.However, energy consumption for data transmission and node utilization and node failure for cost and size may occur.Moving sensors for acoustic WSN, for example, underwater measurement, cannot use GPS to determine position (Strumberger et al., 2019;Singh and Mittal, 2020;Al-Quayed et al., 2021).
The exact location determination of target sensor nodes is the positioning issue in the WSN.The determining process utilizes an anchor node to determine the distance and position of target nodes with triangulation methods and time of arrival (ToA) methods, receive signal strength indicator (RSSI), and angle of arrival (AoA).Anchor node is sensor nodes with existing precise locations equipped with a GPS, and their location is determined.Many positioning algorithms and methods exist for GPS sensor nodes and non-GPS nodes, which can be divided into scale-based and scale-free methods.Distancebased localization algorithms use distance estimation and angle-based techniques between an unknown target node and an anchor node with a specific location.It can use a triangulation technique to evaluate the distance between the unknown target node and the anchor node to find the coordinates of the unknown target node.Scale-free localization algorithms rely on topological data to accurately determine the target nodes' location.However, previous studies have shown that this algorithm could be more cost-effective for practical applications (Zhu et al., 2021).
Several research activities related to localization include experiments based on cluster-based architecture, Auto-Regression Moving Average (ARMA) model, or Weighted Centroid algorithm through RVI and RSSI-based backoff timer.The cluster master implements the localization algorithm using the energy measurements received from the sensor members in the cluster-based architecture.This solution developed a new formula using tabu simulations to increase localization accuracy and energy efficiency.This algorithm shows stable behaviour over several parameter variables for the power decay model (Al-Quayed et al., 2021).
The Weighted Centroid algorithm is an enhanced version that does not rely on total distance estimation.This algorithm uses a traditional sensing model based on RSSI.RSSI decreases exponentially with propagation distance (Lee et al., 2006).Nodes are meaning detection sensors, taking into account a rough distance estimate from RSSI.A weighted centroid algorithm performs joint implicit monitoring of small messages over RVI and RSSI-based backhauls, ensuring low collision probability.
This paper reports works where we implemented the ratio metric vector iteration algorithm for node localization in the WSN model based on RSSI and verified its accuracy with the GPS's result.The researcher developed this algorithm from the Weighted Centroid algorithm simulated before (Lee et al., 2006).In this algorithm, nodes localize themselves to the centroid of reference points or targetdetecting sensors and consider the distance from the RSSI.This research contributes to giving more information about the technical problems and the accuracy of the calculation in the realization of RVI in real applications, which have yet to be discussed in detail in other papers.The WSN model uses the actual hardware to deal with the physical parameter constraints, including hardware characteristics and environmental conditions.We investigate two critical parameters.These parameters are RSSI and the location coordinated by GPS.The correlation of RSSI is not strictly linear with distance.The environmental conditions influence the value of RSSI, like shadowing, which causes path loss.The other important aspect is hardware characteristics like antenna gain, which influences the transmitted power.The specification of GPS and the existence of obstacles due to environmental conditions influenced the accuracy of detected location coordinates.

The WSN Prototype
The system model consists of a gateway and eight similar sensor nodes where the two sensor nodes have two functions simultaneously as the anchor and data sender.The other six sensor nodes function as detectors.Furthermore, the detector sensor nodes are called sensor nodes.The sensor nodes have a function to detect temperature and position via GPS.The eight sensor nodes can request the gateway to get their location information according to their RSSI.In operation, the system has several stages.These stages are the retrieval of location data from the sensor node, tracking stage, and sensor reading stage.
The anchor nodes have a function to provide distance information between the sensor node and the anchor node.A calculation can determine the sensor node's location according to this distance.The anchor node must have a known and fixed location for giving a location reference.
The initial stage of system operation is the gateway's data retrieval process.At this stage, the sensor node must be active alternatively to avoid data collisions.The sensor node will request the gateway to get the distance information from the gateway and anchor nodes.The ratio metric vector iteration (RVI) algorithm will calculate these data in the X and Y coordinates.If a sensor node moves and the coordinate changes, the RVI carries out the calculation, and the GPS information as a reference validates the new coordinate by comparison.
The second stage is determining the cluster head as the destination for data sending from the sensor node.This cluster also has other functions as an anchor.The third or last stage is sending data by sensor nodes.Fig. 1 shows the localization diagram of the sensor.

Receive Signal Strength Indicator (RSSI)
The distance estimation between transmitters uses RSSI values.This estimation uses parameters of RSSI from the sensor node.These parameters are i at node j at time t or    () (dBm) and transmitted power    (dBm).These parameters are constant due to the transmitted power and the antenna gains of the sensor nodes, and path-loss model   () (dBm) is an uncertainty factor due to multi-path or shadowing.We can get the    () as Equation ( 1).
With i indicates the transmitted node, j indicates the receiver node in distance   , and η is the attenuation constant or a path loss exponent.The value of η is dependent on the environment.The η values are variated from 2 to 4 depending on the environment (Qureshi et al., 2016).
The value of   () , which varies depending on environmental conditions is determined through Equations ( 2) or (3).
The power is converted from mW to dBm and vice versa by Equations ( 4) and (5).
Calculating the exponent of path loss of environment is needed to estimate the strength of the signal at different discrete distance points.It gives an estimation of signal strength decreases with the various distance in that environment.According to the relation of signal's power with the distance, the factor η is a linear regression line (Qureshi et al., 2016) and absorption loss estimation.As in Equation ( 6).
Using Equations ( 3) and ( 6), we can extract the path loss component as  =  10 . Where  is a straight line,  is the slope of the line,  is the distance along calculated values, and  is constant.
This paper uses the RSSI value calculation to estimate the distance.We used the same transmission power level for each sensor.Therefore, we assumed that the antenna and hardware are similar and give the same amplification.

Weighted Centroid Technique
One of the distributed solutions is the centroid technique.This technique is independent on total distance estimates.According to this technique, each node localizes to the centroid of reference points or anchor nodes as targetdetecting sensors.The sensor node carries out this localization by using poor distance estimation based on RSSI.Furthermore, the weighted centroid technique is a progressive version of the centroid which estimates the location of target in a two-dimensional Euclidean plane.
Where  is a weight function, that is,  = 1 means that the weight is an inverse of distance, and  = 2 mention a square inverse function.If  = , where α is the path loss component, this equation uses sensing data as weights,   =   .The estimated location of the target by Weighted Centroid,   , is given by Equation ( 8) (Lee et al., 2006).

Ratio Metric Vector Iteration Algorithm
Ratio metric vector iteration is an algorithm of localization using a distance ratio.This algorithm uses a weighted technique to determine an initial guess which nearest to the location of target.In Fig. 2, if  and   represent the real location of the target and the consideration location at the j th iteration, we can shift   toward  to decrease the deference of distance ratio � 1  �������⃗ �: � 2 ���⃗ �: �  3  ��������⃗ � = 1: 3: 3 and a distance ratio For this purpose, we multiply vectors     �������⃗ by the difference of ratio to compose a vector   ��⃗ .Then we added   ��⃗ to the   .
This vector translation of   by   ��⃗ is repeated until   is close to the real location  (Lee et al., 2006).We are using the generalized algorithm decryption (Lee et al., 2006) from step 0 until step 4 to find termination conditions as algorithm output shows Equation (9).
Otherwise, we increment the index j, and the algorithm goes to step 1. Ratio matric vector iteration illustration can be seen in Fig. 2. The difference in the algorithm identity and the system can be seen in Table 1.

Experiment Setup of Proposed Method
This research was conducted in 4 stages: observing the RSSI value for varied distance, converting GPS data to X-Y coordinates, converting RSSI data to X-Y coordinates, and verifying the RVI's calculated coordinates based on RSSI's result to GPS coordinates.
In the first step, the experiment is conducted to measure the RSSI value of the varied distances between the sensor node and gateway in the range of 70 m with a change of 5 m.This experiment uses an 8-bit microcontroller with a LoRa shield as the sensor node and gateway.The second step is to define the GPS position of the gateway and anchor it to the X-Y coordinate.In this research, the origin is manually defined.The next step is to find the coordinate of the sensor node based on the RSSI value.In this part, the influence of iteration number is also investigated.The used iteration number were 15, 35, 50 and 70.The result of the algorithm calculation is finally verified by comparing it to the position coordinates from GPS.

RESULTS AND DISCUSSION
This research implements the RVI algorithm on hardware, a WSN model.Previous studies (Madani et al., 2013;Park and Kim, 2013) have proven by simulation that the RVI algorithm can determine node positions if the anchor positions are known or confirmed.The results of this study can be used as a reference in implementing the RVI method in real conditions.The details of the research results are described below.

Investigation of the RSSI based on Varied Distances
We investigated RSSI by sending data characters from the gateway to anchors and sensor nodes.We carried out the investigation three times.In this investigation, we use distance as variated variable and show the investigated data in Table 2 and Fig    Where d is the distance of the sensor node to the gateway in meters,    is the transmitted power, and ղ is the path loss coefficient.The transmitted power    has a strong correlation with the hardware specification.We carried out further experiments and found that by using the maximum power level of our devices and path loss coefficient 2 with consequence   () = 0 , the RSSI is -41 dBm for 1 m distance.Therefore, the transmitted power and the antenna gains of the sensor node are 41 dBm.

The Correlation of GPS and Coordinate
The Location of The Gateway, Anchor 1 and Anchor 2 can be seen in Fig. 4 and Table 3.We investigated the area 100 × 100  2 outdoors.We determined the condition below: 1.The gateway is in the coordinate (X, Y), which has been converted from GPS. 2. The anchor nodes are in GPS's fixed coordinate (X, Y).First, we converted the latitude and Longitude of the GPS reading to coordinates X and Y, and then we scaled it to the origin coordinate (0, 0).Equations ( 11) and ( 12) convert GPS reading to coordinates X and Y: where  = earth diameter (6471 km), λ is longitude, φ is latitude, and φ 0 is the latitude near the center of the map.

The Correlation of RSSI and Coordinate
We have known already the relationship between RSSI and distance.We also knew the coordinate of the gateway, Anchor 1 and Anchor 2. Therefore, using the triangle equation, we can estimate the coordinate of each sensor node referring to the anchor coordinate and the RSSI of the sensor node to anchor.Fig. 5 shows the gate position, Anchor 1, Anchor 2 and sensor node.G, A1, A2 and X are, respectively, of the gate, Anchor 1, 2 and nodes.On the other side, d1, d2 and d3 are the distance between the sensor node to gate, Anchor 1 and Anchor 2. Table 4 shows the coordinates according to RSSI and GPS for six sensor nodes in the variable location.The initial iteration of the RVI algorithm uses these data in the calculation.Furthermore, we implemented the RVI algorithm to the sensor nodes 1, which has coordinates 50.12; 98.28 according to RSSI.In this implementation, the number of iterations dramatically influences the accuracy.In former research, the approach takes iterations up to 50 (Lee et al., 2006).The actual experiment proves this result and shows the proofing result in Table 5 and Fig. 6, where the accuracy increased with the increasing number of iterations.
The experiment result of iteration in Table 5 shows that the error decreases by increasing the iteration number.In another case, RSSI's inaccuracy of coordinate determination is influenced strongly by path loss caused by obstacles like buildings, trees, and atmosphere conditions.Furthermore, the RVI calculation uses the RSSI value.In this case, in determining the path loss coefficient, ղ must consider the obstacle because other research has calculated the ղ value.

The Testing of the System
We tested a whole system on the 100 × 100 m 2 area using one gateway, two anchor nodes, six sensor nodes, and an RVI iteration number of 70.Fig. 7 shows the localization of the system.The determined coordinate using RSSI, GPS and RVI algorithms for six sensor nodes with 70 iterations can be seen in Table 6 and the coordinate can be seen in Fig. 8.     From the results in Table 6 and Fig. 8, we found that the determined coordinate by RVI improved the coordinate of RSSI by using the GPS coordinate as a reference.Table 7 shows the error of the determined RSSI and RVI coordinates referring to the GPS-determined coordinate.On average, the determined RVI coordinates are closer to the determined GPS coordinates.Generally, the results show that the RVI algorithm improves the measurement of RSSI to close the GPS measurement results.The improvement is needed to counter the challenges caused by the characteristics of RSSI value, which depend on the environmental condition.
Further discussion is about the consumed time to run the RVI algorithm.Table 8 shows the time required to obtain information from 14 GPS nodes spread over 14 locations.It is known that the average time required to access data from one GPS is 1 min and 50 s.
To determine the effectiveness of the RVI algorithm, we will compare the time needed to determine the sensor node position based on the proposed method compared to execution using direct GPS.The calculation of the time required is divided into two parts.The first is the time needed to determine the RSSI value of the gateway-anchor and sensor node-anchor.The second part is the time needed to execute the RVI algorithm on the microcontroller.Because the execution time of this section depends on iterations, the time calculation process is obtained by calculating the time required for one iteration multiplied by the number of iterations.Equation 13 is used to calculate the total time needed.
Where T is the Total Time, n is the number of nodes,   is the time needed to measure RSSI value,   is the time needed to execute one iteration of the RVI algorithm.The number '2' is associated with two anchors.Based on the experiment measurement,   is 0.70 s,   is 0.05 s.The number of sensor nodes is 6, and the number of iterations is 70.Therefore, the total needed time is 17.50 s.Compared to the time needed to obtain coordinates by using GPS for 6 nodes and 2 anchors, the proposed method can obtain the position of all nodes 5 times faster.

CONCLUSION
This research applied the RVI algorithm to determine the position of 6 sensor nodes based on the GPS position of 2 anchors.The process of realizing the RVI algorithm begins with reading the GPS position of the anchor and gateway.Furthermore, the gateway will collect RSSI data for each node against the gateway and anchor, which will then calculate the position of each node.The sensor node position is finally verified by comparing data from the GPS deployed on the sensor node.The verification experiment showed that the accuracy of the RVI depends on the number of iterations used: 70 iterations produce an error of 26%, and 15 iterations produce an error of 64%.Determining location coordinates using the RVI algorithm based on RSSI is 17.50 s or five times faster than using the used GPS.These results can be used as a reference to know the position of many sensor nodes without using GPS modules.

Fig. 3 .
Fig. 3.The RSSI value in variated distanceTable2and Fig.3show that the RSSI decreased by increasing the distance of the sensor node from the gateway.RSSI's relation to distance can be formulated by Equation (10).

Fig. 4 .
Fig. 4. The location of the gateway, Anchor 1 and Anchor 2 related to origin

Fig. 6 .Fig. 7 .
Fig. 6.Effect of iteration number to error The coordinate position measured by RSSI, RVI, and GPS; (a) X coordinate and (b) Y coordinate

Table 1 .
The difference in the algorithm identity and the

Table 2 .
The RSSI value in variable distance

Table 3 .
The localization of the gateway, Anchor 1 and

Table 4 .
The triangle equation realization to coordinate six nodes without RVI iteration

Table 5 .
The effect of iteration on the RVI algorithm result

Table 6 .
The determined coordinate using RSSI, GPS and RVI algorithms for six sensor nodes with 70 iterations.

Table 7 .
The error of RSSI coordinate and RVI coordinate compare to GPS coordinate

Table 8 .
Consumed time to obtain GPS location