134 American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) ISSN (Print) 2313-4410, ISSN (Online) 2313-4402 © Global Society of Scientific Research and Researchers http://asrjetsjournal.org/ Wi-Fi Localization with a Case Study of Mobile Robot Asst. Prof. Dr. Hamid M. Hasana*,Atheer J. Baqirb a,bUniversity of Technology, Control and systems Eng. Dept. Iraq aEmail: Hamid2012net@gmail.com,bEmail: Atheerjaafer@yahoo.com Abstract Estimating the location of the mobile robot in an indoor environment is a fundamental challenge nowadays. The accuracy of positioning Mechanisms such as GPS is often limited for indoor environments. In this study, we develop the feasibility of building an indoor localization system that is cost effective for large scale deployments, can operate over existing Wi-Fi networks, and can provide flexibility to accommodate new sensor observations as they become available. This paper focuses on the use of Wi-Fi for communicating with and localizing the robotby Wi-Fi received signal strength indication (RSSI) to calculate the distance between the robot and access point (AP). Also we need to figure out the accurate orientation of the platform in 2D environment. Keywords: localization; mobile robot; Wi-Fi. 1. Introduction Successful localization is a very important issue for indoor mobile robots [1]. In the past, a variety of approaches to localization have been explored, include using sonar [2], laser scanners [3], kinematic of mobile robot [4], infrared beacons [5] and computer vision [6]. With the increasing prevalence of wireless LAN, “Wi-Fi,” considerable work has been done on using signal strength measurements from Wi-Fi access points for localization [7].Wi-Fi location determination systems use the popular 802.11b network infrastructure to determine the user location. This makes these systems attractive in indoor environments where traditional techniques, such as Global Positioning System (GPS) fail [8, 9].Wireless networks have become a critical component of the networking infrastructure and are available in most corporate environments (universities, airports, train stations, tribunals, hospitals, etc.) and in many commercial buildings (cafes, restaurants, cinemas, shopping centers, etc.) [10, 11]. Then, new homes are slowly starting to add Wi-Fi services in order to enable mobility to perform many routine tasks.Thorough studies of Wi-Fi signal propagation properties. ------------------------------------------------------------------------ * Corresponding author. http://asrjetsjournal.org/ American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2018) Volume 47, No 1, pp 134-144 135 These studies determine the relationship between received signal strength (RSSI), bandwidth, link quality, and distance, which is required for understanding Wi-Fi AP deployment and communication [12]. There are multiple techniques implemented to determine location, one of them is called Wi-Fi fingerprinting where every point in the region of interest is covered by at least k Aps[13]. Another Wi-Fi Localization technique that was considered was Wi-Fi Triangulation [14], this technology uses Wi-Fi signals to estimate the distance between the user and the transmitter. The distance was used to generate a circle around each transmitter. Then, by getting the intersection of the three circles, the location of the user was pinpointed. If given the correct information, it will produce a unique answer. As you can see above, all techniques are depends on more than one AP, in this paper we try to develop localization technique using single AP only. 2. Background To determine the robot position we need the calculation of the distance between the AP and the receiver which mounted on the robot. This can be achieved using the path loss equation 2.1 Log distance path loss equation In this section, localization system designed based on RSSI signal will be presented based on the log-distance path loss model [9] shown in equation (1). PL (dB) = PL (d0) +10 n log d d0 ……………… (1) Where PL indicates the path loss level, the value of n depends on the surroundings and building type (assumed 3.25 in calculations), d0 is the close-in reference distance which is determined from measurements close to the transmitter, d is the distance between the transmitter and the receiver. 2.2 Kalman filter The Kalman filter is a set of mathematical equations that provides an efficient computational (recursive) solution of the least-squares method. The filter is very powerful in several aspects: it supports estimations of past, present, and even future states, and it can do so even when the precise nature of the modeled system is unknown [17]. Surly we notice that there a huge difference between true and calculated readings in some points, in this paper we will use this filter to find an intermediate path for the robot between spacing values [18]. Kalman filter can be described by the following two equations: State equation: American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2018) Volume 47, No 1, pp 134-144 136 𝑥𝑥𝑘𝑘+1 = 𝐴𝐴𝑥𝑥𝑘𝑘 + 𝐵𝐵𝑢𝑢𝑘𝑘 + 𝑤𝑤𝑘𝑘…….…. (2) Output equation: 𝑦𝑦𝑘𝑘 = 𝐶𝐶𝑥𝑥𝑘𝑘 + 𝑧𝑧𝑘𝑘……………………... (3) In the above equations A, B, and C are matrices; k is the time index; x iscalled the state of the system; u is aknown input to the system; y is themeasured output; and w and z are thenoise. The variable w is called theprocess noise, and z is called the measurementnoise. Each of these quantitiesis (in general) vectors and thereforecontains more than one element. The vector x contains all of the information about the present state of the system, So if we will measure the position every T seconds, the A, B and C matrices will be. Where 𝐴𝐴 = │1 𝑇𝑇 0 1│𝐵𝐵 = │𝑇𝑇 2/2 𝑇𝑇 │𝐶𝐶 = [1 0] 𝑤𝑤𝑘𝑘 = 15.3𝑧𝑧𝑘𝑘 = 0.4 3. Method and tools The range between the Wi-Fi source and the receiver after filtering is used with combination of inertial measurement unit (IMU) to accurately determine the mobile robot position. Real experimental environment is used for evaluation, which consisting a prototype of two wheel drive mobile robot (WMR) with (AP). The prototype WMR plus Wi-Fi receiver and IMU was built from scratch as shown in figure (1). Figure1: WMR American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2018) Volume 47, No 1, pp 135-00 135 Where we use Wi-Fi shield as a Wi-Fi receiver, MBU 6050 as IMU to compute orientation of the robot where it gives us three values (Yaw, Pitch and Roll) here we just benefit from Yaw since it deal with horizontal movement, L298n motor driver with two motors to control robot motion [16], Arduino Uno and one AP. Since the equation (1) will give us the distance without directions in term of(x,y), we can benefit from yaw value obtained from IMU which can give us the robot orientation. To make sure of our calculations, we can useal-Kashi equation as shown in equation (4) for corrections [17]. 𝑐𝑐2 = 𝑎𝑎2 + 𝑏𝑏2 − 2𝑎𝑎𝑏𝑏 cos 𝑦𝑦………………….. (4) Where x is the Yaw value, y is the complementary of Yaw value (180 - x), a is the distance between start point and AP, bis the distance between start point and robot,c is the distance between the robot and AP, as shown in fig (2). Figure 2: virtual triangle Butting all values in the equation (4) produce a second order equation with one unknown value (b), then the equation will become. 𝑏𝑏2 − (2𝑎𝑎𝑐𝑐𝑎𝑎𝑎𝑎𝑦𝑦)𝑏𝑏 + (𝑎𝑎2 − 𝑐𝑐2) = 0 ………… (5) To solve this quadratic equation, we cannot use the quadratic formula since it gives an imaginary results, so the best way to solve this problem is by use a simple loop program that varying b value until the equation equal to zero, as follow in figure (3) American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2018) Volume 47, No 1, pp 135-00 138 Now we need to generalize this formula to include the second and third position … etc of the robot, see figure (4) where it is an extension of figure (2). in the second position the Yaw value will be the difference between the last value and the current value of Yaw, while the angle between the rib c and the extended line from rib b equal to the summation of the Yaw value and robot angle, also the initial orientation of the robot should be known, in case of figure (2) equals 90˚, the relationship will become as follows. m = robot initial orientation + Yaw1 + robot last angle + (Yaw2 - Yaw1) m = robot initial orientation + Yaw2 + robot last angle……….. (6) where robot initial orientation: is the orientation at the start position robot last angle: the last angle that the robot deviates from the AP (equal z in figure 2) Since Yaw2 value in the position 2 equal the current Yaw value we can generalize the relationship as m = robot initial orientation + Yaw + robot last angle……….…. (7) where Yaw value is the Yaw current reading that taken from the MPU American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2018) Volume 47, No 1, pp 135-00 139 Figure 4: Robot new position angle calculation Now we can estimate the (x,y) values as shown in table (3) by using Pythagorean theorem depending on distance and angle (Ɵ) values where. X = distance * cosƟ ………..……….. (8) Y = distance * sin Ɵ ……….………… (9) 3.1 Programming section Now we need to program the arduino microcontroller (in this prototype we use two arduino pieces) the first one (arduino Uno) to control robot movement and to connect with Wi-Fi shield for reading RSSI value, the second one (arduino nano) to connect with MPU 6050 for reading Yaw value, figure (4) shows Wi-Fi localization block diagram. Hencewe can control robot movement by varying the BWM of the two DC motors, change the pin mode to HIGH or LOW to control wheel action forward or backward, and you can put delay time for reading RSSI value as you like. American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2018) Volume 47, No 1, pp 135-00 140 Figure 5: Wi-Fi localization block diagram 4. Experiments and results Now we will present some of experiments where we will move the robot in different paths (circle path, rectangle path, American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2018) Volume 47, No 1, pp 135-144 141 irregular path, corridor path) then we will compare between all of these paths, see figure (4). Figure 6: circle path Figure 7:rectangle path American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2018) Volume 47, No 1, pp 135-144 142 Figure 8: irregular path Figure 9: corridor path American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2018) Volume 47, No 1, pp 135-144 143 As shown above the green line is the true path while the blue is the calculated results after filtering. Table (1) will show the mean square error and max error of all paths. Table 1:comparison between all paths Error irregular path corridor path circle path rectangle path MSE for calculated values 22.21 CM 141.5 CM 54.8 CM 44.38 CM MSE for filtered values 15.55 CM 34.6 CM 31.88 CM 29.43 CM MAX Error in calculated path 44 CM 394 CM 92 CM 102 CM MAX Error in filtered path 33 CM 83 CM 57 CM 67.32 CM 5. Conclusion and future work In this paper we present a Wi-Fi technique that depend on one AP and to estimate robot localization, in compare with another Wi-Fi techniques like fingerprinting which depend on k number of APs or triangulation technique which depend on 3 APs, we try to introduce a technique with less infrastructure and more efficiency, the challenge was we were use a cheap component to design the robot, so we suffer from slipping and the effect of noise which lead to reduce resolution. For future, we think that using more efficient component will serve the result, like using more precise robot platform and AP with far range (may be use AC1900 Smart Dual-Band Gigabit Wi-Fi router instead of 300 Mbps wireless router that we used it currently). References [1] M. Ocana, L. M. Bergasa, M.A. Sotelo, J. Nuevo*, R. Flores.Indoor Robot Localization System Using Wi-Fi Signal Measure and Minimizing Calibration Effort.IEEE ISIE 2005, June 20-23, 2005. [2] Can Basaran, Jong-Wan Yoon, SangHyuk Son and Taejoon Park. Self-Configuring Indoor Localization Based on Low-Cost Ultrasonic Range Sensors. ISSN 1424-8220, 2014. [4] Sandeep K. Malu&JharnaMajumdar.Kinematics, Localization and Control of Differential Drive Mobile Robot. Global Journal of Researches in Engineering: H Robotics & Nano-Tech Volume 14 Issue 1 Version 1.0 Year 2014. [5] J. Krejsa, S. Vechet. Infrared Beacons based Localization of Mobile Robot. Electronicsand Electrical Engineering.ISSN 1392 – 1215 2012. No. 1(117) [6] Kevin R. Huggins. Computer Vision Localization Based On Pseudo-Satellites. Master thesis.Ohio State University. 2009. American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2018) Volume 47, No 1, pp 135-144 144 [8] AnisDrira. GPS Navigation for Outdoor and Indoor Environments.Master thesis.University of Tennessee, Knoxville. 2006. [9] Marshall R. Sweatt, COMMUNICATION AND LOCALIZATION OF AN AUTONOMOUS MOBILE ROBOT.Master thesis.Colorado School of Mines. 2015. [10] Alexandra-Ioana Alan" Analyzing the performance of a WiFi tracking System" master thesis, free university of Amsterdam, 2014. [13] Dan Li, Le Wang, ShiqiWu "Indoor Positioning System Using Wifi Fingerprint" Stanford University, 2013. [15] John Boxall. L298N Dual Motor Controller Module 2A and Arduino.Tronixlabs. 2014. [16] Victor Katz. al-Kashi’s Law of Cosines. Princeton University Press, 2007. [17] Caius Suliman1, Cristina Cruceru1, Florin Moldoveanu.Mobile Robot Position Estimation Using the Kalman Filter.Scientific Bulletin of the PetruMaior University of TirguMuresVol. 6 (XXIII), 2009 ISSN 1841-9267 [18] Mohammad K. Azarian, "A Study of Risala al-Watarwa’lJaib" Forum Geometricorum Volume 15 (2015) 229–242. [19] Maria Isabel Ribeiro, " Kalman and Extended Kalman Filters: Concept, Derivation and Properties" Institute for Systems and Robotics, Lisbon, Portugal, 2004.