WI { 1 I 1 140 541 THS firmafilfi 252 lJRDARY Mlorugan State University This is to certify that the thesis entitled MECHANISMS FOR COMBINING INFRARED AND ULTRASOUND SIGNALS FOR INDOOR WIRELESS LOCALIZATION presented by DAVID RURANGIRWA has been accepted towards fulfillment of the requirements for the MS. degree in ELECTRICAL AND COMPUTER ENGINEERING 95M. QM Major Professor’s Signature ti / 3 0/0; , - . Date MSU is an affirmative-action, equal-opportunity employer .I-O-I-n-c-o-l-o-‘-o-l-.-l-0-l-l-u-u-l-o-o-I-I-I-o-I-l-l-l-0—I-g-.-u—-—.—.-.-.—.. .. . PLACE IN RETURN BOX to remove this checkout from your record. To AVOID FINES return on or before date due. MAY BE RECALLED with earlier due date if requested. DATE DUE DATE DUE DATE DUE 6/07 p:IClRC/DateDue.indd-p.1 MECHANISMS FOR COMBINING INFRARED AND ULTRASOUND SIGNALS FOR INDOOR WIRELESS LOCALIZATION By David Rurangirwa A THESIS Submitted to Michigan State University In partial fulfillment of the requirements For the degree of MASTER OF SCIENCE Electrical and Computer Engineering 2007 ABSTRACT MECHANISMS FOR COMBINING INFRARED AND ULTRASOUND SIGNALS FOR INDOOR WIRELESS LOCALIZATION By David Rurangirwa This thesis presents a new mechanism for secure indoor localization through a combination of infrared and ultrasound Signals. While a number of existing systems use ultrasound and radio frequency (RF) based localization, the use of RF gives rise to a series Of operational difficulties including lack of localization privacy and collisions among the localization beacons. In this thesis, infrared is used to mitigate these limitations of RF. Collisions among the localization beacons, placed in different rooms, are avoided by leveraging the attenuation of infiared signals through walls and other indoor partition materials. Privacy is ensured by the complete isolation of the infiared Signal across different rooms and hallways. Also, the unlicensed usage of infrared can provide a significant Operational advantage compared to the RF based solutions. We implement a time dijfirence of arrival (T DOA) mechanism in which the localization beacons send simultaneous infrared and ultrasound pulses which are received at localization modules, which compute the distance to a beacon by measuring the TDOA between the IR and the US signals. Applications of such indoor localization systems include robot navigation, location-aware sensor network protocols, equipment localization, and various location-based wireless services. T 0 My Mother For All Her Love, Prayers, and Support iii Acknowledgements I am grateful to God for good health, without which I could not have accomplished much. I am also grateful to Fulbright for Sponsoring my education at Michigan State University. At the start of the second year of my master’s program, I asked Dr. Biswas to direct my master’s thesis research. I explained to him that I wanted to develop a network system. He then suggested to me the indoor location system based on infrared and ultrasound. Throughout this work, Dr. Biswas has been of great help, always finding time to brainstorm, troubleshoot, and make recommendations, without which, this work could not have been possible. I am especially thankful for his systematic approach to problem solving which enabled me to complete this project. I would like to Sincerely thank him for not only supporting me in my research, but also for his advice, motivation, and his willingness to let me decide which way I Should go. Fan Yu worked with me from the start of the project until the final day when the whole system was working. Thanks to him, I have acquired more skills of system debugging. I would like to sincerely thank him for his tireless efforts to see that this master’s work was complete. All along, he kept an easy outlook of things, which I am also very thankful for. I would also like to thank Jayanthi Rao for her help in debugging the system’s code. She was always eager to help and was happy when things seemed to fall into place. My fellow students in the NEEWS lab created an environment conducive to research and I would therefore like to thank them. Their questions and suggestions during the demo of this project were of great help. iv I would also like to thank the ECE Shop staff for their great help in acquisition Of system components and experimental apparatus. I made numerous visits to the shop and every time they were eager to help me. TABLE OF CONTENTS List of Tables ..................................................................................... .viii List of Figures ....................................................................................... ix CHAPTER 1:INTRODUCTION -- 1 1.1 BACKGROUND ...................................................................................................... 1 1.1.1 Indoor Location Systems ................................................................................. 2 1.1.2 Indoor Location System Application Example ................................................ 3 1.2 MOTIVATION ........................................................................................................ 4 1.3 CONTRIBUTIONS OF THE THESIS ........................................................................... 5 1.4 THESIS ORGANIZATION ........................................................................................ 5 CHAPTER 2:RELATED WORK- 6 2.1 THE MIT CRICKET ................................................................................................ 6 2.2 BROADBAND ULTRASONIC SYSTEM ..................................................................... 7 2.3 THE ACTIVE BADGE LOCATION SYSTEM .............................................................. 7 2.4 THE BAT ULTRASONIC LOCATION SYSTEM .......................................................... 8 2.5 IN-BUILDING RADAR .......................................................................................... 8 2.6 THE HIBALL TRACKING SYSTEM .......................................................................... 9 2.7 LOW COST INDOOR POSITIONING SYSTEM ............................................................ 9 2.8 THE HORUS WLAN LOCATION DETERMINATION SYSTEM ................................. 10 CHAPTER 3:CONCEPT 1 1 3.1 RANGING ............................................................................................................ 1 l 3.2 RANGING BASED ON TDOA OF IR AND US SIGNALS .......................................... 13 3.3 FACTORS AFFECTING DISTANCE COMPUTATION BASED ON TDOA OF IR AND US SIGNALS .............................................................................................................. I 5 3.4 NODE LOCALIZATION MECHANISMS .................................................................. 16 CHAPTER 4:SYSTEM ARCHITECTURE 17 4.1 HARDWARE CONFIGURATION ............................................................................. 18 4.1.1 Overview of System ........................................................................................ 19 4.1.2 1R transceivers ............................................................................................... 21 4.1.3 US transducers and Supporting Circuits ....................................................... 22 4.1.4 Microcontroller ............................................................................................. 24 4.1.5 System parameters ......................................................................................... 26 4.1.5.1 Beacon ................................................................................................... 26 4.1.5.2 Listener ................................................................................................. 27 4.2 SOFTWARE CONFIGURATION .............................................................................. 27 4.2.1 Beacon Program ............................................................................................ 28 4. 2.2 Listener Program ........................................................................................... 29 vi CHAPTER 5:SYSTEM CHARACTERIZATION 32 5.1 EXPERIMENTAL SETUP ....................................................................................... 32 5.2 PERFORMANCE RESULTS .................................................................................... 32 5. 2. 1 Eflect of distance and angle of rotation ......................................................... 33 5.2.2 Effect of ambient light on computed distance ................................................ 34 5.2.3 Eflect of temperature on system accuracy ..................................................... 35 5.2.4 Comparisons of errors at short distances between the Cricket and the 5.2.5 Comparisons of errors at long distances between the cricket and the IR US ............................................................................................................. 3 7 5.2.6 Error in computed distance observed at the oscilloscope ............................. 3 7 5.3 CHALLENGES ...................................................................................................... 39 CHAPTER 6:CONCLUSION S 47 CHAPTER 7 :FUTURE WORK 48 APPENDIX A: SYSTEM SCHEMATICS 49 Al BEACON ............................................................................................................. 49 A.2 LISTENER ............................................................................................................ 50 A.3 ULTRASOUND SECTION ...................................................................................... 51 A. 3. 1 Transmitter .................................................................................................... 51 A.3.2 Receiver ......................................................................................................... 52 APPENDIX B: SYSTEM ASSEMBLY PROGRAM 53 B.I BEACON .............................................................................................................. 53 B.2 LISTENER ............................................................................................................ 58 BIBLIOGRAPHY 75 vii LIST OF TABLES Table 1: Beacon parameters .............................................................................................. 26 Table 2: Listener parameters ............................................................................................. 27 viii LIST OF FIGURES Figure 1: Example of an indoor localization application .................................................... 3 Figure 2: Ultrasonic Ranging ............................................................................................ 12 Figure 3: Node coordinate assignment from coordinate axes ........................................... 16 Figure 4: Node coordinate assignment from inter-node distances .................................... 16 Figure 5: Modules of the IRUS Indoor Location System .................................................. 17 Figure 6: Components of the IRUS indoor location system .............................................. 18 Figure 7: Block diagram of listener .................................................................................. 20 Figure 8: Block diagram of beacon .................................................................................. 21 Figure 9: Infrared Section of the beacon ........................................................................... 23 Figure 10: System Initializations ....................................................................................... 29 Figure 11: Experimental Setup ......................................................................................... 33 Figure 12: Directivity of US transducers used in the system; directly taken fi'om the datasheet ........................................................................................................................... 34 Figure 13: Percentage error in computed distance with increase in distance and angle of rotation ............................................................................................................................... 35 Figure 14: Error in computed distance in different light conditions ................................. 36 Figure 15: Error with distance increase shown with and without temperature compensation ..................................................................................................................... 38 Figure 16: Error with computed distance at Short distances .............................................. 39 Figure 17: Error in computed distance at long distances ................................................... 40 Figure 18: TDOA determination at the scope ................................................................... 40 Figure 19: Error in computed distance observed at the oscilloscope ................................ 41 Figure 20: Beacon generated Signals ................................................................................. 43 ix Figure 21: Infrared signal structure ................................................................................... 43 Figure 22: loomed-in structure of the infrared signal ...................................................... 44 Figure 23: loomed-in structure of an infrared signal (2) .................................................. 44 Figure 24: Ultrasound Signal structure .............................................................................. 45 Figure 25: Zoomed-in structure of an US signal ............................................................... 45 Figure 26: Recursive Error caused by delay routines at the beacon .................................. 46 Chapter 1: Introduction This chapter gives the background and motivation for this thesis work. An effort is made to lay the foundation for consequent topics. It also describes the contributions that this thesis work has made. 1.1 Background Localization is a mechanism that is used to remotely find the location of objects, either indoors or outdoors. It has been a challenge for researchers to devise means of telling the exact location of men and their belongings. Up to date, there continues to be tremendous breakthroughs into this field. Currently, through the Global Positioning System (GPS), it is possible to locate a person within a few meters of accuracy. This technology has found many applications such as vehicle navigation and tracking of people and animals. The GPS and RADAR systems have been employed to solve user location and tracking in outdoor scenarios. However, it is becoming more and more evident that indoor location and tracking systems are needed for numerous applications. The conventional means of outdoor location cannot be employed for indoor purposes due to obstacles found inside buildings, which reflect and attenuate data signals [1]. It is therefore necessary that systems that are Specifically suited for indoor localization be developed. Some of the applications of indoor location systems are: 0 Localizing visually impaired navigators l 0 Navigation tools for humans and robots 0 Finding critical personnel or resources faster 0 Asset tracking 0 Location-aware sensor networking 0 Simplifying the user interface for mobile voice and data functions 0 Improving the security and effectiveness of Wi-Fi networks 0 Restricting online shopping to certain people in a certain room 0 Improvement of roaming capabilities. There have been many solutions suggested for indoor localization, some of which are: In-building RADAR [5], Active Bat Location system [10], Active Badge Location System [3], HiBall Head Tracking system [6], Ubisense Location system [11], Broadband Ultrasonic location system [2], MIT Cricket [1], Bristol Indoor Position system [7], and Nibble location system [9]. 1.1.1 Indoor Location Systems Indoor localization involves objects finding their position in reference to other objects in an indoor scenario. The reference Objects may be stationary or mobile. The Object seeking to know its position and the reference Object may be active or passive. In case they both have to be active, some synchronization and scheduling mechanisms are needed. In many cases, the Object seeking to know its position is passively listening to messages sent from the reference point. In this case, the synchronization step is eliminated, but scheduling has to be implemented, especially if there has to be multiple transmitters. 1.1.2 Indoor Location System Application Example Figure 1 shows a possible application of the IRUS indoor location system. The robot can be programmed to move within the boundaries demarcated by beacons 1 & 2. For instance, the beacons can be used to represent edges of a table or any elevated surface from which the robot Should not topple and fall. Simply put, the robot sees its boundaries. I I | IR‘I'X Beacon 1| Host Controller I I us 1x 3 I9——-Boundary RObOt IR RX | <1 I 03 RX I O O “mam,“ l> —————————JUSTX Figure 1: Example of an indoor localization application The indoor localization devices can be distinguished by the media used for data exchange and the algorithms used to achieve localization. The media that have been explored so far are Radio Frequency, Infrared, and Ultrasound. Some of the algorithms used are: Angle of Arrival (AOA) or Direction of Arrival (DOA) [12], Time of Arrival (TOA) [10], and Time Difference of Arrival (TDOA) [1]. The indoor localization solution presented in this thesis work is based on time difference of arrival (TDOA) of infrared and ultrasound signals. There are two modules in the system designed; a transmitter (beacon) and a receiver (listener). The beacon sends an infrared Signal followed by an ultrasound signal. The listener detects these signals and computes the difference in their times of arrival. This difference is then multiplied by the speed of sound to obtain the distance separating the two modules. Time difference Of arrival has been employed in the MIT Cricket system [1,2]. This system uses RF and US signals to achieve distance computation based on TDOA. We introduce the use of infiared because of its inability to penetrate walls, therefore reducing interferences to neighboring rooms. 1.2 Motivation Indoor environments have different characteristics. To design an indoor location system, this factor should be considered. We had this consideration in mind when designing the system in this thesis. We wanted to explore an alternative medimn of data transmission, other than RF. IR was opted for because of its inability to penetrate walls. This feature would ensure protection of user privacy and avoid interferences to neighboring rooms. 1.3 Contributions of the Thesis In this thesis, a new method Of indoor localization is presented. This method involves periodically sending an infi'ared signal followed by an ultrasound Signal. The receiver of these Signals (listener) records their times of arrival and based on the time difference of arrival (TDOA) [1] algorithm running on it, it calculates the distance separating it and the signal sender (beacon). We developed a prototype of the indoor location system using off-the shelf components. We then carried out experiments to characterize and evaluate the performance of the system under different indoor conditions including ambient lighting and temperature. 1.4 Thesis Organization This chapter of the thesis presented a background of indoor location systems. The next chapter is a survey of related work in this area of networking. Chapter three gives a detailed description of the concept behind indoor localization presented in this thesis. The fourth chapter presents a detailed description of the hardware as well as the software architecture of the indoor location system designed in this thesis. Chapter five presents the characterization procedures, followed by the results. It also outlines the challenges encountered and how they were overcome. The sixth chapter presents the conclusion of this work and the seventh chapter presents recommendations for future work. Chapter 2: Related Work This chapter describes some of the existing indoor location systems. Research on indoor location systems is a fast growing area and this chapter is in no way exhaustive as far as their coverage is concerned. However, an attempt is made to cover as much a wide area as possible, in this dynamic research area. 2.1 The MIT Cricket The MIT Cricket [1, 2] is an indoor location system based on time difference of arrival of radio frequency and ultrasound signals. It is composed of beacons and listeners. Beacons are strategically placed, either on ceilings or on walls. They periodically transmit RF Signals with id information. At the same time, an ultrasonic signal is transmitted. At the listener, the RF signal is received first and its time of arrival noted. The ultrasound Signal lags behind the RF signal, and this lag period is determined at the listener. It is then multiplied by the speed of sound to calculate the distance between the beacon and the listener. The Cricket system is distributed and scales well Since the listeners are passive. However, there is a likelihood of RF Signals leaking to neighboring rooms. The system suggested in this thesis is similar to the cricket system in terms of distance determination. However, instead of RF, we use infrared. The advantages that arise from this change were discussed in section 1.2. 2.2 Broadband Ultrasonic System This system, developed at the University of Cambridge, can be seen as a way to enhance the Cricket system by increasing the transmission rate in the Ultrasound channel. Unlike the Cricket system and the ranging system in this thesis work, the Broadband Ultrasonic system incorporates data into the ultrasonic signal. The Broadband Ultrasonic location System is polled and centralized [2]. When a system is termed as polled, it means that the transmission is coordinated. The centralization property means that a centralized system exists to collect and analyze data from the nodes. To determine the location of a node, times of flight of messages between transmitters and receivers are used to compute the distances between the transmitter and receiver by multiplying times Of flight by the speed of sound in air. The weakness of the Broadband Ultrasonic System can be seen as a lack of user privacy due to the use of a centralized system to collect and analyze data; and the huge amount of energy used to achieve the broadband data transmission. 2.3 The Active Badge Location System The Active Badge Location System [3] is based on badges that transmit signals with information about their location to a centralized system. A sensors network is put around a host building, and it picks up signals that are periodically transmitted. These badges are worn by people in an area, whose locations need to be determined. The signals transmitted are infrared signals. The drawback of the Active Badge is its user privacy compromise since it is based on a centralized system. 2.4 The Bat Ultrasonic Location System In order to improve the Active Badge system, the Bat Ultrasonic Location System [4] was developed. Unlike the Active Badge System, this location system is able to provide location and orientation information in 3D. To Obtain location information, times of flight of an ultrasonic signal between a transmitter (Bat) and the object to be located; are determined and these are multiplied by the speed of sound to calculate the distances from the Bat to each receiver. With three or more bat-receiver distances, enough information is available to determine the Bat’s 3D position. The orientation of an object can be calculated by determining the relative positions of two or more Bats that are attached to that object. The disadvantages of relying on ultrasound to transmit data still apply to the Bat Ultrasonic Location System. 2.5 In-Building RADAR This indoor location and tracking system is RF-based [5]. Information describing signal strength is theoretically computed and empirically-determined at multiple receiver 8 locations. This information is then used to triangulate the coordinates of the user. This system suffers from effects of radio channel interferences, which reduce its accuracy. 2.6 The HiBall Tracking System This electro-optical system was built for high precision head tracking for virtual reality applications [6]. It consists of panels of LED’s that are flashed sequentially, head- mounted cameras that determine the position of the flashing LED’S, and a computer system that uses the knowledge about the cameras’ coordinates to Obtain the location information. The drawback of this system is its expensive implementation. 2.7 Low Cost Indoor Positioning System This system, developed at the University of Bristol-UK, is based on radio frequency and ultrasonic Signals [7]. The RF signal is used to synchronize the transmitters and the receiver. Four ultrasonic transmitters are placed on the ceiling of the experimental room. The Signals sent are detected and their times of flight are recorded at the ultrasound receiver. The times of flight are factored with the Speed of sound to determine the distances between the transmitters and the receiver. Four times of flight are used to ensure that the system’s range is increased and that signals that were lost are compensated. The synchronization mechanism used in the low cost indoor positioning system increases the cost of the system. Since both the transmitter and receiver have to be active, this system fails to scale very well. 2.8 The Horus WLAN Location Determination System The Horus location system [8] is based on RF. Signal strengths of frames transmitted by the access points are used to provide user location. The system is currently implemented in the 802.11 wireless LANS context. Since it is based on the already existing wireless LANS, it is seen as a software solution built on top of the wireless infi‘astructure. Just like other WLAN technology location systems, Horus works in two phases. The first phase is referred to as oflline phase. In this phase, data representing signal strength is collected from points of access and tabulated into a radio-map. The second phase is called the location determination (online) phase. Here, the system searches the radio-map based on newly received signals from the access points to estimate the user location. The drawback of the Horus WLAN system is in the fact that there can be interferences from neighboring rooms or other RF based devices, which would result to incorrect samples in the oflline phase. 10 Chapter 3: Concept This chapter presents the concept behind the system designed in this thesis. It explains the principle behind ranging and distance computation based on time difference of arrival (TDOA) of infi'ared and ultrasound signals. 3.1 Ranging Indoor location systems have ranging as their core function. Ranging involves determining the distance separating one point from another. To achieve this, various techniques can be employed. Most organisms are cognizant of their surroundings through eyesight. Eyesight can judge distances and tell the organism how far it should fly, run, fall, and so on. Eyesight is in essence a ranging mechanism based on reflection of light off of objects to the retina of the eye. The brain then processes this information and the organism is able to interpret it and is therefore able to navigate its surroundings. Some indoor localization systems mimic the eyesight mechanism. They send a light signal e. g. infi'ared, which bounces off of an object. The reflection is then interpreted by a microprocessor of the receiving device. The information extracted can tell a robot, for instance, how far or near a boundary it should navigate. The bat is a blind, flying mammal and its ranging mechanism has inspired many commendable discoveries. It sends out ultrasonic Signals that are reflected Off of its surroundings and fall on its ears. Its brain then processes this information and it is able to 11 judge its surroundings at amazing precisions. This idea has been employed in ranging systems. For instance, ultrasound based ranging systems use echoes to calculate distances. A node seeking to know its position sends out an ultrasound signal which is reflected off a reference point. The transmitting node has to record the time that the signal was sent. When the signal reaches the reference point, it is reflected back to the transmitter, which records the time of arrival of the reflected signal. The difference in the departure and arrival times corresponds to the distance separating the transmitter and the reference point. This difference is then multiplied by the Speed of sound to obtain the distance separating the node and the reference point. Figure 2 represents ultrasonic ranging. Q. Signal Echo Transmitter G— Distance _____._, Reference Figure 2: Ultrasonic Ranging If there are two systems that have a synchronized clock, either of them can tell the distance from the other by noting the time of departure and arrival, and then multiplying the difference by the speed of the medium of propagation. The transmitter has to send the packet with time of departure information. The receiver will then extract this information and read its clock for the time of arrival. 12 The preceding two methods have their strong as well as weak points. The echo/reflection based ranging is simple and inexpensive but suffers from interferences. For instance, any object that can reflect the signal used can be confused for the reference point, thus leading to erroneous computations of distances. The second method that involves synchronization ensures that distances are computed only at the correct reference points, but it is costly and has a limitation as far as scaling is concerned. Suppose two signals moving at different speeds left a transmitter at the same time. They would reach a reference point at different times. The reference point would then take note of this difference in times of arrival and use them to calculate the distance from the transmitter. This method of ranging is based on a technique called “Time Difference of Arrival”-TDOA [1]. TDOA avoids the necessity to synchronize the system clocks, and can therefore be less costly than the synchronized system. It also scales well since the transmitter is active but the listener is passive. Section 3.2 gives a detailed description of this method of ranging. 3.2 Ranging based on TDOA of IR and US Signals The solution suggested in this thesis is based on ranging using the TDOA algorithm [1], based on infrared and ultrasound signals. The TDOA technique has been used in the MIT cricket [1, 2], where radio-frequency was used together with ultrasound. We propose the use of IR due to its following advantages: 13 0 Minimal interference to/from other rooms, since IR transmissions cannot penetrate walls. This feature also provides user privacy. 0 Unlicensed data transmission, allowing for flexibility of experimentation and prototyping o No requirement for an antenna which is a cost and Size issue in RF technologies In the system described in this thesis, ranging is achieved using TDOA of infrared and ultrasound Signals. The beacon periodically transmits an infrared signal followed by an ultrasound Signal. These signals are detected at the listener. The speed of light and that of sound are known. These values can then be used, together with the times of arrival, to determine the distance between the beacon and the listener. Let the Speed of IR be Vi, and that of sound be Vus. Since Vi, is greater than Vus, the ultrasound signal lags behind the infi'ared signal as they move from beacon to listener. The listener determines the time lag, ST, and can calculate the distance D, from: D D _1_ __1_(1)I11 Vus Vzr Under normal conditions, the speed of sound is approximately 344m/s, and that of light is 5T= 3x1 Osm/s. Since Vir>>Vus, Dz 5T. V“, (2) [1] l4 3.3 Factors Affecting Distance Computation based on TDOA of IR and US signals AS shown in equation 2, distance computation depends on the accurate determination of OT as well as the speed of sound. The accurate determination of ST in turn depends on the accuracy of the time recording algorithms running on the listener, as well as the distance computing algorithms. On the other hand, the speed of sound depends on environmental factors such as relative humidity, temperature, and atmospheric pressure. For example, At 25 0C and 101.325 kPa (atmospheric pressure at sea level), the speed of sound changes by only about 0.5% as relative humidity changes fi'om 0% to 100% [1]. At 25 OC & 50% relative humidity, the speed of sound changes by only about 0.6% as the atmospheric pressure changes from 101.325 kPa to 30 kPa (atmospheric pressure at the top of Mount Everest) [1]. Therefore, atmospheric pressure and relative humidity have limited effect on the speed of sound. In air, the speed of sound changes by 0.18% for every 1 0C change at 25°C [1]. This change is approximately equal to 60cm/S change in the speed Of sound for every 1 0C change in temperature. This property necessitates compensation. To monitor temperature change and adjust the Speed of sound appropriately, we used a temperature sensor. For experimental purposes only, the temperature sensor is only included in the listener circuitry. 15 3.4 Node Localization Mechanisms To find the exact location of Objects, we would need several nodes to communicate. For example, figure 3 shows node localization based on coordinate axes. The axes can represent walls, floor, or ceiling of a room. Figure 4 Shows localization based on inter- node distances. All the nodes can have information about distances to neighboring nodes. Distances from three nodes can give user location as well as orientation information. Y /\ O O O 6% 0x1 ,y‘l jun >X Figure 3: Node coordinate assignment fi'om coordinate axes Y /\ Vt >x Figure 4: Node coordinate assignment from inter-node distances l6 Chapter 4: System Architecture This chapter outlines the hardware as well as the software architectures of the IRUS wireless indoor location system. It also gives a detailed analysis and description of the system’s configuration and parameters. Figure 5 shows the modules of the IRUS indoor location system designed in this thesis and figure 6 is a depiction of its organization. The Beacon [1] which is the transmitting node can be located on the ceiling, elevated points in a room or on the wall while the listener [1], which is the receiving node is attached to a host PC or device that needs to be localized. ———I l Host PC 0E] LiStOIIOI' m RX IR TX Beacon <1 us RX [j us Dr Figure 5: Modules of the IRUS Indoor Location System Since the listener is passive, this system can scale very well and also ensures that user privacy is protected. Both infrared and ultrasound do not penetrate walls. Therefore, interferences to/ from neighboring rooms are avoided. 17 US (IRUS) l L 1 Hardware Software system system I I f l I l [ Listener ] [ Beacon ] [ Listener ] [ Beacon ] IR Receiver IR Transceiver TDOA & Signal connected as Range generation and TX computation transmission US Transducer US Transducer Output program (RX section) (TX section) Figure 6: Components of the IRUS indoor location system Location system based on IR and 4.1 Hardware Configuration This thesis work was hardware intensive. Therefore, a significant amount of time was spent on the hardware design. The system was assembled on a proto-board, using off-the Shelf components. 18 4.1.1 Overview of System Figures 7 and 8 Show block diagrams of the listener and beacon used in the indoor location system based on Infrared and Ultrasound signals. Each module consists of a microcontroller, ultrasound transducer and supporting circuits, and infrared devices. The beacon has the TFDU4300 IR transceiver configured as an IR transmitter, while the listener has the TSOP381 for IR signal reception. The infrared transceiver is connected to the microcontroller via an external UART. The external UART used is MAX3100. The microcontroller used is PIC16F874, and runs at 20 MHZ. For lower power consumption, a slower clock can be used. This microcontroller was picked due to its Simplicity and inexpensiveness. It is based on the RISC architecture and has only 35 single word instructions. The Ultrasound transducer used is similar to the one used in the MIT Cricket [1, 2]. Modifications were made to the supporting circuitry to suit our application. See schematic in appendix A. To communicate with the host PC, the listener runs the R8232 protocol, taken care of by the R8232 chip. The listener sends data to the host at a baud rate of 9600bps. Only the listener has a temperature sensor. This option was taken so as to simplify the design of the experimental system. The temperature sensor will be incorporated in the beacon architecture once the beacon has been programmed to send an IR message. The temperature sensor used is LM34DZ, which is a precision Fahrenheit temperature sensor. Its output voltage is linearly proportional to the temperature in Fahrenheit. This temperature sensor was configured as a basic Fahrenheit temperature sensor and 19 calibrated to measure temperatures in indoor scenarios as low as 50°F and as high as 89°F. Microcontroller (PIC16F874) IR Receiver RS232 Connector Vcc o—/ Amplitude I + > a Detector 5V " US Receiver ‘2‘ Temperature Sensor Figure 7: Block diagram of listener [1] For experimental purposes, only two modules, one beacon and one listener, were built. Therefore, since there was no risk of sending a signal fi'om the wrong beacon, the listener was not programmed to process the message sent by the beacon. Every signal from the beacon is Simply taken as a pulse that triggers an interrupt at the listener. 20 mil: IR Transceiver (TFDU4300) PD Microcontroller (PIC16F874) Vcc o—-/-— Voltage multiplier Ultrasonic driver US transmitter Figure 8: Block diagram of beacon [1] 4.1.2 IR transceivers The TFDU4300 Infrared transceiver was used as an IR transmitter at the beacon. Figure 9 shows the beacon’s infrared hardware section. The microcontroller generates signals to configure the external UART to transmit infiared data according to IrDA standard at a data rate of 9600 bps. The external UART (MAX3100) receives data fiom the Serial Peripheral Interface (SPI), formats it to IrDA, and sends it to the Infrared transceiver, which in turn transmits the infrared signal to the infrared receiver on the listener side. MAX3100 was designed to directly drive optocouplers, whereas IrDA modules have inverting buffers. This feature calls for inversion of the TX and RX signals. A NAND gate was used for this purpose. TFDU4300 is compliant to the IrDA standard and can also be configured to transmit data in the remote control mode. The transmitter has an output radiant intensity 21 equal tO 65 mW/sr and a peak emission wavelength Of 880-900 nm. Its spectral bandwidth is 45 nm. It has an optical rise and fall time of 10-100 ns. For an input pulse width of 1.63 us, the optical output pulse duration is 16-1 .8 us. For an input pulse width greater than or equal to 20 us, the optical output pulse duration is 20-300 us. In all these cases, a data rate of 115.2 kbps is assumed [33]. For short distance transmissions, TFDU4300 can also be used as a receiver. In SIR mode the receiver has a minimum detection threshold irradiance of 40-80 mW/m2. Its maximum detection threshold irradiance is 5 kW/mz. The rise and fall times of the output signal are 10-100 ns. The Rxd pulse width of the output signal for an input pulse length greater than 1.2 us is 1.65-3.0 us. Its stochastic jitter at the leading edge is 250 m at a data rate less than or equal to 115.2 kbps [33]. For long distance transmissions, TSOP341 IR receiver module was used. Its typical transmission distance is 45 m. Its minimum irradiance is 0.1-0.25 mW/mz, while its maximum irradiance is 30 W/mz. Its directivity is :450 [32]. 4. 1.3 US transducers and Supporting Circuits At the beacon, the microcontroller produces a periodic wave, at 40 KHz through its pulse width modulation mode (PWM). This signal iS then amplified so as to drive the ultrasound transducer. The ultrasound transducer used is the 255-400 series where the transmitter is 255-4OOST12 and the receiver is 255-4OOSR12. It has a center frequency of 40 KHZ 11.0 KHZ. The sensitivity of the receiver at the center frequency is -67dB. The minimum driving voltage is 1V, while the maximum is 20V. The sensitivity of the 22 receiver at the center frequency is -67dB. The minimum driving voltage is 1V, while the maximum is 20V. The transducer’s bandwidth is 2 kHz. [30]. Typically, the ultrasound signal that triggers an interrupt at the listener is approximately 5V. The amplification of the ultrasound signal to this level is done at the listener. The amplifier circuit has a potentiometer that can be varied manually to adjust the sensitivity level of the circuit to the incoming ultrasound signal. This potentiometer can be adjusted for short distance range computations. See schematic in appendix A. Plc1 6F874 R132 35 RBI 3‘ RED/INT 33 vss 31 RD7/PSP? 1 RD6/PSP6 29 RDS/PSPS 2" RD4/PSP4 27 RC7/RX/Drr 2“ RC6fI'X/CK 25 RCS/SDO 2‘ RC4/SDL’SDA 23 H MAX31 00 c1=c2=22 pF V00 D—RXD F533 51': TXD IREDC TFDU4300 I: 1.8432Mhz: c1 Figure 9: Infrared Section of the beacon 23 4. 1.4 Microcontroller PIC16F874, the microcontroller used in the design Of the IRUS location system, is an 8-bit microcontroller. It has up to 8K x 14 words of FLASH Program Memory, up to 368 x 8 bytes of Data Memory (RAM), and up to 256 x 8 bytes of EEPROM Data Memory. It is able to handle up to 14 sources of interrupts. Its hardware stack is 8 levels deep. It supports direct, indirect and relative addressing modes. It features a power saving SLEEP mode. Its operating voltage range is 2.0 V-5.5 V. Power consumption can be as low as <0.6mA, operating at 3 V and 4 MHZ. Operating at 3 V and 32 kHz, a 20 [IA low power consumption is feasible. The typical standby current is <1 uA. [34, 35] The peripheral features of PIC16F 874 were exploited to achieve the system functionalities of the indoor location system described in this thesis. On the beacon side, timer2, an 8-bit timer with an 8-bit period register, prescaler and postscaler; was used to control the PWM module. The resolution of PWM can be as high as 10-bits. The PWM mode enables the generation of pulses of various periods and duty cycles. The Synchronous Serial Port (SSP) with Serial Peripheral Interface (SPI) was used in the master mode to generate serial data that was converted to IrDA by an external UART, MAX3100, thus making transmission of infrared Signals possible. On the listener side, timerl, a 16-bit timer/counter with a prescaler, was used together with an external crystal; to keep time of the system. This timer is the one that enables recording of the times of arrival of signals to be done. Reading timerl takes place 24 in two steps: reading the high byte and reading the low byte. In order for the time information to be correct, reading must take place before or after rollovers. Readings between rollovers lead to erroneous computations. At 20 MHZ, a 16-bit counter will roll over every 13ms. This property calls for the implementation of a rollover counter that Should also be read every time timerl is read. A 32.768 kHz crystal oscillator was used to control the timerl as a timer in asynchronous mode. In this configuration, the microcontroller can actually keep real time and the need of a rollover counter is avoided. However, since the timer is read in two stages, it is still possible to read a value between rollovers of the lower byte of the timer. This error is checked in software. Section 3.2.2 gives a detailed description of how this is achieved. The microcontroller also features an analog-to-digital converter (ADC) which is lO-bit and is multi-channel. This feature is the one that was employed for temperature sensing. The output of the temperature sensor is connected to one of the ADC input pins and the voltage value present on the ADC pin is converted to a digital value, which is then used to represent the ambient temperature in the lookup table implemented in software. The Universal Synchronous Asynchronous Receiver Transmitter (U SART) was used to send data to the host PC. It was configured as an asynchronous, high speed transmitter, transmitting data at a baud rate of 9600 bps. PIC16F 874 supports In-Circuit Serial Programming (ICSP). This mode of programming was used to download programs into the microcontroller. The programmer used was the MPLAB In-Circuit Debugger (ICD 2). 25 4. I. 5 System parameters This section outlines the parameter values of the various components of the IRUS wireless indoor location system. 4.1.5.1 Beacon Table 1 shows the parameters of the transmitting module (beacon). Here, beacon frequency refers to how often the beacon transmits signals to the listener and it is shown to be 1 second. The maximum clock speed was used in the prototype, but a lower Speed can be used for the clock and this can result to lower power consumption. The IrDA baud rate used is the rate that showed best compliance with the external UART (MAX3100). The ultrasound pulse duration used was obtained through experimentation and it gave the best performance for most distance values. Parameter Value Description Beacon Frequency 1 Hz Beacon sends signals every second Microcontroller clock Speed 20 MHZ Maximum clock speed, resulting to 200nS instruction cycle IrDA baud rate 9600 bps Standard IrDA data rate IR wavelength 880-900ns Typical IrDA wavelength US frequency 40 KHZ Optimum response frequency of the transducer used US Pulse duration 1500 us Optimum duration for proper US Signal detection at the listener Table l: Beacon parameters 26 4.1.5.2 Listener The listener parameters are shown in table 2. The clock speed and the US transducer frequency are similar to those of the beacon. The listener features a precision temperature sensor that is able to measure temperatures to _+_1_°F. Temperatures likely to be measured in an average indoor location were considered when calibrating the temperature sensing mechanism of the listener. This feature can be readily modified to cover the full range of temperatures. Parameter Value Description Microcontroller clock Speed 20 MHZ Maximum clock Speed, resulting to 200ns instruction cycle US frequency 40 kHz Optimum response frequency of the transducer used US RX gain 70-78 db Detection of the US Signal at approx. 8 m when the modules are directly opposite each other [1]. Temperature sensor range 50—89 0F Range of temperatures that are likely to be found in indoor environments R8232 data rate 9600 bps Standard data rate Table 2: Listener parameters 4.2 Software Configuration The programs that run on the beacon and listener were written in assembly language, and tested using the MPLAB IDE. Codes were written, and compiled using the MPASM feature of the MPLAB IDE. Simulation followed using the MPLAB simulator. For supported functions, external stimuli were introduced to simulate system 27 performance. However, some features Of the microcontroller cannot be simulated. For instance, currently, the real-time clock mechanism, serial-peripheral interface, cannot be simulated, thus the code for those functions had to be tested on the physical system. After the necessary simulations and debugging, the resulting hex files were downloaded into the microcontrollers. Figure 10 represents a summary of the initializations done in software for both the beacon and listener. Sections 4.2.1 and 4.2.2 give a more detailed description of what goes on inside the microcontrollers of the beacon and the listener. 4. 2. I Beacon Program The beacon runs a program that periodically sends an infrared signal followed by an ultrasound signal. The initialization part of the code involves configuring the microcontroller to send serial data via the Serial Peripheral Interface port to the external UART. The microcontroller also generates the configuration word for the external UART. The external UART converts the serial data to IrDA data, which is then passed on to the IR transmitter. Initialization also involves enabling the pulse width modulation mode and produces a wave of approximately 40 kHz for 1500 us, which is the Ultrasound signal. To control the duration of the ultrasound signal, the duty cycle is defined as 50% for 1500 us and then it is defined as 0% for the duration within which the infrared signal is generated. 28 The repetitive loop of the beacon program involves calling for the serial data signal to be transmitted as infrared, followed by the ultrasound signal. This sequence is repeated every second. The initialization routine takes approximately 17.6 ps. The infiared signal generation routine takes 9.4 ps, after which the ultrasound Signal is generated. This delay is very negligible and it is therefore assumed that the signals leave the beacon at the same time. Beacon Listener Enabling of R8232 interrupts Protocol Figure 10: System Initializations 4. 2.2 Listener Program The listener runs a program that detects the signals transmitted {Tom the beacon; records their times of arrival and determines the range based on the ranging protocol. The initialization part of the code configures the timerl for asynchronous, real time keeping. 29 It also enables the necessary interrupts and it is here that error correction mechanisms are implemented. The initialization part of the code forms the repetitive loop Of the listener program. When a signal is detected, an interrupt is generated and the execution of the program now goes to the Interrupt Service Routine (ISR), to service the interrupt generated. The infrared signal is detected at the interrupt-on-change pin. As soon as a valid rising edge appears on this pin, the point of execution in the repetitive loop is recorded and the working and status register values are saved. The interrupt service routine is then invoked. Here, timerl values are read and recorded as the times of arrival of the infrared signal. A mechanism exists to check that if the low byte of timerl is read between its rollovers, timerl is read again to ensure a correct time value. When timerl has been read, the microcontroller sets a bit that will be used to check for erroneous computations. This bit is referred to as free and it is in the error_check file register. It then lights a diagnostic LED to Show that the arrival of infrared has successfully been reported. The working and Status register values are then restored and the program counter resumes at the point where the interrupt occurred. The ultrasound signal is detected at the external interrupt pin of the microcontroller. As soon as there is a valid rising edge at the external interrupt pin, the working and status register values are saved and the program counter jumps to the start point of the interrupt service routine. Timer] values are read, checked for rollover of TMRI L, and recorded as times of arrival of the ultrasound signal. 30 The ultrasound Signal used is 1500 us long, while the infrared signal is 750 us long. This means that there can be multiple ultrasound interrupts just before another infi'ared of another valid sequence of signals is noted. This is where the flee bit that was set after reading the time Of arrival of the infrared Signal comes in handy. After the timerl values are read at the arrival of the ultrasound signal, the flee bit is checked. If it is found set, the program goes ahead with distance computations. Distance computations involve finding the time difference of arrival (TDOA) and multiplying it by the speed of sound. It also involves reading the value of the temperature sensor and carrying out the necessary compensations. After the distance values have been sent to the host PC, an ultrasound diagnostic LED iS lit. Then, the normal procedure to exit the interrupt service routine is executed. If the flee bit is found clear, the distance computation routine is skipped. The ultrasound diagnostic LED is lit and the interrupt service routine is exited. The checking Of the flee bit ensures that no erroneous distance computations are returned. Just by looking at the diagnostic LED’S, we cannot tell whether a valid sequence of IR and US signals has been detected. However, the error checking mechanism ensures that only those ultrasound Signals that come after infrared Signals contribute to distance computations. In other words, distances are computed when and only when an infrared signal followed by an ultrasound signal event is detected at the listener. Appendix B Shows the source code of the programs used in the beacon and listener. 31 Chapter 5: System Characterization This chapter describes the experimental setup and gives results of the experimental system characterization as well as the analysis of the performance results. It also describes the challenges encountered and suggests possible solutions to these challenges. 5.1 Experimental Setup For characterization, two modules were used. The beacon and listener were placed as shown in figure 11. The angle 0 was varied and then distance was computed. The distances computed were recorded at the listener over a period of two minutes. With the beacon sending signals every second, this amounts to a total of 120 samples of distances, from which errors were computed. This amount of samples is a best case scenario where all signals sent contribute to distance computation. However, as will be seen in the challenges section, it is not all signals from the beacon that contribute to distance computations. The measured distances were then used to obtain the percentage CITOI‘S. 5.2 Performance Results This section shows graphs that were Obtained from the various system performances. The graphs show percentage errors resulting from the measured distances under different conditions. 32 \ d\e / Listener Beacon Figure 11: Experimental Setup [1] 5. 2.1 Effect of distance and angle of rotation Figure 13 shows the percentage error in computed distance with increase in distance and change in the angle of rotation. The graph Shows that error in distance computation is minimized when the beacon and listener are directly Opposite each other (angle of rotation=0 degrees). As the angle of rotation increases, the ultrasound signal strength at the listener decreases, and it takes the listener a long time to detect it, thus contributing to the error increase. This property can be attributed to the nature of ultrasound transducers used in the system. As can be seen in figure in figure 15, the ultrasound Signal transmitted can only be detected at a limited range of angles of rotation. AS the nodes move away from each other, the ultrasound Signal is attenuated, and it takes the listener a long time to detect it, thus contributing to the error increase in computed distances [1]. 33 Figure 12: Directivity of US transducers used in the system; directly taken fiom the datasheet [30] 5. 2.2 Effect of ambient light on computed distance The beacon and listener were placed directly Opposite each other (0 degrees) and the distance separating them was varied. Three such experiments were performed under different ambient light conditions: a lit lab during the day, a dark lab, and outdoor. The graph shown in figure 14 below was then plotted from the results. Outdoors, the system performed poorly and the results of the experiments were not consistent. This poor performance can be attributed to more interference in outdoor environments such as other sources of ultrasound. When we compare the errors observed in the lit and dark labs, we can conclude that ambient light has negligible effect on system performance. The infiared transceivers used are properly Shielded from other light 34 source interferences, hence the consistent performance in different ambient light conditions. 14 +50cm +100cm +200cm +gggem 12 . +400cm + cm .0. ‘\ E 8 ‘ m =3 6 . 4 _ ‘\‘\I’,’ 2 - v e e e e H e e e e v o I I I I I I T I I T T T -90 -75 -60 -45 -30 -15 0 15 30 45 60 75 90 Angle of rotation Figure 13: Percentage error in computed distance with increase in distance and angle of rotation 5. 2.3 Effect of temperature on system accuracy The speed of sound changes by approximately 60cm/s for every one degree Celsius increment in ambient temperature [29]. This property can introduce errors in distance computations. For this reason, a temperature sensor was incorporated in the system to help the system adjust the Speed of sound according to the ambient temperature. 35 TO show the effect that temperature change can have on the system accuracy, distances were computed at various temperatures, first without the temperature sensor (with a fixed speed of sound=344m/s), and then with the temperature sensor. The graph shown in figure 15 was then plotted. The graph shows that compensations with temperature change help to reduce errors in computed distance, by an average of approximately 7cm. 3.5 + Lit Lab + Dark Lab 3.0 — 1.0 - 0.5 - 50 100 200 300 400 500 Distance In cm Figure 14: Error in computed distance in different light conditions 5. 2.4 Comparisons of errors at short distances between the Cricket and the IR US The IRUS indoor location system can be adjusted for short distance computations by adjusting the ultrasound Signal strength at the beacon and listener. After this adjustment 36 was made, the IRUS accuracy with measured short distances was compared with that of the Cricket system. This comparison is shown in figure 16. The graph shows that for most Short distances measured, the IRUS system has a percentage error less than 10. 5. 2. 5 Comparisons of errors at long distances between the cricket and the IR US The IRUS system was adjusted for long distance computation and the resulting errors were compared to those claimed by the cricket team. The resulting graph (figure 17) shows an error difference of about 1.2% between the two systems. The ultrasound signal is greatly attenuated beyond 8m and therefore no distances were computed beyond this value. From the two preceding graphs (figures 16 & 17), we conclude that the IRUS system performs within the expected ranges of an indoor location system such as the MIT Cricket. 5. 2. 6 Error in computed distance observed at the oscilloscope With the beacon and listener directly opposite each other, signals sent were observed at the oscilloscope, as shown in figure 18. The time difference of arrival was obtained and multiplied by 344 (speed of sound at room temperature). 37 The resulting errors in computations of various distances were then plotted against the measured distances, as shown in figure 19. The graph Shows that at long distances, there was an error increase. The distance computations were affected by the scope’s resolution, hence the Observed increase in error in computed distances. Also, by looking at the signals arriving at the listener, it is impossible to tell exactly what edge causes an interrupt, hence the possibility of errors. The results from this experiment also demonstrate that the routine running on the listener can be trusted. 4.0 + wlsensor 3.5 . +wlo sensor 0.0 r . . 200 400 600 800 Distance In cm Figure 15: Error with distance increase Shown with and Without temperature compensation 38 7.0 + Cricket 6.0 - + IRUS 5.0 ~ 4.0 ~ % error 3.0 - 2.0 . 1.0 r 50 100 150 200 Distance in cm Figure 16: Error with computed distance at short distances 5.3 Challenges Figure 20 is a representation of both Signals as they leave the beacon. The figure shows a delay before the production of the ultrasound signal. This delay is negligible and therefore it is assumed that the signals leave the beacon at the same time. Figure 21 shows the structure of the infiared signal that is sent from the beacon. The signal is a narrow beam, which is IrDA compliant. Figure 22 and 23show a zoomed in structure of the infrared Signal. 39 2.5 2.0 ‘ °/o Error ."' OI d O 1 0.5 « + IRUS +Cricm//\. 0.0 200 I 400 Distance In cm 600 800 Figure 17: Error in computed distance at long distances Infrared pulse obthdnhéaoamtoam< muasomd pulse ‘OANQJ‘AUI< L Figure 18: TDOA determination at the scope 4O 6.0 + Scope observed 5'0 _ error 4.0 ~ 3.0 ~ % Error 2.0 . 1.0 ~ 0.0 I I I 7 r I I I 10 30 50 70 90 200 300 400 500 Distance In cm Figure 19: Error in computed distance observed at the oscilloscope The arrival of an inflated signal is detected when there is a rising edge at the interrupt on-change pin of the microcontroller. Since there is a possibility that two arrival events of infrared happen consecutively, before the arrival of an ultrasound signal, it is likely to have two values for the same distance estimate. However, such occurrences are very rare and would be very likely in cases involving long distances where ultrasound signals delay. In case they happen, the difference in the values computed is not significant since the infrared signal is very narrow. 41 Figure 24 shows a sequence of US signals as they leave the beacon. Figure 25 is a zoomed in representation of the US Signal. Note that the pulse length is approximately 1500 us. It is slightly greater than 1500 due to errors introduced by delay routines and clock precision. The arrival of an ultrasound signal at the listener is detected when there is a valid rising edge at the external interrupt pin of the microcontroller. TO calculate the distance between the beacon and the listener, the listener has to detect both the infrared and ultrasound signals within an allowable time frame. False distance computations due to multiple arrivals of US Signals before IR signals arrive are avoided in the algorithm running on the listener. Here, it is ensured that no distance computation is done before the IR arrival event followed by the US arrival event happen. Signals at the beacon are generated through delay routines. Delay routines in themselves have errors, which can be reflected in the values of distances computed. For instance, figure 24 shows a recurring error caused by software delay routines at the beacon. This error can be corrected by filtering out values corresponding to this TDOA. AS was described in the software architecture, the listener runs a repetitive loop until a Si gnal arrives, after which an interrupt is generated. There are several interrupts competing for system resources and this feature can lead to erroneous distance computations. 42 IR signal US signal w \ 4 3 2 1 0 a -1 -2 -3 4 . 5 O 5 10 15 20 ED Figure 20: Beacon generated signals V 5 4 i 3 2 1 ~ w - o -1 -2 .3 I 2 3 4 5 6 7 8 9 13 Figure 21: Infrared signal structure 43 8 I éagbbgoANwrsm< Figure 22: Zoomed-in structure of the infi'ared signal 4 6 8 10 12 14 16 18 B¢1L¢g,;.o-smwr>m< Figure 23: Zoomed-in structure of an infrared signal (2) odtkdorblsoamwrsm< U) Figure 24: Ultrasound signal structure ombamhmamwhm< 25: loomed-in structure of an US signal 45 l A Outlier TDOA value Figure 26: Recursive Error caused by delay routines at the beacon 46 Chapter 6: Conclusions In this thesis, the design, implementation, and characterization of a new indoor location system has been presented. It has been shown that the time difference of arrival (TDOA) algorithm, developed by the MIT Cricket team; can be applied to a new combination of Si gnals: Infrared and Ultrasound. This new combination ensures that interferences between nodes in neighboring rooms is avoided Since both ultrasound and infrared signals do not penetrate walls. A novel system of indoor localization has been designed. This system is based on range computation using the time difference of arrival of infrared Si gnals and ultrasound signals. The system architecture has been presented, followed by its characterization in different ambient conditions and experimental results. It has been Shown that a location system based on TDOA of infi'ared and ultrasound signals can be implemented in readily available off-the—shelf components. Possible advantages Of such a system have been explored and presented. The system developed and presented in this thesis can be modified to compute Short distances e.g. from 5-200 cm. At the same time, it can operate at longer distances: from 2-8 m. Characterization results have shown that the system’s performance at short as well as long distances is commendable. 47 Chapter 7: Future Work The system presented in this thesis work is intended for experimentation. In future, multiple units will be assembled and other aspects of localization will be investigated. For instance, by building two more beacons, we will enable the listener to infer its position fiom the messages sent by the three beacons. This feature will call for the inclusion of a message send and receive mechanism. The listener Should therefore be able to tell which beacon sent what message. The use of multiple modules will call for miniaturization. The components used in the system architecture are available in surface mount technology, and therefore the system can be miniaturized and industrially produced. For commercialization, both functions of beacon and listener will be combined in one module and the option of configuring the module as either beacon or listener will be left to the user. Once the characterization of multiple modules has been done, applications will be developed based on the system. Some of the applications that can be experimented with are asset tracking and robot navigation. 48 Appendix A: System Schematics 5V RB7 & RB6 are reserved for 5V programming and ICSP A.1 Beacon —_ gliffefema for low voltage programming U fir—.2 uF 1 ‘M—CLR/VPP RB7/PCB 4° _ 2 RAO/ANO RB6/PGC 3’ 3 RAl/ANl RBS 3' 4 RAZ/ANZ/VREF— RB4 37 s RA3/AN3/VREF+ RIB/perv] 3‘ a RA4/TOCKI RB2 35 7 RAS/AN4788 " RBI 3‘ s REOIRD/ANS h RBOIINT ’3 9 RBI/Emma a VDD 3’ d 10 REzES/Am O vss 3' '— 11 VDD " RD7/PSPT 3" 12 vss 2 RD6/PSP6 2’ 13 OSCl/CLKIN D RDSIPSPS 2” 14 OSC2/CLKOUT RD4/Psp4 27 15 RC0/I‘lOSO/T1CKRC7/Rx/DT 2‘ >>IR_OUT 16 RC1/TlOSI/CCP2 Rme/cx 25 17 RC2/CCP1 RCS/SDO 2“ rs RC3/SCK/SCL Rc4/SDI/SDA 23 19 RDO/PSPO RD3/PSP3 ’2 20 RDl/PSPI RD2/PSP2 2‘ 49 A.2 Listener 5V rave Temp. Sensor 100K 5V low-[z “l"l"|"l"|"l"|"l°l°°l“|“l“l‘l”i"l“1 "II-n o-I U WIT/VP? RB7/POD RAD/AND ngc RAl/ANI RB, WAN WRET- R34 RABIANB/VRD'+ MGM RAuTocm Rm RM/ANZISS RE“ I REU/TlD/ANS h Rail/INT REI/‘WR/Auts E VDD RDTCS/AN’I . vss V0” 5 RD7IPSP7- VSS . RDIS/PSPfi oscrlcmrnvl ”5,1,5” oscz/CLKoUT mums“ RCWTIOSO/qulc-"Rx/DT RCl/Tl OSI/CCPfiWCK RC2/C CPI RCSISDO RC3’5‘:K/SCLRC4/snr/smr 3904’s“) RDSIPSPS RDWSPI RD2/PSPZ 1H:— ”_ =:e.z_ut_u< ; processor specific variable definitions #include errorlevel -302 ;suppress "not in bank 0" message _CONFIG _CP_OFF & _WDT_ON & _BODEN_ON & _PWRTE_ON & _RC_OSC & _WRT_ENABLE_ON & _LVP_ON & _CPD_OFF ; ' CONFIG' directive is used to embed configuration data within .asm file. ; The lables following the directive are located in the respective .inc file. ; See respective data sheet for additional information on configuration word. 3 ;***** Constants SPBRG_VAL EQU .129 ;set baud rate 9600 for 20Mhz clock SIG_FIG equ 8 ;set SIG_FIG equal to the number of significant figures in your decimal number ;for example: ones, tenths,hundredths,thousandths, requires 4 si g figs last_digit set ones flag equ 10 TEMP_ad equ l 1 adover equ 0 adif equ 1 adgo equ 2 adie equ 6 gie equ 7 rpO equ 5 fi'ee equ 3 , 59 ;Variables CBLOCK 0x70 WREG_TEMP STATUS_TEMP PCLATH_TEMP FSR_TEMP temperature error_check ROC d1 d2 d3 ENDC CBLOCK ACCbROC ACCbHI ACCbLO ACCcHI ACCcLO EXPb ACCdHI ACCdLO ACCeHI ACCeLO ENDC 0x50 CBLOCK TMFROC_IR TMPROC_US TMPH_IR TMPL__IR TMPH_US TMPL_US ACCaROC ACCaHI ACCaLO ROCH_IR ROCH_US ROCL_IR ROCL_US 0x40 ;storage for WREG during interrupt ;storage for STATUS during interrupt ;storage for PCLATH during interrupt ;storage for FSR during interrupt ;storage for ambient temperature ;storage for rollover count ;Vus, MSB and part of d ;Vus, LSB and part of (1 ;part of d ;part of ;Vus, EXP and exp of (1 ;IR arrival time, MSB ;IR arrival time, LSB ;US anival time, MSB ;US arrival time, LSB ;TDOA,MSB ;TDOA, MSB ;TDOA, LSB 60 vusl ;low byte Of vus ENDC CBLOCK 0x60 trnillions millions hundredthousands tenthousands thousands hundreds tens ones temp digit_count ;counter used to cycle through each digit ENDC ;Macros to select the register bank ; Many bank changes can be Optimized when only one STATUS bit changes BankO MACRO ;macro to select data RAM bank 0 bcf STATUS,RPO bcf STATUS,RP1 ENDM Bankl MACRO ;macro to select data RAM bank 1 bsf STATUS,RPO bcf STATUS,RP1 ENDM Bank2 MACRO ;macro to select data RAM bank 2 bcf STATUS,RPO bsf STATUS,RP1 ENDM Bank3 MACRO ;macro to select data RAM bank 3 bsf STATUS,RPO bsf STATUS,RP1 ENDM 61 ORG 0x000 clrf PCLATH goto main ; processor reset vector ; ensure page bits are cleared ; go to beginning of program 9 ; isr code can go here or be located as a call subroutine elsewhere ISR ORG 0x004 ;place code at interrupt vector movwf WREG_TEMP ;save WREG movf STATUS,W ;store STATUS in WREG clrf STATUS ;select file register bankO movwf STATUS_TEMP ;save STATUS value movf PCLATH,W ;store PCLATH in WREG movwf PCLATH_TEMP ;save PCLATH value clrf PCLATH ;select program memory pageO movf FSR,W ;store FSR in WREG movwf F SR_TEMP ;save FSR value INTR_POLL BankO btfsc PIRl , TMRl IF ;No timerl overflow interrupt? goto T1_OVRFL BTFSC INTCON,INTF ; No External interrupt? goto U8_INT ;Service interrupt BTFSC INTCON,RBIF;NO interrupt on change? goto IR_INT IR_INT BankO MOVF PORTB,1 call RDTMR1_IR IR_rdend bsf error_check,free ;set bit to avoid erraneous distance computations Bankl bcf TRISD,6;light LED BankO BCF INTCON,RBIF goto EXIT_INT 62 U8_INT BankO call U8_rdend btfsc signal was received call RDTMRI_US error_check,free ;check the free bit to determine if IR TDOA ;if so, then calculate distance based on TDOA, otherwise light LED and exit ISR comp_done Bank] bcf BankO BCF goto T1_OVRFL BankO BCF Bank] bcf goto TRISD,7;light LED INTCON,INTF;clear flag EXIT _INT PIRl, TMRlIF ; Clear Timer] Interrupt Flag TRISD,5 EXIT_INT ;Time recordings of IR and US signals RDTMRI_IR Bank0 CLRF MOVF MOVWF MOVF MOVWF MOVF SUBWF BTFSC return; INTCON ;All interrupts are disabled TMRlH, W ; Read high byte TMPH_IR ;store in temporary register TMRl L, W ; Read low byte TMPL_IR ;store in temporary register TMRlH, W ; Read high byte TMPH_IR, W ; Sub lst read with 2nd read STATU8,Z ; IS result = 0 Good l6-bit read ; TMRl L may have rolled over between the read of the high and low bytes. ; Reading the high and low bytes now will read a good value. 63 MOVF TMRlH, W ; Read high byte MOVWF TMPH_IR ; MOVF TMRl L, W ; Read low byte MOVWF TMPL_IR ; ; Re-enable the Interrupt (if required) goto IR_rdend RDTMRI_US BankO CLRF INTCON ;All interrupts are disabled MOVF TMRlH, W ; Read high byte MOVWF TMPH_US ;store in temporary register MOVF TMRl L, W ; Read low byte MOVWF TMPL_US ;store in temporary register MOVF TMRlH, W ; Read high byte again SUBWF TMPH_US, W ; Sub lst read with 2nd read BTF SC STATU8,Z ; IS result = 0? return ; TMRl L may have rolled over between the read of the high and low bytes. ; Reading the high and low bytes now will read a good value. 9 MOVF MOVWF MOVF MOVWF TMRlH, W ; Read high byte TMPH_US ; TMRlL, W ; Read low byte TMPL_US ; ; Re-enable the Interrupt (if required) goto U8_rdend 9 TDOA MOVF TMPL_IR,W SUBWF between high byte values MOVWF difference MOVF btfss incfsz subwf MOVWF difference TMPL_US,0 ; find difference ACCaLO ; store TMPH_IR,W STATUS,C ;add in carry TMPH_IR,W TMPH_US,0 ACCaHI ; store 64 call ReadADC ;read temperature sensor call LookupTable ;compare with table values to determine Vus 9 loadAB movlw 0x01 movwf ACCbHI movf vusl,w movwf ACCbLO ;; loads ACCb = 344m/S, floating point notation of PIC for 344 goto F_mpy ;Lookup table to vary Vus LookupTable movlw 0x23 subwf temperature,w btfsc STATUS,C goto NextLookup22 movlw 0x58 movwf vusl goto loadAB NextLookup22 movlw 0x24 subwf temperature,w btfsc STATUS,C goto NextLookup23 movlw 0x58 movwf vusl goto loadAB NextLookup23 movlw 0x25 subwf temperature,w btfsc STATUS,C goto NextLookup24 movlw 0x59 movwf vusl goto loadAB 65 NextLookup24 movlw subwf btfsc goto movlw movwf goto NextLookup25 movlw subwf btfsc goto movlw movwf goto NextLookup26 movlw subwf btfsc goto movlw movwf goto NextLookup27 movlw subwf btfsc goto movlw movwf goto NextLookup28 movlw subwf btfsc goto movlw 0x26 temperature,w STATUS,C NextLookup25 0x59 vusl loadAB 0x27 temperature,w STATUS,C NextLookup26 0x59 vusl loadAB 0x28 temperature,w STATUS,C NextLookup27 0x5A vusl loadAB 0x29 temperature,w STATUS,C NextLookup28 0x5A vusl loadAB 0x2A temperature,w STATUS,C NextLookup29 0x5A 66 movwf vusl goto NextLookup29 movlw subwf btfsc goto movlw movwf goto NextLookup30 movlw subwf btfsc goto movlw movwf goto NextLookup8 movlw subwf btfsc goto movlw movwf goto NextLookup9 movlw subwf btfsc goto movlw movwf goto loadAB 0x2B temperature,w STATUS,C NextLookup30 0x5B vusl loadAB 0x2C temperature,w STATUS,C NextLookup8 0x53 vusl loadAB 0x16 hunpenuunaur STFVILHLCI thuLookup9 0x54 vuSl loadAdB 0x17 temperature,w STATUS,C NextLookupl 0 0x54 vusl loadAB 67 NextLookup] 0 movlw subwf btfsc goto movlw movwf goto NextLookup] l movlw subwf btfsc goto movlw movwf goto NextLookup 1 2 movlw subwf btfsc goto movlw movwf goto NextLookup l 3 movlw subwf btfsc goto movlw movwf goto NextLookup] 4 movlw subwf btfsc goto movlw movwf goto 0x18 temperature,w STATUS,C NextLookupl 1 0x54 vusl loadAB 0x19 temperature,w STATUS,C NextLookup] 2 0x55 vusl loadAB OxlA temperature,w STATUS,C NextLookup] 3 0x55 vusl loadAB 0x1 B temperature,w STATUS,C NextLookup14 0x55 vusl loadAB 0x1 C temperature,w STATUS,C NextLookup] 5 0x56 vusl loadAB 68 NextLookup] 5 movlw subwf btfsc goto movlw movwf goto NextLookup] 6 movlw subwf btfsc goto movlw movwf goto NextLookupl 7 movlw subwf btfsc goto movlw movwf goto NextLookupl 8 movlw subwf btfsc goto movlw movwf goto NextLookup] 9 movlw subwf btfsc movlw movlw movwf goto 0x1 D temperature,w STATUS,C NextLookup] 6 0x56 vusl loadAB 0x1 E temperature,w STATUS,C NextLookupl 7 0x56 vusl loadAB OxlF temperature,w STATUS,C NextLookupl 8 0x57 vusl loadAB 0x20 temperature,w STATUS,C NextLookupl 9 0x57 vusl loadAB 0x21 tenuxaahuenv STUATTJSJZ 0x57 0x57 vusl loadAdB 69 9 ; Binary Floating Point Multiplication : ; ACCb(l 6 bits)EXP(b) * ACCa(16 bits)EXPa -> ACCb(16 bits)EXPb F_mpy mloop 9 setup movlw . D_add call bcf rrf rrf btfsc movf addwf btfsc incf movf addwf btfsc incf return setup STATUS,C ; clear carry bit ACCdHI, F ;rotate (I right, place result in W ACCdLO, F STATUS,C ;need to add? D_add ACCbHI, F ACCbLO, F ACCcHI, F ACCcLO, F temp, F ;loop until all bits checked mloop Convert_D 9999999??? ; for 16 shifts temp ACCbHI,W ACCdHI ACCbLO,W ACCdLO ACCbHI ACCbLO ;move ACCb to ACCd ; clear ACCb ( ACCbLO & ACCbHI ) ACCaLO,W ; Addition ( ACCb + ACCa -> ACCb ) ACCbLO, F ;add lsb STATUS,C ;add in carry ACCbHI, F ACCaHI,W ACCbHI,F ;add msb STATUS,C;add in carry ACCbHI,F 70 ; ReadADC ReadADC BankO bsf ADCON0,GO btfsc ADCON0,GO ;loop until conversion is complete goto 8-1 nop movf ADRESH,W movwf temperature bsf ADCON0,GO return Convert_D movf ACCbHI,W movwf AARGBO movf ACCbLO,W movwf AARGBI movf ACCcHI,W movwf AARGB2 movf ACCcLO,W movwf AARGB3 call int_ascii ;convert a 32-bit int to ASCII goto Transmit int_ascii movlw last_digit movwf FSR ;pointer = address of smallest digit movlw SIG_FIG ;load counter with the number of movwf digit_count ;Significant figures the decimal number flo_asclp clrf BARGBO ;Make the divisor 10. movlw .10 movwf BARGBI call FXD3216U ;divide (32-bit fixed) / 10 (to get remainder) movf REMB1,w ;put remainder in w register 71 movwf INDF ;put number into appropriate digit position movlw addwf decf decfsz goto return include include include 0x30 INDF,f ;add 30h to decimal number to convert to ASCII FSR,f ;move pointer to next digit digit_count,f flo_asclp ;fixed point 32/16 divide from AN617 ;32 bit float routines ;we are using FPM32 for 32-bit multiply ;and INT3232 for 32-bit float to 32-bit int ;conversion. Routines are in AN575 return Transmit ;send distance computation results to host PC movf hundredthousands,W call Send movf tenthousands,W call Send movf thousandS,W call Send movf hundreds,W call Send movlw 0x0D call Send goto comp_done Send Bank] btfss TXSTA,TRMT ; Wait until can send goto BankO movwf TXREG ; Send data in W return 72 EXIT_INT ; routine to end interrupt BankO ;select bank 0 movf F SR_TEMP,W ; get saved FSR value movwf F SR ;restore FSR movf PCLATH_TEMP,W ;get saved PCLATH value movwf PCLATH ;restore PCLATH movf STATUS_TEMP,W ;get saved STATUS value movwf STATUS ;restore STATUS swapf WREG_TEMP,F ;prepare WREG to be restored swapf WREG_TEMP,W ;restore WREG without affecting STATUS retfie ;retum from interrupt main Initializations BankO CLRF INTCON CLRF PIRl ; Clear peripheral interrupts Flags CLRF TlCON ; Stop Timerl, Internal Clock Source, ; Tl oscillator disabled, prescaler = 1:] CLRF TMRIH ; Clear Tirnerl High byte register CLRF TMRlL ; Clear Timer] Low byte register CLRF INTCON ; Disable interrupts Bank] CLRF PIE] ; Disable peripheral interrupts BSF TRISC,0 BankO MOVLW 0x2A ; External Clock source with oscillator MOVWF TlCON ; circuitry, 1:4 prescaler, Clock source ; is synchronous to device ;Tirnerl is stopped BSF TlCON, TMRlON ; Tirnerl starts to increment ; The Timer] interrupt is disabled, do polling on the overflow bit bcf error_check,free ;clear the error_check bit 73 signal Bank0 CLRF CLRF BSF BSF BSF BSF BSF Bank] movlw movwf movlw movwf BankO movlw movwf Bank] BSF BSF INTCON PIRl INTCON,GIE ; Enable Interrupts INTCON,INTEDG;enable triggering at rising edge of lNTCON,INTE;enable external interrupt at pin B0 PIE1,SSPIE;enable ssp interrupt INTCON,RBIE SPBRG_VAL ;set baud rate SPBRG 0x24 ;enable transmission and high baud rate TXSTA ;select bankO 0x90 ;enable serial port and reception, no errors RCSTA PIE1,RCIE ; Enable receive interrupts PIE] ,TMRl IE ; Enable TMR] Interrupt ; InitADC : Analog-Digital Conversion initializations 9 InitADC Bank] clrf bsf BankO movlw movwf bcf goto END ADCON] PIE1,ADIE 0x81 ;Analog channel is RAO ADCONO ;ADC is on PIR1,ADIF Loop ; directive ‘end of program' 74 [1] [2] [3] [5] [6] [7] [8 [9] [10] [11] [12] [13] [14] Bibliography Massachusetts Institute of Technology, "The Cricket Indoor Location System," Boston, MA, 2005. Priyantlra B. Nissanka, "Te Cricket Location-Support System", in the 6th ACM International Conference on Mobile Computing and Networking, Boston, MA, 2000. Hazas, Mike & Ward, Andy "A Novel Broadband Ultrasonic Location System," in Proceedings of UbiComp 2002: Fourth International Conference on Ubiquitous Computing, Springer-Verlag, Sweden, 2002. Want, Roy et al, "The Active Badge Location System," Cambridge, England. Ward, Andy et al, "The Bat Ultrasonic Location System." Cambridge, UK, 2004. Bah], Paramvir & Padmanabhan, N. Venkata, "RADAR: An In-Building RF- based User Location and Tracking System" in Microsoft Research. Welch, Greg et a], "The HiBall Tracking System," in High-Performance Wide- Area Optical Tracking, Chapel Hill, NC, 2001. Randell, Cliff & Muller Henk, "Low Cost Indoor Positioning System,” Bristol, UK 2003. Youssef, Moustafa & Agrawala, Ashok, "The Horus WLAN Location Determination System," College Park, MD. Wallbaurn, Michael & Diepolder, Stefan, "Benchmarking Wireless LAN Location Systems," in Proceedings of the 2005 Second IEEE International Workshop on Mobile Commerce and Services, 2005 Hightower, Jeffrey & Borriello, Gaetano, "Location Systems for Ubiquitous Computing," in IEEE Computer, August 2001. www.ubisense.net/Product/whitepapers&downloads.htrnl Curry, M et a1, "Indoor angle of arrival using wide-band frequency diversity with experimental results and EM propagation modeling" in IEEE-APS Conference on Antennas and Propagation for Wireless Communications, 6-8 Nov, 2000, pp 65- 68 75 [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [30] [31] Fischer, 8., & Kangas, A., "Time-arrival estimation for E-OTD location in GERAN" in IEEE lntemational Symposium on Personal, Indoor and Mobile Radion Communications, Sep/Oct 2001, pp F-121-F-125. Baker, Bonnie, "Temperature Sensing Technologies," Microchip Technology Inc., 1991. Baker, Bonnie, "Thermistors in Single Supply Temperature Sensing Circuits," Microchip Technology Inc., 1999. Evans, Rick, "Floating Point to ASCII Conversion," Microchip Technology Inc., 2001. Palmer, Mark, "Using the PORTB Interrupt on Change as an External Interrupt," Microchip Technology Inc., 1997. Garbutt, Mike, "Asynchronous Communications with the PICmicro USART," Microchip Technology Inc., 2003. Schreiber, Robert, "Implementing Ultrasonic Ranging," Microchip Technology Inc., 1997. Palmer, Mark, "Using Timer] in Asynchronous Clock Mode," Microchip Technology Inc., 1997. Dietz, Ken, "Interfacing SPI Serial EEPROMS to PIC16 Devices," Microchip Technology Inc., 2005. Microchip Technology Inc., "Software Interrupt Techniques," 1997. Microchip Technology Inc., "EEPROM Memory Programming Specification". Microchip Technology Inc., "Hardware Techniques for PICMicrO Microcontrollers". Predko Myke, Programming and Customizing PICmicro Microcontrollers, McGraw-Hill Companies, Inc., USA, 2001. Testa J ., Floating Point Math Functions, Microchip Technology Inc., 1997. http://www.glenbrook.k12.il.us/gbssci/phys/Class/sound/ul 112c.html Kobitone Audio Company, "Ultrasonic Transducers" datasheet, 05/ 1 1/06 Zetex, "ZXM61P03 datasheet", July, 1999 76 [32] [33] [34] [35] [36] [37] [33] [39] [40] [41] [42] [43] [44] [45] Vishay Semiconductors, "IR Receiver Modules for Remote Control Systems", 08/08/2007 Vishay Semiconductors, "Infrared Transceiver Module (SIR, 115.2 kbits/s) for IrDA applications", 01/26/2004 Microchip Technology Inc., "PICmicrO Mid-Range MCU Family Reference Manual", December, 1997 Microchip Technology Inc., "PIC16F87X Datasheet", 2001 www.st.com, July, 2005 Fairchild Semiconductor, "DM74L800 Quad 2-Input NAND Gate Datasheet", March, 2000 MAXIM, "Dual 256-Tap, Low-Drift, digital Potentiometers in 10 uMAX", 04/2001 MAXIM, "SPI/Microwire-Compatible UART in QSOP-l6", 12/2001 MAXIM, "Dual-Output Charge Pump with Shutdown", 03/1996 MAXIM, "MAX232 Datashee ", March, 2004 National Semiconductor, "LMV822 Dual op amp datasheet", December, 2000 National Semiconductor, "LMC7215 datasheet", August, 1996 National Semiconductor, "LM34 Precision Fahrenheit Temperature Sensors datashee ", November 2000 ECS Inc. lntemational, "1.8432 quartz crystal datasheet". 77 ill lliiiiijiliji 3 5