Personalized Smart Residency with Human Activity Recognition a Thesis Submitted to the Graduate School in Partial Fulfillment Of
Total Page:16
File Type:pdf, Size:1020Kb
PERSONALIZED SMART RESIDENCY WITH HUMAN ACTIVITY RECOGNITION A THESIS SUBMITTED TO THE GRADUATE SCHOOL IN PARTIAL FULFILLMENT OF THE REQUIREMENT FOR THE DEGREE MASTER IN COMPUTER SCIENCE BY SUDAD H. ABED DR. WU SHAOEN – ADVISOR BALL STATE UNIVERSITY MUNCIE, INDIANA December 2016 DEDICATION To our greatest teacher, the person who took us out of the darkness to the light, the person who carried discomfort on his shoulders for our comfort, our prophet Mohammad; To the pulse of my heart, the secure and warm lap, the one who stayed up to ensure my wellness, my mother; To the man who devoted his life to me, my first friend, the one who I will always go to for advice, my father; To those whom I stood up miss every day, the companions who have stood by me through the good times and the bad, my brothers and sisters; I dedicate my work to you. i ACKNOWLEDGMENT First of all, and most importantly, I thank Allah for all the strength, blessings, and mercy he has been given me. I want to pay a special warm thanks to my teacher and thesis advisor Dr. Shaoen Wu for his guidance, answers, and patience every time I needed him during my work on the thesis. I want to acknowledge my appreciation to Dr. Shaoen Wu for all his effort and support in helping me complete this work. I want to thank my committee members, Dr. David Hua and Dr. Jeff Zhang for all their suggestions and recommendations. Also, I want to thank the chairperson of the Computer Science Department, Dr. Paul Buis, and the Director of Graduate Program, Dr. Samuel Hsieh, for their help throughout my master program and completing my graduation requirements. I want to pay a special thanks to all my family members and friends for all the help, support, and love that I received from them. ii CONTENTS TITLE PAGE 1 INTRODUCTION ...................................................................................................................... vi 2. RELATED WORK ..................................................................................................................... 3 2.1 Energy Conservation ............................................................................................................. 3 2.1.1 Nest Thermostat .............................................................................................................. 4 2.1.2 Smart Vents .................................................................................................................... 5 2.2 Human Recognition............................................................................................................... 5 3. BACKGROUND ........................................................................................................................ 6 3.1 Hardware ............................................................................................................................... 6 3.1.1 Ultrasonic sensors ........................................................................................................... 6 3.1.2 Arduino ........................................................................................................................... 8 3.2 Algorithms and Methods ....................................................................................................... 9 3.2.1 Linear Regression ........................................................................................................... 9 3.2.2 K-means Algorithm ...................................................................................................... 10 3.2.3 Elbow Method .............................................................................................................. 13 3.2.4 K-Nearest Neighbor Algorithm .................................................................................... 14 4 SYSTEM DESIGN .................................................................................................................... 15 4.1 Hardware Platform Design .................................................................................................. 17 4.2 Software Design .................................................................................................................. 19 iii 4.2.1 Preprocessing Stage ...................................................................................................... 20 4.2.2 Smoothing the Data ...................................................................................................... 21 4.2.3 Determining the Number of Users................................................................................ 22 4.2.4 Clustering the Data ....................................................................................................... 23 4.2.5 Prediction ...................................................................................................................... 23 5 PERFORMANCE EVALUATION ........................................................................................... 23 5.1 Environment Settings .......................................................................................................... 24 5.2 Data Preprocessing .............................................................................................................. 25 5.3 Smoothing the Data ............................................................................................................. 27 5.4 Determining the Number of Persons ................................................................................... 29 5.5 Clustering the Data .............................................................................................................. 32 5.6 Predicting the Identities of Persons ..................................................................................... 33 6 CONCLUSION .......................................................................................................................... 34 REFERENCES ............................................................................................................................. 36 APPENDICES .............................................................................................................................. 39 APPENDIX A ........................................................................................................................... 40 APPENDIX B ........................................................................................................................... 41 iv LIST OF TABLES TABLE PAGE Table 1 Information on HC-SR04 Ultrasonic Module. .................................................................. 6 Table 2 Sample of the collected data. ........................................................................................... 20 Table 3 Sample of readings contain a wrong value. ..................................................................... 21 Table 4 Statistical values of the training data set from sensor 3 before preprocessing. ............... 26 Table 5 Statistical values of the training data set from sensor 3 after preprocessing. .................. 27 Table 6 Theta values after leaning. ............................................................................................... 28 Table 7 Results of applying the elbow method on the training data set. ...................................... 30 Table 8 Results of applying the elbow method on the smoothed training data set. ...................... 31 Table 9 Percentages of clusters. .................................................................................................... 33 Table 10 Accuracy of the prediction. ............................................................................................ 33 v LIST OF FIGURES FIGURE PAGE Figure 1 Nest thermostat, the picture is from Nest website. ........................................................... 4 Figure 2 HC-SR04 ultrasonic module [11]. .................................................................................... 6 Figure 3 Functionality of ultrasonic sensor [11]. ............................................................................ 7 Figure 4 Microcontroller Arduino YÚN [14]. ................................................................................ 8 Figure 5 The procedure of 푘-means algorithm [19]. ................................................................... 12 Figure 6 Identification of elbow point [23]................................................................................... 13 Figure 7 Ambiguity in identifying elbow point [23]. .................................................................. 14 Figure 8 Smart HVAC system design. .......................................................................................... 16 Figure 9 Hardware platform.......................................................................................................... 18 Figure 10 Software design. ........................................................................................................... 19 Figure 11 Training data set before preprocessing. ........................................................................ 25 Figure 12 Training data set after preprocessing. ........................................................................... 26 Figure 13 The testing data set with the results of smoothing. ...................................................... 28 Figure 14 Differences in the results of smoothing. ....................................................................... 29 Figure 15 Visualized results of applying the elbow method on