Master Thesis Exploring Spatio-Temporal Data from Distributed Bluetooth Scanning
Total Page:16
File Type:pdf, Size:1020Kb
Master Thesis Exploring spatio-temporal data from distributed Bluetooth scanning Łukasz Dynowski [email protected] Marcos Fuentes [email protected] Kongens Lyngby 2012 IMM-MSC-2012-?? Technical University of Denmark Informatics and Mathematical Modeling Building 321, DK-2800 Kongens Lyngby, Denmark Phone +45 45253351, Fax +45 45882673 [email protected] www.imm.dtu.dk IMM-MSC: ISSN ????-???? Abstract Roskilde Festival is a music event attended every year by 130.000 people, providing a big opportunity for collecting spatio-temporal data of the participants, given its high population density (0,78 [pop./m2]). In the current researches, the data collection has been achieved by installing smartphones in the areas of interest, which can detect the Bluetooth device of the participants’ mobile phones. However, the installation of these smartphones requires a permanent access to a power supply, which can be difficult to guarantee due to infrastructure limitations. Considering that during the 10 days of the event 50% of the participants may carry a smartphone, we propose the use these devices to collect other participants’ data. This solution should reduce the energy required to detect other devices, due to the limited access to recharge the battery of their smartphones. In this work, we present the design, implementation and deployment of software for scanning Bluetooth devices. This software can be attached as a library to other applications intended for the festival, running as the background process. We designed an algorithm to reduce the energy used in the Bluetooth devices detection. Using this technique, we could collect the data of 2.4% of the participants of the festival, with a 60% of the concerts area scanned at least once. This technique demonstrates to be highly scalable, depending on the amount of participants using the applications of the event and not on infrastructural limitations. The data collected comprises the location of the smartphone used in the scans, the detected devices and the network conditions, which can be used to analyze the behavior of the participants. Acknowledgments First and foremost, we would like to thank to the supervisors Jakob Eg Larsen and Sune Lehmann Jørgensen for their assistance during the project. We give particular thanks to Arkadiusz Stopczyński for the guidance, contact and fast feedback that he always served. Moreover, we would like to thank to the developers of the front-end applications used to attach the library and collect the data in this work: Félix Rubio (Roskilde Hide And Seek), Christian Graver Larsen (Roskilde MusicNerd), Lasse Reedtz, Andrea Cuttone, Morten Georg Jensen and Frederik Toft (Roskilde Decibel). Łukasz Dynowski I own thanks to all the teachers whom I met along my education way. Thanks for pointing the path to follow and for faith that the put in me, to Kamil Szkarłat, Lidia Skibińska and my BSc’s supervisor Grzegorz Musiał. The biggest thanks to my elementary teacher Stefan Kowalski for breaking the rules, shifting the thoughts, going on the margin of patience, being different and breaking stereotypes. Moreover, I would like to thank to my family. To my parents along with my siblings for being, believing and any form of help, which they always provide. Furthermore, I would like to thank to my friends Marcos Fuentes, Filip Leczyński, Andrii Sereda and many others (which I have met on my way and whom is difficult to mention all). Thanks for their tremendous patience, unappreciated criticism and showing the proof that the problems are easier to solve as long as you know the good process, and you try to do fulfill it. Besides, I would like thanks to all bad colleagues who I met, for showing whom I should not be and how I should not behave. In addition, I would like to thank to Danish and Polish government for resources that they invested in me along my whole education program. Finally, I would appreciate my girlfriends for changing me for better, without whom I would not be where I am. Thanks to Luana for opening the world of opportunities and triggering in me linguistic skills. The biggest thanks to Juliet for great patience, support, words of hope and for being completely opposite (but sharing these same values). Marcos Fuentes First of all, I would like to dedicate this work to my parents for their unconditional support, advices and all the encouraging words; to my father Carlos, for exposing me to the world of electronics and computers when I was just a little child; to my mother Coralia, for teaching me not to be afraid of any challenge. I would also like to dedicate this work to my girlfriend Maria Paz, for her unrestricted love and for being always with me, despite the long physical distance between us. I want to thank to my friend Łukasz for all those interesting discussions about any topic and for being able to separate friendship from professional work. I give thanks to all the Chilean people for their financial contribution to the scholarship that allowed me to study abroad. Finally, I would to thank to all the Danish people for showing me that a society can be better if everyone support each other. These lessons will be with me forever. Contents CHAPTER 1: INTRODUCTION 9 1.1 PROBLEM 9 1.1.1 Main goal 10 1.1.2 Secondary goals 10 1.2 METHODOLOGY 10 1.3 THESIS STRUCTURE 11 1.4 DISTRIBUTION OF WORK 11 1.4.1 Work done by Łukasz Dynowski 11 1.4.2 Work done by Marcos Fuentes 12 CHAPTER 2: RELATED WORK 14 2.1 INTRODUCTION 14 2.2 TRACKING PEOPLE MOVEMENTS USING BLUETOOTH 15 2.3 GAINING INFORMATION FROM THE DATA COLLECTED 16 2.4 SUMMARY 18 CHAPTER 3: ANALYSIS 19 3.1 OVERVIEW 19 3.2 MOVEMENT TRACKING USING SMARTPHONES AND BLUETOOTH 19 3.3 TECHNICAL CHALLENGES 21 3.3.1 Energy consumption 21 3.3.2 Limited Network Access 22 3.3.3 Attractiveness 22 3.4 HARDWARE AVAILABLE FOR THE RESEARCH 22 3.5 MOBILE PLATFORMS 23 3.5.1 Market Analysis 23 3.5.2 Previous Festival Applications 25 3.5.3 Technical Feasibility Analysis 26 3.6 RISK ANALYSIS 27 3.6.1 Front-end applications 27 3.6.2 Human resources 28 3.6.3 Technical resources 28 3.7 SUMMARY 28 CHAPTER 4: EXPERIMENTS 29 4.1 OVERVIEW 29 4.1.1 Bluetooth discoverability 29 4.1.2 Theoretical calculations 32 4.1.3 Bluetooth scanning vs. people movement 32 4.1.4 Energy consumption 34 4.1.5 Energy consumption with different intervals 36 4.2 DATA ANALYSIS FROM ROSKILDE FESTIVAL 2011 37 4.2.1 Overview 37 4.2.2 Dataset 38 4.2.3 Crowd activity during the day 39 4.2.4 Data loss versus scanning frequency 40 4.2.5 Data predictability and dynamic intervals using replacement rate 43 4.3 SUMMARY 45 CHAPTER 5: DEVELOPMENT 46 5.1 OVERVIEW 46 5.2 ARCHITECTURE 47 5.2.1 Mobile Components 47 5.2.2 Server Components 48 5.2.3 Monitoring tools 48 5.3 REQUIREMENT ANALYSIS 48 5.4 DESIGN 50 5.4.1 Databases 50 5.4.2 Scanner Library 53 5.4.3 Schedulers 55 5.4.4 Periodic tasks 57 5.4.5 Coordination with other library instances 60 5.5 IMPLEMENTATION 61 5.5.1 Methodology 61 5.5.2 Technologies used 61 5.5.3 Database 62 5.5.4 Web services and package appending 63 5.6 MONITORING TOOLS 64 5.7 TESTING 68 5.7.1 Alpha Testing 68 5.7.2 Beta Testing 71 5.7.3 Integration tests with Roskilde 2012 front-end applications 72 5.8 DEPLOYMENT 73 5.9 SUMMARY 73 CHAPTER 6: RESULTS 75 6.1 INTRODUCTION 75 6.2 DATA PREPARATION 75 6.3 GENERAL STATISTICS 78 6.3.1 Statistics 78 6.4 AREA COVERED 81 6.4.1 Percentage of the festival and concert area covered 81 6.4.2 Traversed area covered per scanner 85 6.5 DISCOVERIES EFFICIENCY 85 6.5.1 Total occurrences and unique devices per discovery 85 6.5.2 Energy efficiency 86 6.5.3 Intervals assigned by the algorithm 87 6.5.4 Distribution of discovered devices 89 6.6 LIBRARY RUNNING TIME AND FRONT-END IMPACT 90 6.7 NETWORK COVERAGE 92 6.8 LOCATION ACCURACY 94 6.9 BLUETOOTH DISCOVERY TIME 96 6.10 DATA COLLECTED AND MARKET SHARE 97 6.11 ADDITIONAL RESULTS 98 6.11.1 Daily walking speed 98 6.11.2 Battery Level 98 6.11.3 Manufacturers 99 6.12 APPLICABILITY 101 6.12.1 Social network analysis 101 6.13 SUMMARY 103 CHAPTER 7: CONCLUSIONS 105 7.1 FUTURE WORK 106 BIBLIOGRAPHY 108 APPENDIX 111 I. LIBRARY MANUAL 111 A. ADDING BTSCANNERLIBRARY TO THE PROJECT 111 B. TO START THE SERVICE 111 C. TO STOP THE SERVICE: (THIS KILL ALL THE SUBSERVICES STARTED OR IN PROGRESS) 111 D. GET THE BLUETOOTH MAC 111 E. GET THE CACHED OR OBTAIN GPS LOCATION: 111 F. GET THE CACHED OR OBTAIN BLUETOOTH DEVICES: 112 G. SCHEDULE A POST REQUEST: 112 H. SCHEDULE A POST REQUEST WITH FILE 112 I. ACTIVATE THE BLUETOOTH 113 II. SQL QUERIES 114 A. QUERY USED TO FIND AND ASSIGN THE NEAREST TIME FROM THE GPS TABLE INTO THE BLUETOOTH TABLE 114 B. QUERY USED TO MEASURE THE DIFFERENCE BETWEEN THE LOCATION TIME AND THE TIME OF THE DISCOVERIES 115 C. QUERY FOR COUNTING THE REPEATED DEVICES LIMITED TO LOCATION, TIME AND ACCURACY. 115 D. QUERY FOR CALCULATING THE TIME OF DISCOVERY 115 E. QUERY USED TO SELECT THE DISCOVERED DEVICES THAT WERE IN AN EVENT 116 F.