# Accurate Indoor Localization with IoT Devices and Advanced Fingerprinting Methods
## 2 Materials and Methods
### Method
#### 2.2.2 The Second Phase: The Implementation of Locating Algorithms  
In the second phase of the operation, by designing an application and upgrading the back-end methods, internal location is performed in 4 different ways. In the first two methods, location is conducted without the fingerprint method. The other two methods of location are performed in conjunction with the fingerprint method, each of which benefits from a combination of different algorithms. After implementing the location application, the server is ready to implement various methods of location in the desired methods for the target point. Location with Weighted Centroid Localization (WCL) Algorithm  
The first location method considered in this research is the WCL algorithm so that it can be used as a benchmark for measuring other innovative methods of this research. Therefore, location using this method is conducted without any change in the structure presented for it in the research [10]. \[p(si)=\frac{\sum_{j=1}^{N_{r}}(RSS_{ij}\cdot b_{j}(x,y))}{\sum_{j=1}^{N_{r}} RSS_{ij}} \tag{2}\]  
Equation (2)--Formula for calculating spatial coordinates by the WCL method. According to this algorithm, the strength of the signals received from each transmitter is multiplied by the transmitter's X and Y coordinates, then added and subtracted. The denominator of the fraction is the sum of the power of the signals. Finally the coordinates of the point found are displayed on the map. To further illustrate the functionality of this algorithm, we tested a sample of the received data. Locating with Positive Weighted Centroid Localization (PWCL) Algorithm  
In this section, by improving the WCL method and in fact compensating for the weakness of this method, the tendency of the found points is towards stronger signals. The received RSSIs are inherently negative numbers, and the larger these negative numbers (they tend to zero), the stronger the signal. Therefore, in the WCL method, the final response tends to the center of the triangle. But in the new PWCL method, the received signals are  
Figure 6: User interface of application in sampling phase. added to the signals before being included in the WCL formula, due to the fact that the received signals fluctuate in the range of \(-40\) to \(-100\). The final response tends to lean towards the strongest transmitter. \[\mathrm{P}(\mathbf{si})=\frac{\sum_{j=1}^{\textit{nr}}((RSS\mathbf{Iij}+100). \mathbf{bj}(\mathbf{\textit{x}},\mathbf{\textit{y}}))}{\sum_{j=1}^{\textit{nr} }(RSS\mathbf{Iij}+100)} \tag{3}\]  
Equation (3)--Formula for calculating spatial coordinates by the PWCL method. 2.2.2.3.Locating with Fingerprinting Algorithm by Applying Outlier Detection Filter  
One of the main challenges of the fingerprint method is the presence of noise. Signals are affected by environmental conditions such as human movement and obstacles that prevent them from reaching the user. The detection of these signals requires filtering to make the received data offline unreliable. 2.2.2.4.Locating with Fingerprinting Algorithm by Applying the Most Frequent Filter  
Based on Subscription  
According to the fingerprint algorithm in the online location section, the data received in the online section is compared with all the data received in the offline section, and finally the customer's location is found. But an examination of the data received in the offline section shows that in different places the power of the signals received from the transmitters can be exactly the same. 2.2.2.5.Locating with the Fingerprinting Algorithm by Applying a Mapping Filter to the Path  
In this section, after determining the location point, and before sending the signal to the customer, another filter is applied to the result to check the desired point for possibility or in other words, confirmation of the route point.