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 the training data set. .................. 30 Figure 16 Visualized results of applying the elbow method on the smoothed training data set... 32 Figure 17 Result of clustering the training data set. ..................................................................... 32
vi
1 INTRODUCTION
Nowadays, buildings are considered to be the largest consumers of energy. In the United
States, the US Department of Energy estimates that 70% of electrical energy is consumed by buildings in the US [1]. The largest portion of this energy is used by heating ventilating and air conditioning (HVAC) systems to maintain a comfortable temperature in these buildings. The HVAC systems use 50% of the energy that is consumed by commercial and residential buildings [2]. Moreover, the ineffective use of heating and cooling systems causes a large amount of wasted energy, which is estimated about 39% inside residential buildings [3] . So, with all the efforts that have been put forth by governments, researchers, and organizations from around the world to find different resources for energy and to reduce wasted energy, it is important to focus on the large amount of energy that is wasted by HVAC systems and try to find solutions. Many companies are trying to find ways to reduce this this 40% of wasted energy. However, this paper will show that current solutions are insufficient.
The problem with current HVAC systems is that they depend on one thermostat. As it is known, the thermostat is responsible for controlling the HVAC system; thus, when the temperature reaches the previously specified comfort degree, the thermostat shuts down the HVAC system. Before exploring the problem of current HVAC systems, it should be clear that when the thermostat pauses the HAVC system, the air temperature maintaining process stops completely in all the rooms of a building. To make an analogy, controlling the HVAC system with one thermostat is comparable to controlling lights in all the rooms in a building with one switch key. This way of controlling causes problems in adjusting all the rooms or a specific room to a specific temperature degree because not all the rooms are in the same direction relative to the sun. In addition, the differences in the isolation of the rooms may vary. For instance, the hot air always goes up; that is why the second floor in a house feels warmer than the first floor in the summer. The second
1problem is that current HVAC systems waste energy because not all of the rooms in a house are occupied all the time. Indeed, many rooms in a house are seldom used while the HVAC systems run and waste energy to maintain the temperature and humidity. Moreover, the different positions of rooms in a house cause different temperatures inside these rooms. So, some rooms are warmer or cooler than others, requiring a different amount of air flow coming from the heating and cooling systems to maintain the temperature.
Nowadays, there has been a move to control things from far away via internet, which is called Internet of Things (IoT). HVAC systems have also entered the area of IoT where some people are now able to turn off or set up their thermostat easily by using an application on their smartphones connected to the internet. This is one of the solutions that has started recently which aims to reduce wasted energy by making it possible for homeowners to control the thermostat in their houses. For instance, once nobody is in the house, one of the family members can turn the HAVC system off or set the comfort temperature, so the system pauses earlier and does not continue to run in an attempt to maintain the temperature, thus reducing the amount of wasted energy. While this solution solves part of the problem, we still have the problem of one thermostat controlling all the rooms.
We need a distributed HVAC system where every room is controlled individually instead of one fixed system with one thermostat. In this thesis, I propose a smart sensor-based distributed system which identifies a person in a room and sets the temperature in the room according to the person’s preferences. The temperature in each room is maintained individually by controlling the vent/s in the room. This thesis is focused on the identification part and how the data collected by the sensors are processed. The result we obtained after completing the experiment shows that the proposed system can be more than 90% accurate in identifying the persons successfully.
2
The rest of this paper is organized as follows. Section 2 shows the related work and the currently available solutions to the presented HVAC systems’ problems. The hardware used to collect the data and building the system with all the algorithms that are used in the system are presented in section 3. Section 4 presents the system design and how the system is framed. The experiment that has been completed to test the proposed system in identifying the persons is presented in section 5. Finally, the conclusion with the recommended directions for the future work is presented in section 6.
2. RELATED WORK
In this thesis I have two motivations: one is reducing the consumed energy by the HVAC systems, and the other to make the system smart by making it recognize the persons. In this section I am going to present the previous related work that will be split into two aspects: the first aspect is energy consumption and the second aspect is human recognition.
2.1 Energy Conservation
Recently, we can find smart devices, such as smartphones, smart watches, and even smart cars, everywhere around us. The smart house idea has become widely interesting among many companies and an active research area, where the devices inside the houses have been changed by many companies, so we have smart televisions, smart vacuum cleaners, and smart bulbs. The idea behind the smart home is to mix new technology with the devices that people already have in their houses to make life easier. For the purpose of making HVAC systems more smart and beneficial, specifically reducing the consumed energy, many companies have started developing devices to make the heating and cooling systems smart and more economical.
3
2.1.1 Nest Thermostat
In late 2011, the first smart thermostat was introduced in the market under the name Nest thermostat [4]. The Nest thermostat gained a lot of attention in the media since it was the first smart learning thermostat after about sixty years from the first appearance of the programmable standard thermostat [4]. The Nest has a screen display that allows users to navigate through a menu by pushing the screen. The screen is surrounded by a dial that is used to set the temperature [5] (see Figure 1). In October 2012, the Nest appeared again with new features that allow the user to program it via a web-based application with the ability that Nest thermostat learns from the temperature settings changes that users make. Then, the Nest generates a schedule and programs itself accordingly [4-6]. Nest company promises that the schedule that the thermostat generates for the temperature settings guarantees a comfort temperature and less energy wasted [5, 6]. The Nest has an included motion detection sensor that senses any person’s movement [4]. If the Nest does not get any sign of occupancy in a place for two hours, it automatically turns on the Auto-way mode where it sets the temperature to a user-defined point to stop the heating and cooling of an unoccupied place.
Figure 1 Nest thermostat, the picture is from Nest website.
4
2.1.2 Smart Vents
In the last two years companies, such as Keen Home, introduced smart vents that can control the air flow in each room and try to balance the temperature degree between rooms [7]. The Keen smart vents can be controlled by an application that can be installed on a smartphone [7].
2.2 Human Recognition
Determining a person’s identity is not a new problem; it has been available for years and many solutions based on different concepts have been produced to solve this problem [8]. The first
solution for the authentication is based on the “possession, ” which represents any object that
proves the person’s identity, such as identity cards, documents, and keys. [8]. We can see the first type of identity authentication applied in many places, such as universities where students have IDs or airports where passports are used to prove passengers’ identities. The second type depends on the “knowledge,” where a person must remember information that proves their identity, such as passwords or PINs. [8, 9]. This way is used in many areas; for instance, passwords are used in almost every account login process for authentication purposes. The third type of authentication is called “biometric” where the roots of this word are bios and metron which are two Greek words translated to life measurements [8, 10]. The biometric-based type of human recognition depends on biological characteristics or features of a human being, making this way better than the other two ways where the identification documents or knowledge could be lost or forgotten [8]. There are many examples of biometric human recognition that are applied on a daily basis; for instance, fingerprint-based identity authentication has been widely used in recent smartphones and laptops.
5
3. BACKGROUND
In this section, I will present all the parts that were used to build the proposed system and give a general explanation about them. This section will be split into two subsections: the hardware and the algorithms and methods.
3.1 Hardware
There is more than one hardware device used to build the proposed system, including sensors and microcontrollers.
3.1.1 Ultrasonic sensors
There are many different models of ultrasonic sensors where the differences are in the properties and the measurement ranges. The one that was used in the designed system is HC-SR04 Ultrasonic Module (see Figure 2). The ultrasonic sensor generates the ultrasonic wave, which is the sound wave out of the range of the human ability of 20 KHz [11].
Figure 2 HC-SR04 ultrasonic module [11].
This type of ultrasonic sensor provides a non-contact of distance measurement ranging from 2cm to 400cm with 3mm± accuracy [11, 12] (see Table 1 for more information).
Table 1 Information on HC-SR04 Ultrasonic Module.
Stable performance, Accurate distance measurement, High-density, Small
Product Features
blind. Robotics barrier, Object distance measurement, Public security.
Application Areas
6
VCC : 5V power supply, Trig : Trigger pin, Echo : Receive pin, GND : Power ground.
Module pins definitions Electrical parameters
Operating Voltage (DC) : 5V, Operating Current : 15mA Operating, Frequency : 40KHz, Farthest Range : 4m, Nearest Range : 2cm Measuring, Angle : 15, Degree Input Trigger Signal : 10us TTL pulse.
The measurement process starts after setting the trigger pin and the echo pin to low as the module initializing settings [11]. The measurement process starts by sending at least a 10u pulse to the trig pin, causing the module to send an ultrasound wave at 40kHz [11, 12]. The echo port is waiting to capture any reflected echo of the pulse while a timer is counting the time between sending the pulse and capturing its echo back after it hits an obstacle [11] (see Figure 3) . After the echo port captures the echo of the pulse, the distance between the sensor and the object can be calculated using the equation below [11, 13].
- Test distance = (high level time * ultrasonic spreading velocity in air) / 2
- (3.1)
Figure 3 Functionality of ultrasonic sensor [11].
The accuracy of measurement is affected by many factors. Firstly, the distance between the
sensor and the obstacle must be in the range of 400cm [12]. Secondly, if the signal is reflected on a surface with a wide angle, the returned signal will not be captured by the echo port [12]. Finally, an object that is too small will not reflect the sound back to the sensor [12].
7
3.1.2 Arduino
The Arduino is an open source hardware platform that allows the programmers to write code and develop software for different purposes [11]. While there are several types and models of Arduinos, all of them can make computers more attached to the physical world by giving inputs to computers from the physical environment via sensors and different types of switches [11]. The Arduino that is used in the design of the proposed smart HVAC system is the Yun module, (see Figure 4), which has a Wi-Fi connection, USB-A port, and twenty input/output pins [14]. The Arduino Yun module is based on the chip ATmega32u4 and the processor Atheros AR9331 which can process the data coming from the input pins and send the result to the output pins in real-time [14]. Arduinos have been used in many applications due to their low cost, their capabilities of delivering a variety of inputs to the computer, and their ability to control other external devices like motors [11, 14]. There is a free IDE where programmers can develop their software and easily upload it to the Arduino and run it or synchronize the Arduino with the host computer to run the software inside the computer [11, 13]. The Arduino can be powered by the USB port or an external power source [11].