To study the intelligent sensing and positioning technology of the Internet of Things (IoT) combined with the
K
-nearest neighbor algorithm, the
K
-nearest neighbor matching algorithm and optimization algorithm are introduced using the indoor Wi-Fi positioning technology. The study proposes weighting
K
-nearest neighbor (WKNN) by weighted Euclidean distance, adaptive weighted Euclidean distance K-nearest neighbor Wi-Fi localization algorithm, and optimal
K
-value Wi-Fi fingerprint localization algorithm. The experimental error is verified. The experimental results show that the lowest error of continuous acquisition of 3 s signal values in experimental environment A is 1.8815 m, which is 10.13% lower than the error of only acquiring 1 s for the same
K
-value. The lowest error of environment B scheme two can reach 1.8862, which is 7.06% lower than the error of the same
K
-value. The optimal
K
-value Wi-Fi fingerprint positioning algorithm by distance constraint has better positioning accuracy than other KNN positioning algorithms, and the positioning fluctuation is smaller. The average positioning error of the optimal
K
in environment A is 1.2987 m, which is 0.2797 m less than the average of the traditional positioning algorithm. In environment B, the average positioning error of the optimal
K
is 1.5353 m, which is 0.3253 m less than the average of the traditional positioning algorithm. Therefore, the optimal
K
-value Wi-Fi positioning algorithm proposed has better performance.
scite is a Brooklyn-based organization that helps researchers better discover and understand research articles through Smart Citations–citations that display the context of the citation and describe whether the article provides supporting or contrasting evidence. scite is used by students and researchers from around the world and is funded in part by the National Science Foundation and the National Institute on Drug Abuse of the National Institutes of Health.