CALIFORNIA STATE UNIVERSITY, NORTHRIDGE ECG AND WEARABLE COMPUTING FOR DROWSINESS DETECTION A thesis submitted in partial fulfillment of the requirements for the degree of Master of Science in Computer Science by Nipun Gupta May 2014 The thesis of Nipun Gupta is approved: G. Michael Barnes, Ph.D Date Richard Covington, Ph.D Date Ani Nahapetian, Ph.D, Chair Date California State University, Northridge ii Dedication I would like to dedicate this thesis to my loving beautiful wife, my lovely daughter and my parents for their support during my whole academic career. iii Acknowledgements I would like to express my sincere gratitude to my supervisor, Dr. Ani Nahapetian for providing continuous support, motivation, and immense knowledge during this research study. Her guidance and advice has helped me to complete my dissertation. I would like to express the heartfelt appreciation to Prof. G. Michael Barnes and Prof. Richard Covington, for being my thesis committee members and for their help and guidance throughout the program. I would like to thank my wife Pooja for her personal support and great patience at all times. Many thanks to my daughter, Prisha, for her smiles and infectious laugh. Special thanks to my parents who have given me their unequivocal support throughout. iv Table of Contents Signature page ii Dedication iii Acknowledgements iv List of Tables vii List of Figures viii Abstract ix 1 INTRODUCTION 1 2 RELATED WORK 2.1 ECG Data Acquisition and Analysis . . . . 2.2 Wearable Physiological Monitoring Systems 2.3 Android Mobile Application Development . 2.4 Techniques for Drowsiness Detection . . . . . . . 3 3 3 4 4 . . . . . . . . . . 5 5 5 9 10 10 10 11 12 14 15 . . . . . . . . . . 18 18 20 22 22 22 23 25 26 27 27 3 4 . . . . . . . . . . . . BACKGROUND 3.1 Physiological Parameters . . . . . . . . . . . . . 3.1.1 The Electrocardiogram . . . . . . . . . . 3.1.2 Posture . . . . . . . . . . . . . . . . . . 3.1.3 Skin Temperature . . . . . . . . . . . . . 3.1.4 Breathing Rate . . . . . . . . . . . . . . 3.2 Measurement of Physiological parameters . . . . 3.2.1 ECG machines . . . . . . . . . . . . . . 3.2.2 Zephyr: Physiological Monitoring System 3.3 ECG Noise Cancellation . . . . . . . . . . . . . 3.4 Heart Rate Variability Analysis . . . . . . . . . . SYSTEM AND IMPLEMENTATION 4.1 ECG Data Acquisition and Analysis System 4.2 Driver Drowsiness Detection System . . . . 4.3 Android Platform . . . . . . . . . . . . . . 4.3.1 Android Application Development . 4.3.2 Bluetooth Data Transfer . . . . . . 4.3.3 Android Application User Interface 4.3.4 Activity Recognition . . . . . . . . 4.3.5 Application Backend . . . . . . . . 4.4 Data Analysis Platform . . . . . . . . . . . 4.4.1 Plotting ECG Device Data . . . . . v . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.5 5 6 4.4.2 HRV Analysis Tools . . . . . . . . . . . . . . . . . . . . . . Drowsiness Detection Algorithms . . . . . . . . . . . . . . . . . . . 4.5.1 Algorithm 1: Heart Rate algorithm using awake average . . . 4.5.2 Algorithm 2: Heart Rate algorithm using partial sleep average 4.5.3 Algorithm 3: Heart Rate algorithm with multiple constraints . 4.5.4 Algorithm 4: LF-HF algorithm using awake average . . . . . 4.5.5 Algorithm 5: LF-HF algorithm using partial sleep average . . 4.5.6 Algorithm 6: LF-HF algorithm using multiple constraints . . DATA ANALYSIS AND RESULTS 5.1 ECG Data Collection and Analysis . . . . . . . . 5.2 Physionet Data . . . . . . . . . . . . . . . . . . 5.2.1 CAP Sleep Database . . . . . . . . . . . 5.2.2 Stress Recognition in Automobile drivers 5.3 Results . . . . . . . . . . . . . . . . . . . . . . . 5.3.1 Results of HR Algorithms . . . . . . . . 5.3.2 Results of LF-HF Algorithms . . . . . . 5.4 Algorithm comparison . . . . . . . . . . . . . . CONCLUSION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 31 33 34 34 35 36 36 . . . . . . . . 38 38 38 40 40 42 44 44 48 56 vi List of Tables 4.1 Various detectable activities . . . . . . . . . . . . . . . . . . . . . . . . . . 26 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 5.10 Data analysis results with first HR algorithm. . . . . . . . . . Data analysis results with second HR algorithm. . . . . . . . . Data analysis results with third HR algorithm. . . . . . . . . . Case descriptions used in LF-HF result tables. . . . . . . . . . 30 second data analysis results with first LF-HF algorithm. . . 30 second data analysis results with second LF-HF algorithm. 30 second data analysis results with third LF-HF algorithm. . . 2 minute data analysis results with first LF-HF algorithm. . . . 2 minute data analysis results with second LF-HF algorithm. . 2 minute data analysis results with third LF-HF algorithm. . . vii . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 46 47 48 49 50 51 52 53 54 List of Figures 3.1 3.2 3.3 3.4 PQRST waveform in a cardiac cycle R-R interval . . . . . . . . . . . . . Heart rate calculation using the ECG Zephyr Monitoring System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1 4.2 4.3 4.4 4.5 . 7 . 8 . 9 . 13 Diagram of ECG data acquisition and analysis system . . . . . . . . . . . Android application for ECG data acquisition. . . . . . . . . . . . . . . . Diagram for driver drowsiness detection system . . . . . . . . . . . . . . Android application for drowsiness detection. . . . . . . . . . . . . . . . Use case diagram for Android app for ECG data acquisition and analysis system. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.6 Use case diagram for Android app in drowsiness detection system. . . . . 4.7 Class diagram for drowsiness detection system. . . . . . . . . . . . . . . 4.8 Kubios HRV tool. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.9 PDF report sheet showing various HRV analyses. . . . . . . . . . . . . . 4.10 Sample data from a database . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 19 20 21 . . . . . . 23 24 25 29 30 32 5.1 5.2 5.3 5.4 5.5 . . . . . 39 41 41 42 43 Zephyr device data plot in MATLAB Heart rate for normal sleeping data. Heart rate for narcolepsy data. . . . Heart rate for driver data. . . . . . . LF-HF ratio . . . . . . . . . . . . . viii . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ABSTRACT ECG AND WEARABLE COMPUTING FOR DROWSINESS DETECTION By Nipun Gupta Master of Science in Computer Science This thesis examines the challenges of using Electrocardiogram (ECG) signals in wearable computing systems, specifically in addressing drowsiness detection while driving. First, the analysis of ECG signal quality obtained from off-the-shelf wearable ECG monitors is presented. Then various approaches for extrapolating a person’s waking/sleeping state using ECG time-series data is provided, and verified against real ECG data available from the PhysioBank data archives. Finally, the wearable system incorporating an ECG monitor and a mobile application for carrying out the data analysis and computation is described. The system’s interface design is also presented, along with the approach to alerting drowsy drivers. ix Chapter 1 INTRODUCTION This thesis presents the use of portable ECG devices to monitor the heart and physical health of the subject via mobile application. The use of the application has been taken further to detect the drowsiness in a driver and activating alarm to prevent the accidents on the road. It has been shown in previous research studies that the fatigued and drowsy drivers suffer from increased reaction times which cause a large number of both non-fatal and fatal crashes during the nighttime and early morning hours. Statistics shows drowsy driving causes more than 100,000 crashes a year attributing to 40,000 injuries and 1,550 deaths [1]. Due to technology advancements over time, personal health monitoring devices and systems have gained popularity and are easily accessible to consumers. Portable ECG sensors enabled devices are deemed one of the most important among such devices. The raw data from the ECG sensors can be sent wirelessly to Bluetooth enabled devices such as phones, tablets, etc., which enables individuals to collect their own ECG data and allows both health professionals and individuals to view and monitor the data over time. In order to extract meaningful ECG signals, raw ECG device data has to be filtered and processed. ECG signal analysis consists of two phases. First is preprocessing, where noise and other impurities in raw ECG signal are removed or suppressed. Second phase is feature extraction where ECG data is analyzed and diagnostic information is obtained. 1 The upcoming option in the market are wearable ECG devices like Zephyr BioHarness, which measures ECG along with other physiological parameters like skin temperature, respiration rate, level of physical activity and posture simultaneously. This helps in monitoring overall health of the person. The thesis presents the study of wearable physiological monitoring system by gathering, processing and analyzing the physiological data from these devices. To do so, a mobile application is developed which helps in monitoring the data. If there are any abnormalities found, an alarm will be activated. The aim of second part of this project is to develop an algorithm to detect drowsiness at the wheel using the Zephyr monitoring system via mobile application. Drowsiness can be a result of lack of sleep or sleep disorder. In this study, the heart rate and sensitivity of the heart rate variability is used to distinguish between the awake and sleep/drowsy state. In previous studies, both the parameters have shown a difference between awake and sleep state. To do the study, validated data from the PhysioBank [2] is analyzed using the heart rate variability tool [3]. This thesis is organized into the following chapters. Chapter 2 describes the related work carried out by other researchers. In Chapter 3, the various physiological parameters and their measurement tools are described in detail. The analysis method for the ECG signal and its use in detecting the drowsiness is discussed. Chapter 4 elaborates on the technical aspect of the system and its implementation. It describes the mobile application development, drowsiness algorithms and analysis platforms. In Chapter 5, the results of the algorithm from the various databases are presented and compared. Last chapter provides our conclusions of this study. 2 Chapter 2 RELATED WORK Monitoring the heart activity using the ECG leads to better management of the cardiac diseases and detection of the cardiac abnormalities. It helps in prevention of the cardiac diseases if an abnormality is detected early. Loss of sleep or sleep disorders result in drowsiness which is a cause of accidents on the road. ECG and other physiological parameters can be used to help in detecting the drowsiness behind the wheel. In this chapter we describe the previous and related work done in the context of this study. 2.1 ECG Data Acquisition and Analysis There are a range of ECG machines available in the market today. The methods which are used to analyze and interpret the ECG signal are described in [4]. The ECG data acquisition and heart rate variability analysis methods [5][6] [7] using the Labview and Matlab are discussed in [8][9][10]. Recent developments in the algorithms for ECG analysis can be found in [11][12][13][14][32] and the use of Bluetooth in transferring the ECG data for telemonitoring the subject in [15][16][33][34][35]. 2.2 Wearable Physiological Monitoring Systems Wearable health monitoring devices are the leading trend in research and health indus- try. The physiological monitoring systems measures a variety of physiological parameters simultaneously and also transfer the data wirelessly [37][38][39][40]. Zephyr BioHarness2.0 [17][18][19] is used in this research work. The results from the Zephyr system 3 have been validated in [20]. More information about the Zephyr can be found at [21]. 2.3 Android Mobile Application Development Smartphones are indispensable now and can be used to monitor the health using apps [36]. Android development being an open source platform is inexpensive and provide flexibility in integrating utilities of different types [22]. It uses Java language environment to create the applications. Mobile applications can be build using the android Software Development Kit (SDK) tool [23]. 2.4 Techniques for Drowsiness Detection The development of technologies for detecting drowsiness while driving are based on the various physiological parameters such as heart rate, respiration rate, posture, rapid eye movement and head movement of the driver[24][25][26]. It has been found that heart rate variability analysis of the driver can be helpful in determining the drowsiness[27][28][29]. Recent works include Electroencephalography (EEG) of the brain[30] and image processing of the driver using PERCLOS[31]. 4 Chapter 3 BACKGROUND In this chapter, we discuss the physiological parameters used in the research work. We also describe the various machines and method to obtain the parameters. Later we discuss the Zephyr system which has been used in the research work. Lastly we discuss the ECG noise cancellation and feature extraction and heart rate variability analysis in brief. 3.1 Physiological Parameters The most important physiological parameters are the parameters obtained from heart and respiratory system. They best describe the human health state. It has been shown in previous studies that the heart rate decreases when a person falls asleep [41]. Hence for our study of drowsiness detection, the electrocardiogram plays a vital role. We describe the parameters that have been used in the research work below. 3.1.1 The Electrocardiogram The word ”electrocardiogram” is derived from the Greek word, kardia, which means heart. A normal heart beat is initiated by a small pulse of electric current which spreads rapidly in the heart and makes the heart muscle contract. An electrocardiogram (ECG) can be described as a process which records the heart activity through electrical signals generated by pacemaker cells in the heart specialized in producing electricity. These electrical signals are detected by using electrodes attached to the surface of the skin, or in the near distance from the skin using the ECG devices. The ECG signals can be used to analyze 5 heart’s health and functionality. as it picks up electrical impulses generated by the polarization and depolarization of cardiac tissue and translates into a waveform. This waveform is then used to measure the rate and regularity of heartbeats, as well as the size and position of the chambers, the presence of any damage to the heart, and the effects of drugs or devices used to regulate the heart, such as a pacemaker. Hence an ECG signal is the most powerful tool that can be used for diagnosing a heart. The first ECG devices were built in late 19th century. However, understanding the meaning of an ECG signals and analysis were developed later. A breakthrough for these measurements was the discovering of a string galvanometer by Willem Einthoven in the year 1901. Einthoven used his invention to study how a human heart works by analyzing the ECG signal. He assigned the letters to describe various deflections of an ECG signal and described the changes that a number of cardiovascular disorders cause to the ECG signal. He was awarded the Nobel Prize in Medicine in 1924 [42]. An ECG signal is a representation of heart electrical activity at different stages of the blood flow in the heart. Every cardiac cycle produces ECG waves designated as P, Q, R, S and T to represent certain phases of heart beat as shown in figure 3.1. These waveforms represent potentials between rested and depolarized or depolarized and repolarized parts of whole heart. At first, the sino-atrial (SA) node initiates a heartbeat, which creates electrical flow from the atria down to the ventricles. After producing impulse in SA-node, first wave P is recorded, which represents the depolarization of both right and left atriums. During a PR segment followed the P wave, the heart muscle does not do anything and hence the 6 Figure 3.1: PQRST waveform in a cardiac cycle ECG line returns to baseline level. Delay of depolarization in atrioventricular (AV) node recorded as PQ-interval in baseline. Then impulse spreads into middle part of septum and heart apex. This event recorded as descend part of Q wave. In next depolarization of right ventricle wall ECG line deflexed upward and formation of R wave begins. When impulse spreads into left ventricle wall, the ECG line returned in contrary side towards the lowest point of S wave. Depolarization of ventricles basis afterwards caused formation of S wave. ST segment represents the moment where ventricle muscles stay activated. The T wave depicts the repolarization of the ventricles, and the subsequent period of inactivity reflects the heart’s resting state [4]. Amplitude and duration of PQRST waves correspond to electrical power fluctuation in entire heart. An ECG signal is therefore presented by using a graph, where the y-axis represents voltage and the x-axis represents time. Any abnormalities in 7 the heart rate can be monitored by analyzing the graphs. Reader interested in more information about the diagnostic of the different pathologies and potential malfunctions of the heart and their interpretation should refer to [44, 45]. The R-R interval is referred as the interval from the peak of one QRS complex to the peak of the next in an electrocardiogram as shown in figure 3.2. The R wave is usually chosen to do this because it is the tallest and most conspicuous. In most rhythms, the R-to-R interval will be the same as the P-to-P distance, or the distance between any two analogous points on consecutive beats. Figure 3.2: R-R interval Heart rate is the number of heartbeats per unit of time which is typically expressed as beats per minute (bpm). There are different ways to measure the heart rate. It can be measured by finding the pulse of the heart. This pulse rate can be found at any point on the body where the artery’s pulsation is transmitted to the surface by pressuring it with the index and middle fingers [46]. Another method of determining heart rate is the using the R-R interval from the ECG. Inverting the R-R interval (unit in seconds) and multiplying it with 60 give the number of 8 heart beats per minute. The whole ECG can be used to determine the heart rate too. The number of PQRS waves is counted for 10 seconds and multiplying it with 6 can give the heart rate as shown in figure 3.3. The heart rate varies from person to person. A normal resting heart rate is about 72 bpm. There are many abnormalities of heart rate which can be monitored by an ECG such as Arrhythmia, Bradycardia, Tachycardia, etc.[46]. Figure 3.3: Heart rate calculation using the ECG 3.1.2 Posture Good posture is an easy and very important way to maintain a healthy mind and body. While driving a good sitting posture is recommended for more practical safety concerns. To measure the posture, inclinometers can be used. The orientation of a body segment has three degrees of freedom. Two of the three degrees of freedom in orientation can be measured by inclinometers [47]. In a study it has been found that head movements can be a used as an indicator of sleepiness. When a person is sleep-deprived or fatigued, the head movement is more and head movements are more extreme compared to a person who has rested [48][49]. 9 3.1.3 Skin Temperature Skin temperature is an important vital sign for health. Normal body temperature depends upon the place in the body at which the measurement is made, and the time of day and level of activity of the person [50]. Temperature regulation in humans follows a circadian rhythm. Normally, body core temperature is decreasing with the sleep and when the person is awake, temperature is increasing [51][52]. But, the problem is that the temperature variations can only be detected in controlled laboratory environment. Outside, the temperature variations occurring from the environment factor are similar to the variations detected. There is no evidence of skin temperature change in awake to drowsiness state. Less intrusive skin temperature measurement is the less reliable than measurement of the body core temperature taken with standard invasive (rectal or intravenous probes) methods. 3.1.4 Breathing Rate The breathing rate is the number of breaths a person takes per minute by counting how many times the chest rises. Normal respiration rates for an adult person at rest range from 12 to 16 breaths per minute [53]. It has been found that the breathing frequency is lower at sleep onset [54]. Regulation of respiration is closely linked to the sleep onset. Hence, the sleep disorders can be detected by monitoring the breathing rate. The respiration rate can help in detecting the drowsiness while driving in a controlled experiment [55]. 3.2 Measurement of Physiological parameters The physiological parameters can be measured by various methods. The heart rate can be measured by pulse. But to measure it accurately, ECG machines are used. The breathing 10 rate can be measured counting the breaths by stethoscope or by pressure sensors which measures the rise and fall of the chest cavity. The skin temperature can be measured by an infrared thermometer. In this section, we discuss the types of ECG machines available and the smart monitoring system: Zephyr which can measure all the parameters simultaneously. 3.2.1 ECG machines There are different types of ECG machines available to check for cardiac abnormalities. These machines differ in the extent of data capture, the data recorded, their mobility, and their featured applications. The extent of data capture depends upon the number of leads present in the ECG machines, in other words, the number of electrical signals can be monitored at a time. 3.2.1.1 Traditional ECG machines The 12-lead ECG is the standard ECG machine which is used for medical diagnostic testing for chest pain, fainting or seizures. It has 10 electrodes, six are placed on the chest and four are placed on each of the limbs which provide a printed record of the ECG. They are used to diagnose heart attacks and heart murmurs. There are two types of electrode: wet gel and dry electrode. Wet gel electrodes provide maximum skin contact and reduce skin impedance which helps in avoiding baseline drift and provide a fast and accurate ECG trace. However, dry electrodes are skin-friendly and minimize epidermal reactions and easy to remove without hurting sensitive skin and allows some electrode types to be repositioned. The other type of traditional ECG machine is 5-lead ECG machine which uses 5 electrodes. It is usually used for continuous monitoring, like during a major surgical procedure 11 or while a patient is being transported in an ambulance. A 3-lead ECG machine uses 4 electrodes placed on each of the limbs, which is enough to produce adequate data on heart rhythm monitoring. 3.2.1.2 Portable Handheld ECG Monitors The portable handheld ECG monitors are the single channel and smallest ECG monitors which are designed for patient home use or professional doing routine check use. They are not a powerful diagnostic tool as multi-channel ECG machine but they can record and display critical data. They are portable, inexpensive and easy to use which is helpful in improving heart disease management. 3.2.1.3 Wireless ECG Wireless ECGs are similar to a standard ECG machine, but without the wires. The electrodes have wireless units that transmit data to the computer or telemetry station. A wireless ECG is less intrusive and provides more functionality and comfort for patients as caregivers and their patients can get total freedom from lead wires, enabling focus on patient care, not on wire management and false alarms. In addition, patients can move about more freely and ambulate more easily. 3.2.2 Zephyr: Physiological Monitoring System The physiological monitoring systems which are portable, wireless and transfer data via Bluetooth and Wi-Fi are quite upcoming and very popular. Along with the ECG readings of the person, they can provide the breathing rate, skin temperature, posture, heart 12 rate which can help tremendously in studying and continuous monitoring the physiological parameters of the person without being intrusive. The Zephyr BioHarness [17] is one such system. The Zephyr BioHarness consists of a chest strap and the BioHarness module as shown in figure 3.4. This system helps in remote monitoring of the patients, sports training, physiology and exercise physiology research, wireless monitoring of first responders. Figure 3.4: Zephyr Monitoring System The BioHarness strap is a lightweight elasticized component which incorporates Zephyr Smart Fabric ECG and Breathing Rate sensors which is worn by the subject [18]. Attached to the strap is the BioHarness Module. The module contains a temperature sensor and a 3-axis accelerometer for monitoring posture and activity. It captures and analyses sensor data from the strap and then records or transmits this data to a remote location. Before transmitting the data, the raw data is filtered, processed and analyzed within the device. It can operate in various modes which are software configurable [19]. It can transmit the live data in short range via Bluetooth and can be received by a Bluetooth receiver on a device. It can also transmit and display the data on a mobile application using Bluetooth. The data can be transmitted to remote location via long haul radio link. Also, subject and wear and record it and then download it using the USB charging cradle. 13 More information about the data transmission can be found in the documents mentioned in reference [21]. The Bioharness (2.0) module has a memory of up to 570 hours and battery life of up to 24 hours in logging mode. The five physiological parameters are simultaneously measured. The ECG data is captured through electrode sensors housed within the chest strap sampled at 250 Hz and heart rate is calculated by detecting the R waveforms. It can measure heart rate from 25 BPM to 240 BPM. The breathing rate is provided using a capacitive pressure sensor that detects circumference expansion and contraction of the torso. The breathing rate ranges from 3 - 70 breaths per minute. To measure the level of activity it uses three axis acceleration measurements, using piezoelectric technology. Acceleration data is measured in gravitational force(g) and ranges from -16g to +16g. The posture is measured using the same technology acting as an inclinometer. The device monitors how far the device is “off the vertical” and reports the data is in angular degrees(◦ ), ranges between -180◦ and +180◦ . Lastly, the skin temperature is measured at inferior sternum by an infrared sensitive sensor behind a clear window on the apex of the monitoring device. The data is reported in degrees Celsius (◦ C) and ranges from 10-60 ◦ C[19] [20]. 3.3 ECG Noise Cancellation The normal unamplified ECG signal has of very low amplitude and low signal to noise ratio. But there are many factors which affect the ECG signal quality. Human factors such as breath, lung or bowel sounds, and any muscle activity can contaminate the signal. Measuring equipment factors such as motion artifact in the ECG, variation of electrode 14 skin contact impedance, 50-60 Hz power-line interference, baseline wander and noise from electronic devices are another cause. Electrical interference from external environment may increase interfering signals [6][7]. The primary aim is to remove low frequency noise such as baseline drift, powerline interference which could result in false positives at the QRS detection stage. Usually the ECG signal acquisition hardware can remove the power line interference using the band pass filter. Baseline wandering comes at frequencies wandering between 0.15 and 0.3 Hz which can be suppressed by using highpass digital filter. To get the most of the QRS complex, a passband can be set to approximately 5-30 Hz. After removing the baseline wandering, the resulting ECG signal is more stationary and explicit than the original signal but some other types of noise might still affect feature extraction of the ECG signal. To remove the wideband noises the wavelet transform method is used. In addition, the non-linear transformation such as signal amplitude squaring may also reduces the noise. Using the decision rule algorithms such as adaptive thresholds and T-wave discrimination techniques filters the QRS signal further [7][8][58]. After noise filtering, the various features such as QRS intervals, QRS amplitudes, PR intervals, QT intervals are extracted. They provide information about the heart rate and the condition of the heart. 3.4 Heart Rate Variability Analysis Heart rate variability (HRV) is defined as the beat to beat variation in the heart rhythm. HRV can be measured with the variation of RR intervals exhibited in a sequence of ECG sample. The sinus rhythm time series is derived from the RR interval by extracting only 15 normal sinus to normal sinus (NN) interbeat intervals. Relatively high frequency variations in sinus rhythm are associated with the parasympathetic (vagal) modulation, and low frequency variations are associated with a combination of both parasympathetic and sympathetic modulation and non-autonomic factors [5][24]. The high frequency component ranges from 0.15 to 0.4 Hz and low frequency component ranges from 0.04-0.15 Hz [5]. For HRV analysis, the measures are usually divided into two categories: time domain and frequency domain [10]. Geometric method and non-linear methods [5][56] are not discussed here. The time-domain methods are the simplest to perform since they are applied straight to the series of successive RR interval values to give variables such as: SDNN, the standard deviation of NN intervals; RMSSD, the root mean square of successive differences; SDSD, the standard deviation of successive differences; NN50, the number of pairs of successive NNs differ by more than 50 ms; pNN50, the proportion of NN50 divided by total number of NNs; similarly NN20 & pNN20 [10][56]. In the frequency-domain methods, the RR interval series is converted to an equidistantly sampled series and then a power spectrum density (PSD) estimate is calculated. In HRV analysis, the PSD estimation is usually carried out using Fast-Fourier Transformation (FFT) based methods [58]. The PSD is divided into frequency bands: the very low frequency (VLF, 0-0.04 Hz), low frequency (LF, 0.04-0.15 Hz), and high frequency (HF, 0.15-0.4 Hz). For each frequency band, the absolute and relative powers of VLF, LF, and HF bands, LF and HF band powers in normalized units, the LF/HF power ratio, and peak frequencies are calculated. The ratio of LF to HF power is often used as a metric of sympatheticparasympathetic balance. 16 In previous studies, HRV analysis has shown a difference between waking and sleep stages [25][27]. It has been found LF/HF ratio decreases when a person becomes sleepy and hence can be an effective method for the detection of driver drowsiness [24][26][28][29]. 17 Chapter 4 SYSTEM AND IMPLEMENTATION In this chapter, we define systems which use the information on various physiological parameters. The first system is “Data Acquisition and Analysis System” which is useful in health monitoring and can be extended as continuous health monitoring system. The second system would determine if a person (mainly driver) is fatigued or drowsy. The heart rate is one of the most popular and accurate parameter to determine drowsiness. It has been described in detail in the previous chapter. 4.1 ECG Data Acquisition and Analysis System In order to completely understand all aspects of ECG, a system is designed and devel- oped where data is acquired from an individual who is wearing an ECG device. This data could essentially be filtered and used to extract ECG features which help in analyzing heart functionality and arrhythmia. Figure 4.1: Diagram of ECG data acquisition and analysis system Figure 4.1 shows the diagram of an ECG data acquisition and analysis system. This sys- 18 tem consists of a wearable Bluetooth ECG device, an Android application for data acquisition and an analysis platform which often is a computer. The ECG sensor device collects and digitizes the analog ECG signal. The data is transmitted by a Bluetooth module. The android application establishes a Bluetooth connection with the device. The application then collects and displays the transmitted data. Figure 4.2: Android application for ECG data acquisition. Figure 4.2 shows the android application for ECG data acquisition. The application contains a drop down list for activity which could be Low, Medium, High or Auto, selected by the user. The application writes data chunks to a text file in local storage according the activity and date. At the bottom of the application, current status for device connectivity is shown. Once the user stops the data acquisition, the ECG data is transferred to a computer via ftp or other means for further analysis. There are a number of frameworks like LabVIEW and MATLAB which are very flexible and provide a variety of toolkits for extensive signal processing and data analysis, such as Simulink library for MATLAB and 19 NI LabVIEW biomedical toolkit. 4.2 Driver Drowsiness Detection System Various studies as mentioned in section 2.4, suggest that variety of physiological pa- rameters can be used to determine driver drowsiness. Many of such physiological parameters are mentioned in section 3.1. Modern portable and wearable devices simultaneously measure and provide many of these parameters. Zephyr Bioharness 2.0 is one such ECG device, which is used in the development of this system. Figure 4.3: Diagram for driver drowsiness detection system Figure 4.3 shows the diagram for driver drowsiness detection system. This system is quite similar to the first system as far as the ECG data acquisition is concerned. The android application for ECG data acquisition is extended to obtain additional parameters such as posture, worn status, skin temperature, Respiration rate, RR interval and Heart Rate and detect drowsiness. This android application is shown in figure 4.4. These parameters except for the RR intervals and ECG data are displayed on the screen if the device is on and worn, as shown by the “Worn Status:” on the application. The focus of this system is to analyze the heart rate and posture changes in addition to acquiring ECG and RR interval data. However as discussed in the previous chapters that physiological 20 Figure 4.4: Android application for drowsiness detection. parameters such as skin temperature, breathing rate, rapid eye movement, EEG can also be used to detect drowsiness. This could potentially strengthen the detection system if used in conjunction with currently used parameters. The system is enabled as soon as the user presses the “Start” button in the application. Current activity is automatically detected and displayed on the screen. The system allows user to enable or disable the alerts while driving. If alerts are enabled and the user is driving, the system activates one or both drowsiness detection algorithm mention in section below. If driver’s drowsiness is detected, system activates audio, visual and vibration alerts. These alerts continue unless user presses the “Stop Alert” button from the application. Finally, the user may press the “Stop” button to disable the system. 21 4.3 Android Platform The system makes use of Android platform, which contribute to the system either as a gateway or core processing platform. Handheld devices have become sophisticated devices with various sensors and offers extensive processing power. The application is developed on Samsung Galaxy Note II, which is a mobile phone device. A mobile device is ideal for systems such as these, since most of people carry one at all times. There are few other platforms available for use. Android platform is selected because it has well developed libraries and development support available, and more importantly it is an ideal platform for mobile development for existing Java developers as it is based on Java. 4.3.1 Android Application Development The Android SDK is used to develop the android application. The SDK provides API libraries and developer tools necessary to design, build, test and debug apps for Android. The SDK bundle provides Eclipse with ADT (Android Developer Tools) to streamline the development, Android SDK Tools to install and uninstall packages, Android Platformtools, latest Android platform and latest Android system image for the emulator. The latest Android platform, 4.4, is used for this application because it provides all the latest libraries like google play services etc. 4.3.2 Bluetooth Data Transfer Zephyr Bioharness device uses a Bluetooth connection to send data to other devices. The Bluetooth communication has been encapsulated in the android API and no developer intervention is required. The android application utilizes the android API to enable the 22 device to transmit different data packets. The data packets are the ECG Data packet, the R-R data packet and the general data packet. 4.3.3 Android Application User Interface For ECG data acquisition and analysis system, an android app with very simple interface is developed. With this app, the user selects the activity and press “Start” button to connect to the device and start getting ECG data. User can then select “Stop” button to stop gathering ECG data and close the connection. The connection and activity status are displayed at the bottom of the application. The figure 4.5 shows the use case diagram for android application for the ECG data acquistion and analysis system. Figure 4.5: Use case diagram for Android app for ECG data acquisition and analysis system. For driver drowsiness detection system, the use case diagram is shown in figure 4.6. 23 In addition to the features of above system, the application has “Enable Alert” checkbox, “Stop Alert” button to stop and reset the alarms, and display of “Current Activity” using google play services for activity recognition, “Worn Status”, “Posture”, “Heart Rate”, “Respiration Rate” and “Skin Temperature”. RR interval data packets are stored behind the scenes along with ECG data. Figure 4.6: Use case diagram for Android app in drowsiness detection system. 24 4.3.4 Activity Recognition There are many ways to determine user’s activity. First and the easiest way is simply depends on user’s input to the application. A user can select “High”, “Medium” or “Low” for high activities like running, medium activities like walking and low activities like sitting or lying down respectively. Second option is through the ECG device like Zephyr Bioharness, which can identify if the user is stationary, walking or running using the built in accelerometer. Third and perhaps most useful is activity recognition using google play services, shown in the class diagram in figure 4.7. Figure 4.7: Class diagram for drowsiness detection system. Activity recognition client in Google play services tries to detect the user’s current physical activity, such as walking, driving, or standing still by processing the update requests which uses a similar pattern as location client used by location or geofencing. Based on selected interval, location services sends out activity updates containing one or more possible 25 Activity IN VEHICLE ON BICYCLE ON FOOT STILL TILTING UNKNOWN Description The device is in a vehicle, such as a car. The device is on a bicycle. The device is on a user who is walking or running. The device is still (not moving) The device angle relative to gravity changed significantly. Unable to detect current activity. Table 4.1: Various detectable activities activities and confidence level for each activity. Activities supported by DetectedActivity are listed in the table 4.1. The system checks if the confidence level is more than 50 and activity is “IN VEHICLE” and uses this information to enable drowsiness detection. 4.3.5 Application Backend The main activity class for this android application is SensorActivity which extends Activity and implements OnItemSelectedListener to listen to selections and GooglePlayServicesClient.ConnectionCallbacks and GooglePlayServicesClient.OnConnectionFailedListener to request activity recognition. At the launch of the application, a message to the android device is sent indicating that the application will initiate the pairing request. Objects of BTBondReciever and BTBroadcastReceiver, both extend BroadcastReceiver, are created and registered with the main activity of android application. BTBroadcastReceiver indicates the pairing request event while BTBondReceiver indicates that the state has changed to paired. Once the “Start” button is pressed, the communication thread gets created which handles all the communication between the android and ECG device. NewConnectedListener extends ConnectListenerImpl and override connected() method where ZephyrProtocol ob- 26 ject is created and a new ZephyrPacketListener is attached to it. ReceivedPacket() method retrieves and processes the enabled data packets. A handler is created in SensorActivity class to retreive and processes the messages from Zephyr API. ActivityRecognitionService extends IntentService and receives ActivityRecognition updates. It receives updates in the background, even if the main activity is not visible. Util, FixedHRQueue and FixedResultQueue are the supporting classes for algorithm and application to run. 4.4 Data Analysis Platform A computer is used as an analysis platform for the systems. Commercial and non- commercial frameworks and tools like MATLAB and Kubios HRV, respectively, are used for data representation and analysis. 4.4.1 Plotting ECG Device Data Before starting the analysis, it is important to understand and plot bulky signals such as ECG. ECG signals are usually sampled with high frequency (i.e. 250 Hz, 500 Hz and 1000 Hz) and thus have lot of data points. A MATLAB script “ECG Plot.m” is created, which takes the ECG data file created by android application and transferred over ftp connection and plot the graph. Zephyr Bioharness ECG device samples at frequency 250 Hz and data ranges from 0 to 1024. The ADC resolution for ECG sensor is 10 bits. Time as x-axis is calculated using sample rate 250 Hz with following calculation: time = transpose(0 : 1/F s ECG : length(Actual ECG Data)/F s ECG−1/F s ECG) 27 The ADC resolution is used to normalize the data and create a signed signal using following calculation: Actual ECG Data Signed = (Actual ECG Data−(2ˆ(ADC Resolution−1)))∗(−1) Together this information is used to plot the graphs using plot command as shown below: plot(time, Actual ECG Data Signed); The graphs involving various activities are shown in chapter 5. 4.4.2 HRV Analysis Tools HRV analysis, as described in chapter 3, is proven and effective technique in analyzing the ECG data. An HRV tool is used to determine the LF-HF ratio from ECG signal. There are various open source HRV analysis tools available. One of such tool is Kubios HRV created by Biosignal Analysis and Medical Group at University of Eastern Finland. It is an advance tool to study individual’s heart beat variability. It offers wide variety of various analysis options with easy to use interface, which makes it suitable for researchers and clinical studies [3]. The tool is compatible with various file formats such as ASCII ECG and RR data, EDF (European Data Format), GDF (General Data Format), Custom ECG and RR data etc. Physionet database is used in the project, which outputs the file in EDF and Custom ECG data format and can be used in this software. ECG data is preprocessed and RR interval is 28 determined using QRS detection algorithm. Tools for RR interval artifact correction such as interpolation are also available. Versatile analysis option such as time-domain (mean/STD of RR intervals, RMSSD, pNN50, etc.) and frequency-domain (VLF, LF, and HF band powers and peak frequencies) are available. In the frequency-domain analysis the power spectrum is calculated which is then used to calculate LF/HF ratios [3]. For FFT spectrum Welch’s periodogram method and for AR spectrum, autoregressive modeling based method is used [58]. In addition to these most common options, several nonlinear methods such as Poincare plot, approximate/sample entropy, de-trended fluctuation analysis (DFA), recurrence plot analysis, and correlation dimension are also available [3]. A screenshot is shown in the figure 4.8. Figure 4.8: Kubios HRV tool. The detailed report sheets can be printed or saved in Portable Document Format (PDF) one sample per page, and as an ASCII text file and MATLAB .mat file [3]. An example of report sheet is shown in the figure 4.9. 29 n11.edf − 29.11.07 − 22.36.46 HRV Analysis Results Page 1/1 Results for a single sample RR Interval Time Series 00:05:03 00:00:00 Detrending method: none RR (s) 1.1 1 0.9 0.8 00:00:00 00:01:40 00:03:20 00:05:00 00:06:40 00:08:20 00:10:00 00:11:40 00:13:20 Selected RR Series RR (s) 1.1 1 0.9 0.8 00:00:00 00:00:50 00:01:40 00:02:30 00:03:20 00:04:10 00:05:00 Time (h:min:s) Distributions* Time−Domain Results Variable Mean RR* STD RR (SDNN) Mean HR* STD HR RMSSD NN50 pNN50 RR triangular index TINN Units Value (ms) (ms) (1/min) (1/min) (ms) (count) (%) 949.6 62.3 63.47 4.41 50.4 88 27.8 13.250 200.0 (ms) 0.8 0.9 1 1.1 55 60 65 RR (s) 70 75 80 HR (beats/min) Frequency−Domain Results FFT spectrum (Welch’s periodogram: 256 s window with 50% overlap) AR Spectrum (AR model order = 16, not factorized ) 0.15 EDR=0.19 Hz PSD (s2/Hz) PSD (s2/Hz) 0.15 0.1 0.05 0.1 0.05 0 0 0 0.1 0.2 0.3 0.4 0.5 0 0.1 0.2 Frequency (Hz) VLF (0−0.04 Hz) LF (0.04−0.15 Hz) HF (0.15−0.4 Hz) Total LF/HF Peak (Hz) Power (ms2) Power (%) Power (n.u.) 0.0234 0.0508 0.3086 2023 1045 1105 4175 0.945 48.5 25.0 26.5 48.6 51.4 Nonlinear Results 0.4 0.5 VLF (0−0.04 Hz) LF (0.04−0.15 Hz) HF (0.15−0.4 Hz) Total LF/HF Peak (Hz) Power (ms2) Power (%) Power (n.u.) 0.0039 0.0430 0.3242 1465 1151 842 3459 1.366 42.4 33.3 24.3 57.7 42.2 Poincare Plot Units Poincare plot SD1 (ms) SD2 (ms) Recurrence plot Mean line length (Lmean) (beats) Max line length (Lmax) (beats) (%) Recurrence rate (REC) (%) Determinism (DET) Shannon Entropy (ShanEn) Other Approximate entropy (ApEn) Sample entropy (SampEn) Detrended fluctuations (DFA): α1 Detrended fluctuations (DFA): α2 Correlation dimension (D2) Detrended fluctuations (DFA) Value 1100 10.96 83 35.18 98.08 3.189 1.102 1.586 0.981 0.899 3.708 α2 −0.6 SD2 SD1 35.7 80.5 −0.8 RRn+1 (ms) Variable Frequency Band 1000 log10 F(n) Frequency Band 0.3 Frequency (Hz) 900 −1 −1.2 α1 −1.4 800 −1.6 800 900 1000 RRn (ms) 1100 0.6 0.8 1 1.2 1.4 1.6 1.8 log10 n (beats) *Results are calculated from the non−detrended selected RR series. Kubios HRV, version 2.1 Department of Applied Physics University of Eastern Finland, Kuopio, Finland 04−Apr−2014 14:47:23 Nipun Gupta CS, CSUN Figure 4.9: PDF report sheet showing various HRV analyses. 30 4.5 Drowsiness Detection Algorithms For data analysis and computation, algorithms are developed which make use of the physiological parameters provided by the monitoring device mentioned in chapter 3. These algorithms are developed by analyzing various datasets from physionet. These datasets are explained in chapter 5 on data analysis and results. First set of algorithms uses heart rate to detect drowsiness. Android application can obtain heart rate by three methods from the ECG device. First method simply reads the value from device ranging between 25 and 240 Beats per Minute (BPM). Second method uses RR intervals provided by the device with minimum of 250 milliseconds (ms) apart. A reciprocal of the intervals are calculated and result is multiplied by 60 to get the heart rate in beats per minute. Third and last method is using ECG signal, where RR intervals are detected by preprocessing ECG signal using QRS complex detection techniques. These RR intervals go through the same calculations as in second method in order to get heart rate in beats per minute. Sample data used in heart rate algorithm is shown in figure 4.10 (a). Another set of algorithms is developed which analyzes ECG data using LF-HF ratio. Heart rate variance (HRV) is performed using frequency domain method to determine LFHF ratio. HRV analysis is based on the RR intervals. Some ECG devices provide RR intervals like the one used for this project and others provides only ECG signal. RR intervals can be calculated from ECG signal if not provided by the device. RR intervals time series are non-uniform which is not suitable for the Frequency-domain analysis. The 31 (a) HR algorithm sample data. (b) LF-HF algorithm sample data. Figure 4.10: Sample data from a database 32 given time series is resampled and uniform time series is constructed, this process is called interpolation [57]. After interpolation, regular frequency domain analysis method can be applied where a power spectrum density (PSD) estimate is calculated for RR interval time series. In HRV, the PSD is generally estimated using fast Fourier transformation (FFT) based method. One of the important advantages of using FFT method over other available ones is simplicity of implementation. FFT algorithm is written and freely available in many language libraries. An absolute power value for each frequency band is obtained by simply integrating the FFT spectrum over the band limits [58]. LF and HF power values are used to calculate the LF-HF ratio. Sample data used in LF-HF algorithm is shown in figure 4.10(b). 4.5.1 Algorithm 1: Heart Rate algorithm using awake average The first HR algorithm used for data analysis uses average heart rate from awake section of the dataset. Three threshold values are then calculated using threshold percentage values i.e. 95%, 90% and 85%. When the reported heart rate goes below this threshold set value, the algorithm consider it as drowsy/sleep state. The pseudocode for this algorithm is described in the following sub section. 4.5.1.1 Pseudocode for Algorithm 1 1: Define percentage value to be used 2: Read available awake data 3: Calculate average of awake data 4: Calculate threshold value using average and percentage value 5: If (reported heart rate value < threshold set value) { Activate Alarm } 33 4.5.2 Algorithm 2: Heart Rate algorithm using partial sleep average This algorithm unlike previous one uses the average of highest 10 heart rate values from sleep section of dataset. Three threshold values are calculating and drowsiness is detected in similar way as first algorithm. It is a learning algorithm which monitors subject’s sleep in order to determine the threshold. The pseudocode for this algorithm is described in the following sub section. 4.5.2.1 Pseudocode for Algorithm 2 1: Define percentage value to be used 2: Read available sleep data 3: Calculate average of highest 10 data samples 4: Calculate threshold value using average and percentage value 5: If (reported heart rate value < threshold set value) { Activate Alarm } 4.5.3 Algorithm 3: Heart Rate algorithm with multiple constraints For this algorithm, when the driver starts driving, a unique heart rate is calculated by taking average of heart rate values obtained over the period of sixty seconds or one minute. This unique heart rate is different for every driver. A threshold value is then determined using the calculated average heart rate. System tracks last six heart rate values along with last five changes in values i.e. +1 for and an increase and -1 for a decrease. Then an average of last six values is calculated. If the calculated average is less than or equal to threshold value, the algorithm progresses to next step where last five changes are analyzed to determine if heart rate values have decreasing trend (i.e. if decreasing value is more than increasing value of heart rate). If decreasing trend is detected, system will activate the 34 alarm. Six heart rate values were selected because we would want to check for drowsiness more frequently (i.e. every six seconds) and also six recorded values provide five differences, so we do not need to handle a tie i.e. equal number of increases and decreases (e.g. +3 and -3). Similar algorithm can be employed for other parameters the device has offers, to potentially strengthen the overall outcome of the system. The pseudocode for this algorithm is shown in the following sub-section. 4.5.3.1 Pseudocode for Algorithm 3 1: Calculate threshold using average HR for first 60 seconds 2: Store and track last 6 heart rate (HR) values 3: Track last 5 changes // +1 - increase and -1 - decrease 4: Calculate an average of last 6 HR values 5: If(Average of last 6 value is <= Threshold value) { // -1 are more than +1. No ties due to 5 values If( change from step 3 has decreasing trend) { Activate Alarm } } 4.5.4 Algorithm 4: LF-HF algorithm using awake average This algorithm is very similar to the first HR algorithm. Instead of heart rate this algorithm uses LF-HF ratio for threshold value calculations. The pseudocode for this algorithm is shown in the following sub-section. 35 4.5.4.1 Pseudocode for Algorithm 4 1: Define percentage value to be used 2: Read available awake data 3: Calculate average of awake data 4: Calculate threshold value using average and percentage value 5: If (LF-HF < threshold set value) { Activate Alarm } 4.5.5 Algorithm 5: LF-HF algorithm using partial sleep average This algorithm is very similar to the second HR algorithm and uses LF-HF ratio instead of heart rate. The pseudocode for this algorithm is shown in the following sub-section. 4.5.5.1 Pseudocode for Algorithm 5 1: Define percentage value to be used 2: Read available sleep data 3: Calculate average of highest 10 data samples 4: Calculate threshold value using average and percentage value 5: If (LF-HF ratio < threshold set value) { Activate Alarm } 4.5.6 Algorithm 6: LF-HF algorithm using multiple constraints This algorithm has somewhat similar structure to the third HR algorithm. Instead of heart rate this algorithm uses LF-HF ratio to detect drowsiness. The algorithm uses the threshold calculated by the average of first few LF-HF ratios. A percent change between LF-HF ratio of awake stage and sleep stage is determined. Then if current LF-HF ratio is less than or equal to threshold ratio and if current ratio is less than previous ratio, the 36 algorithm checks if the percent change between the two ratios is more than or equal to previously calculated percent change threshold value. If all conditions satisfy system activates the alarm. The pseudocode for this algorithm is shown in the following sub-section. 4.5.6.1 Pseudocode for Algorithm 6 1: Calculate a threshold value using first few LF-HF ratios 2: Get % change threshold by analyzing awake and sleep data 3: If (current_LF-HF_Ratio <= threshold ratio) { If( current_LF-HF_Ratio < previous_LF-HF_Ratio) { //checking variance range If(% change between two LF-HF ratio >= % change threshold) { Activate Alarm } } } 37 Chapter 5 DATA ANALYSIS AND RESULTS In this chapter the results of the data analysis are presented. There are two aspects of this project. The first part is ECG data collection and its analysis, the second part consists of analyzing existing annotated data to construct a system with drowsiness detection algorithm. This chapter represents necessary information to cover both aspects. 5.1 ECG Data Collection and Analysis Figure 5.1 shows the data collected from the zephyr monitoring device which is ana- lyzed using MATLAB. Images on the left side show complete set of captured data while the ones on the right show zoomed-in images showing PQRS complex as described in chapter 3. As mentioned in chapter 3, that various types of noises are present in the collected ECG signal which can be filtered out. After analyzing the data, it turned out that the data contains minimal noise and no further noise cancellation is required. 5.2 Physionet Data In addition to the collected data, the analysis is performed on annotated data from databases available at PhysioNet website. PhysioNet offers large collections of recorded physiologic signals called PhysioBank, freely available on their website [10]. Along with data PhysioNet offers related open-source software called PhysioTookit which can be used 38 (a) Low activity. (b) Low activity showing RR intervals. (c) Medium activity. (d) Medium activity showing RR intervals. (e) High activity. (f) High activity showing RR intervals. Figure 5.1: Zephyr device data plot in MATLAB 39 for data analysis such as HRV analysis[10]. We have used two multi-parameter databases from this site which are described in the sections below. Multi-parameter database is selected so that parameters other than ECG could potentially be used in future. 5.2.1 CAP Sleep Database The first database used is Cyclic Alternating Pattern (CAP) sleep database. Each record in the database includes three or more EEG signals together with EOG, EMG, airflow, respiratory effort, ECG signals, and reference sleep stage along with CAP annotations. This database provides a useful number of carefully annotated examples of CAP in a representative variety of pathophysiologic contexts, for research and advanced studies [59]. The database offers various records depending on subject’s pathology, out of which “No pathology” and “Narcolepsy” records were selected for the study. One record from each type of recording has been represented in figure 5.2 and 5.3. The graphs are color coded according to the sleep stages and awakening. Per literature, sleep is mainly divided into two types: REM (Rapid eye movement) and NREM (non-rapid eye movement) [61]. NREM is further divided into four stages S1, S2, S3 and S4, which are shown in the graph above along with REM and awake stage represented by “W”. The database shows that the sleep proceeds in cycles i.e. “W” and any combination of S1-S4 and REM, depending on the individual. 5.2.2 Stress Recognition in Automobile drivers This database has been created and contributed to PhysioNet by Michigan Institute of Technology. Multiple physiological parameters, including ECG, have been recorded from 40 Figure 5.2: Heart rate for normal sleeping data. Figure 5.3: Heart rate for narcolepsy data. 41 Figure 5.4: Heart rate for driver data. healthy volunteers driving on a predefined route including streets and highways in and around Boston and Massachusetts [60]. The objective of the study has been to investigate the feasibility of automated stress recognition based on multiple physiological parameters. Each record in the database is a complete experiment and is about 65 to 93 minutes in length. Figure 5.4 shows the heart rate (calculated from ECG data) graph created for one of the driver record. 5.3 Results The algorithms described in chapter 4 are simulated on the records from both databases mentioned above. The datasets used from CAP sleep database are n1, n3, n4, n7, n8, n9, n10, n11, n13, n14, n15 from normal or no pathology records and narco2, narco4, narco5 from narcolepsy records and the datasets used from stress database is drive. The second and fifth algorithms are not applicable on the driver database since these algorithms are based on sleep data. While analyzing the awake and sleep data from various datasets, it is 42 Figure 5.5: LF-HF ratio observed that the difference between their averages ranges from 5 percent to 15 percent. This information is utilized in the analysis by using the threshold percentages i.e. 95%, 90% and 85%. If the heart rate value is lower than the threshold the person is considered to be sleepy/drowsy. Similarly, as shown in figure 5.5, a downward trend is seen in LF-HF ratio when a person transitions to sleep from awake state. Thus, the LF-HF ratio may be suitable in detecting driver drowsiness. The results of analysis using the algorithms mentioned in chapter 4 are shown in various tables below. The first column shows the datasets used from two databases. Second and third columns show the number of data points used from awake and sleep data respectively. Fourth column shows the threshold percentages. Next two columns show the final results in percentage. False positive means that the subject is awake but system detects it as asleep 43 and thus activates the alarm. False negative means that the subject is asleep but the system detects it as awake and no alarm is activated. These results can be used to determine true positive and true negative as well. True positive means that the subject is asleep and the system detects it and alarm is activated. True negative means the subject is awake and system detects it and no alarm is activated. True positive and false negative does not apply to the driver database, hence marked “n/a” for not applicable in the respective cells. 5.3.1 Results of HR Algorithms This section shows the results of the HR algorithms. The results are shown in the tables 5.1, 5.2and 5.3 for first, second and third algorithms respectively. In table 5.1, it can be seen that as the threshold percentage is reduced from 95% to 85%, the number of false negatives increase while the number of false positives decrease. Relaxing the threshold percentage increases the number of points passing the awake criteria. Therefore, the rise in the false negative and fall in the false positive is seen. The same trend is seen in the table 5.2 and the results for the false negatives improve tremendously as the second algorithm is based on sleep data. In table 5.3, the results show that the third HR algorithm performs well in the case of false positives. 5.3.2 Results of LF-HF Algorithms This section shows the results of LF-HF algorithms. The results are shown in the tables 5.5 - 5.10. The results are placed in two set of tables: First set contains the results of thirty seconds interval LF-HF samples and second two minutes interval LF-HF samples. The table structure for first two LF-HF algorithms is same as of HR algorithms. However 44 Dataset Awake Data Points Sleep Data Points Average n1 451 4619 85 n3 284 1205 72 n4 6076 1854 87 n7 1152 2221 71 n8 2534 3465 73 n9 829 3153 62 n10 2621 1608 84 n11 754 4760 79 n13 614 785 68 n14 310 3422 78 n15 1020 1521 79 narco2 1631 1433 73 narco4 1322 2997 84 narco5 669 3153 86 drive 5156 0 62 Threshold Percentage (%) 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 False +ve % 51 30 3 31 9 1 58 52 45 38 22 9 51 33 2 46 17 4 39 15 3 53 44 31 39 26 21 38 5 0 64 55 43 35 14 1 57 46 27 49 43 39 26 10 2 Table 5.1: Data analysis results with first HR algorithm. 45 False -ve % 3 34 98 39 70 95 43 52 59 37 68 85 44 71 99 1 12 54 49 77 96 15 41 74 33 48 62 5 63 100 3 7 19 10 25 59 1 1 3 4 6 16 n/a n/a n/a Dataset Awake Data Points Sleep Data Points Average n1 451 4619 91 n3 284 1205 148 n4 6076 1854 238 n7 1152 2221 74 n8 2534 3465 78 n9 829 3153 61 n10 2621 1608 97 n11 754 4760 136 n13 614 785 78 n14 310 3422 96 n15 1020 1521 87 narco2 1631 1433 79 narco4 1322 2997 79 narco5 669 3153 90 Threshold Percentage (%) 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 False +ve % 80 57 30 100 100 100 98 97 97 55 38 17 66 54 33 36 10 2 83 72 52 97 96 96 79 59 42 94 86 79 80 71 62 74 52 20 43 27 12 53 48 43 Table 5.2: Data analysis results with second HR algorithm. 46 False -ve % 1 2 34 1 1 1 1 1 1 6 37 75 18 41 71 2 22 70 3 10 36 1 1 1 4 14 29 1 1 1 1 2 3 2 5 19 2 3 28 2 4 6 Dataset Awake Data Points Sleep Data Points Average n1 451 4619 92 n3 284 1205 76 n4 6076 1854 107 n7 1152 2221 75 n8 2534 3465 75 n9 829 3153 62 n10 2621 1608 85 n11 754 4760 79 n13 614 785 68 n14 310 3422 77 n15 1020 1521 76 narco2 1631 1433 81 narco4 1322 2997 66 narco5 669 3153 77 drive 5156 0 62 Threshold Percentage (%) 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 False +ve % 21 15 8 30 10 0 34 31 29 22 17 6 9 7 0 16 3 0 18 6 0 25 21 14 13 3 1 5 0 0 22 16 13 39 32 16 0 0 0 9 7 5 13 3 0 Table 5.3: Data analysis results with third HR algorithm. 47 False -ve % 83 84 86 67 80 93 65 68 71 65 72 90 94 98 100 62 64 90 78 92 100 65 76 91 73 84 96 81 100 100 67 68 74 55 55 57 100 100 100 68 88 98 n/a n/a n/a for the third algorithm, instead of just threshold percentage, another percentage value was determined by analyzing the change between last awake ratio and first sleep ratio. Various combinations of these percentage values were used for the analysis. These combinations are listed and described in the table 5.4. Case ID Case A Case B Case C Case D Case description MIN 40% CHANGE FROM PREVIOUS VALUE MIN 40% CHANGE FROM PREVIOUS VALUE + 95% WAKE AVG LF/HF RATIO MIN 50% CHANGE FROM PREVIOUS VALUE + 95% WAKE AVG LF/HF RATIO MIN 40% CHANGE FROM PREVIOUS VALUE + 85% WAKE AVG LF/HF RATIO Table 5.4: Case descriptions used in LF-HF result tables. The results from the algorithms 4 and 5 are similar to the algorithms 1 and 2 respectively. But the change in the values of false negative and false positive is not prominent. Third LF-HF algorithm performs better in the case of false positives as shown in tables 5.7 and 5.10. Sufficient data is not available for 2 minute LF/HF ratio analysis and hence the results are not satisfactory compared to 30 sec LF/HF ratio analysis. Results may improve with the use of larger datasets. 5.4 Algorithm comparison The analysis of various datasets from previous section clearly illustrates that the de- crease in the threshold percentage negatively impacts false negative and favors false positive in algorithms 1 through 5. Since the goal of the algorithm is to minimize false negatives, a higher threshold percentage i.e. 95% is suitable. Also, from the results and analysis of data from LF-HF algorithm, it is evident that 30 seconds interval LF-HF results are overall better than 2 minutes interval LF-HF results. Another benefit of this result is that 30 seconds interval is favorable for systems such as drowsiness detection so that the driver can 48 Dataset Awake Data Points Sleep Data Points Average n1 10 117 1 n3 8 34 2 n4 150 40 2 n7 32 66 3 n8 70 95 6 n9 26 114 3 n10 62 38 7 n11 20 129 2 n13 18 25 1 n14 8 92 1 n15 28 47 1 narco2 44 43 2 narco4 32 87 5 narco5 16 88 5 drive 5156 0 4.5 Threshold Percentage (%) 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 False +ve % 60 60 60 50 50 50 67 66 63 65 53 53 81 78 74 61 61 61 70 70 70 70 65 65 77 77 77 37 37 37 60 57 57 61 59 56 78 78 71 68 68 68 62 61 59 False -ve % 43 45 47 53 56 59 53 53 53 4 5 8 9 10 11 3 4 5 19 19 22 23 25 28 8 8 8 3 3 4 43 45 47 12 12 17 4 4 5 23 24 27 n/a n/a n/a Table 5.5: 30 second data analysis results with first LF-HF algorithm. 49 Dataset Awake Data Points Sleep Data Points Average n1 10 117 5 n3 8 34 5 n4 150 40 14 n7 32 66 2 n8 70 95 7 n9 26 114 2 n10 62 38 7 n11 20 129 6 n13 18 25 0 n14 8 92 1 n15 28 47 3 narco2 44 43 2 narco4 32 87 6 narco5 16 88 11 Threshold Percentage (%) 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 False +ve % 100 100 100 100 100 87 100 100 100 53 50 46 84 84 84 61 61 61 72 70 70 90 90 90 61 61 61 37 37 37 92 92 92 59 56 56 78 78 78 81 81 81 False -ve % 2 2 2 18 18 18 8 8 8 8 8 10 7 8 8 6 6 6 14 19 19 4 5 5 20 20 20 5 5 5 11 13 13 12 12 19 3 3 3 3 3 3 Table 5.6: 30 second data analysis results with second LF-HF algorithm. 50 Dataset Awake Data Points Sleep Data Points Average n1 10 117 1 n3 8 34 2 n4 150 40 2 n7 32 66 3 n8 70 95 6 n9 26 114 3 n10 62 38 7 n11 20 129 2 n13 18 25 1 n14 8 92 1 n15 28 47 1 narco2 44 43 2 narco4 32 87 5 narco5 16 88 5 drive 5156 0 5 Case ID Case A Case B Case C Case D Case A Case B Case C Case D Case A Case B Case C Case D Case A Case B Case C Case D Case A Case B Case C Case D Case A Case B Case C Case D Case A Case B Case C Case D Case A Case B Case C Case D Case A Case B Case C Case D Case A Case B Case C Case D Case A Case B Case C Case D Case A Case B Case C Case D Case A Case B Case C Case D Case A Case B Case C Case D Case A Case B Case C Case D False +ve % 30 30 20 30 25 12 0 12 23 19 14 19 21 18 12 18 21 20 11 20 34 19 7 19 17 14 12 14 25 20 20 20 33 33 33 33 25 0 0 0 25 14 3 14 31 25 18 25 15 15 9 15 6 6 6 6 20 14 10 13 False -ve % 80 85 89 85 71 92 95 92 88 93 93 93 60 60 70 60 80 82 85 82 64 64 72 64 61 64 74 64 70 73 77 73 76 76 84 76 67 67 74 67 69 79 86 79 70 70 77 70 76 76 83 76 71 74 83 74 n/a n/a n/a n/a Table 5.7: 30 second data analysis results with third LF-HF algorithm. 51 Dataset Awake Data Points Sleep Data Points Average n1 2 30 1 n3 2 8 1 n4 37 12 1 n7 8 17 2 n8 17 25 3 n9 6 30 2 n10 15 10 3 n11 5 33 1 n13 4 7 0 n14 2 23 1 n15 7 12 1 narco2 11 11 2 narco4 8 22 2 narco5 4 22 1 drive 5156 0 3 Threshold Percentage (%) 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 False +ve % 50 50 50 50 0 0 59 54 48 50 50 50 82 82 76 50 50 50 66 53 33 60 60 60 75 50 50 50 50 50 57 42 42 54 54 54 62 62 62 25 25 0 63 61 61 False -ve % 30 37 47 100 100 100 59 75 84 24 24 24 16 16 20 0 0 0 80 80 80 46 49 52 29 29 29 0 0 0 75 75 75 10 19 28 23 23 23 91 91 96 n/a n/a n/a Table 5.8: 2 minute data analysis results with first LF-HF algorithm. 52 Dataset Awake Data Points Sleep Data Points Average n1 2 30 1 n3 2 8 2 n4 37 12 3 n7 8 17 2 n8 17 25 2 n9 6 30 1 n10 15 10 4 n11 5 33 2 n13 4 7 1 n14 2 23 0 n15 7 12 1 narco2 11 11 1 narco4 8 22 3 narco5 4 22 5 Threshold Percentage (%) 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 95 90 85 False +ve % 100 100 100 100 100 100 94 91 91 50 50 50 76 76 70 33 33 33 80 80 66 80 80 80 100 100 100 0 0 0 85 85 85 36 27 27 75 75 75 100 100 100 False -ve % 10 10 10 50 50 50 34 34 34 24 30 36 20 20 20 20 20 27 60 60 70 10 13 13 29 29 29 18 18 18 34 50 59 46 46 55 14 14 14 23 23 23 Table 5.9: 2 minute data analysis results with second LF-HF algorithm. 53 Dataset Awake Data Points Sleep Data Points Average n1 2 30 1 n3 2 8 1 n4 37 12 1 n7 8 17 2 n8 17 25 3 n9 6 30 2 n10 15 10 3 n11 5 33 1 n13 4 7 0 n14 2 23 1 n15 7 12 1 narco2 11 11 2 narco4 8 22 2 narco5 4 22 1 drive 5156 0 5 Case ID Case A Case B Case C Case D Case A Case B Case C Case D Case A Case B Case C Case D Case A Case B Case C Case D Case A Case B Case C Case D Case A Case B Case C Case D Case A Case B Case C Case D Case A Case B Case C Case D Case A Case B Case C Case D Case A Case B Case C Case D Case A Case B Case C Case D Case A Case B Case C Case D Case A Case B Case C Case D Case A Case B Case C Case D Case A Case B Case C Case D False +ve % 0 0 0 0 0 0 0 0 43 32 18 32 12 0 0 0 23 23 17 23 33 33 16 33 66 60 33 60 40 40 20 40 25 25 0 25 0 0 0 0 0 0 0 0 36 36 27 36 12 12 12 12 50 25 0 25 15 13 15 20 False -ve % 60 64 70 64 75 100 100 100 59 67 92 67 53 59 59 59 72 76 84 76 54 54 64 54 70 90 100 90 64 79 85 79 58 58 58 58 83 83 83 83 50 84 92 84 37 37 46 37 69 73 78 73 60 100 100 100 n/a n/a n/a n/a Table 5.10: 2 minute data analysis results with third LF-HF algorithm. 54 be alerted sooner than later. The HR algorithms show better results than LF-HF algorithms. In addition, HR algorithm is much quicker since it uses only 6 RR intervals, usually adds up to less than 10 seconds, which is another positive point for HR algorithm. Each HR algorithm shows slightly different results which can be very useful. First algorithm can be considered neutral i.e. shows balanced false positives and false negatives. The second algorithm favors false negative while third favors false positives. This information can be used to create a hybrid algorithm using second and third algorithms. This hybrid algorithm may potentially improve results by minimizing both false positive and false negative. 55 Chapter 6 CONCLUSION This thesis examines the challenges of using Electrocardiogram (ECG) signals in wearable computing systems, specifically in addressing drowsiness detection while driving. The wearable system incorporating an ECG monitor and a mobile app for carrying out the data analysis and computation is described. The systems interface design is also presented, along with the approach to alert drowsy drivers. The ECG signal is obtained from offthe-shelf wearable ECG monitor. The ECG data is then analyzed using the MATLAB to determine the level of noise which came out to be minimal during various levels of physical activity. Various algorithms are developed to detect the drowsiness of the driver using physiological data. Heart Rate (HR) algorithms are based on the change in the heart rate and are fast in response. LF-HF algorithms are based on the LF/HF ratio which is calculated using the HRV tool and require the data to be collected for some time to get the values for LF and HF. The efficiencies of the algorithms are compared for various stages such as driving, awake and sleep from real and annotated ECG data available at PhysioBank archives. Results shows that the heart rate and LF/HF ratio fall when a person transitions to sleep. It has been illustrated that both heart rate and LF/HF ratio can be used to detect drowsiness. The HR algorithms show better results than the LF-HF algorithms. Sufficient data is not available for 2 minute LF/HF ratio analysis and hence the results are not satisfactory 56 compared to 30 sec LF/HF ratio analysis. Results may improve with the use of larger datasets. The second algorithm favors false negative while third favors false positives. This information can be used to create a hybrid algorithm using second and third algorithms. This hybrid algorithm may potentially improve results by minimizing both false positive and false negative. Overall results of this study are encouraging. In future, more sophisticated and complex algorithms based on multiple correlated parameters can be made for detecting the drowsiness. 57 References [1] National Highway Traffic Safety Administration(NHTSA): Drowsy driving and automobile crashes, http://www.nhtsa.gov/people/injury/drowsy driving1/Drowsy.html, April 2014. [2] PhysioBank Data, http://www.physionet.org/cgi-bin/atm/ATM, April 2014. [3] Kubios HRV - Heart Rate Variability Analysis Software, Biosignal Analysis and Medical Imaging Group, University of Eastern Finland, http://kubios.uef.fi/, March 2014. [4] G. D. Clifford, F. Azuaje, and P. E. McSharry, “Advanced Methods and Tools for ECG Data Analysis”, Artech House, Norwood, MA, USA(2006). [5] European Society of Cardiology and the North American Society of Pacing and Electrophysiology, “Heart Rate Variability: Standards of measurement, physiological interpretation, and clinical use”, European Heart Journal, 19, 354-381(1996). [6] 0. Pahlm, L. Sornmo, “Software QRS detection in ambulatory monitoring - A review”, Med. Biol. Eng.Comput., 22, 289-297(1984). [7] J. Pan, W. J. Tompkins, “A Real-Time QRS Detection Algorithm”, IEEE Transactions on Biomedical Eng, 32(3), 230-236(1985). [8] LabVIEW for ECG Signal Processing, http://www.ni.com/white-paper/6349/en/, April 2014. [9] Lina Zhang and Xinhua Jiang, “Acquisition and Analysis System of the ECG Signal Based on LabVIEW”,The Ninth International Conference on Electronic Measurement & Instruments, 4, 557-539(2009). [10] A. L. Goldberger,et.al, “PhysioBank, PhysioToolkit, and PhysioNet: Components of a New Research Resource for Complex Physiologic Signals”, Circulation, 101, e215e220(2000). [11] J.Lee, K.J. Lee and S.K. Yoo, “Development of a new Signal Processing Algorithm based on Independent Component Analysis for Single Channel ECG Data”, Proceedings of the 26th Annual International Conference of the IEEE EMBS, 1, 224226(2004). [12] Li Nianqiang, Wang Yongbing and Zhao Guoyi, “Preferable Method on Digital Filter in ECG Signals Processing Based on FPGA”, Third International Symposium on Intelligent Information Technology and Security Informatics, 184-187(2010). 58 [13] Dilpreet Buxi, Torfinn Berset, Martijn Hijdra, Marc Tutelaers, Di Geng, Jos Hulzink, Michel van Noorloos, Inaki Romero, Tom Torfs, Nick van Helleputte, “Wireless 3lead ECG System with on-board Digital Signal Processing for Ambulatory Monitoring”, Proceeding of the IEEE International Conference on Biomedical Circuits and Systems, 308-312(2012). [14] D. Balasubramaniam and D. Nedumaran, “Implementation of ECG Signal Processing and Analysis Techniques in Digital Signal Processor based System”, Proceeding of the IEEE International Workshop on Medical Measurements and Applications, 60-63 (2009). [15] T.K. Kho,et.al, “Bluetooth-enabled ECG Monitoring System”, TENCON 2005 IEEE Region 10, 1-5(2005). [16] Bin Yu, Lisheng Xu, Yongxu Li, “Bluetooth Low Energy (BLE) based mobile electrocardiogram monitoring system”, Proceeding of the IEEE International Conference on Information and Automation, 763-767(2012). [17] Zephyr, http://www.zephyranywhere.com and http://www.zephyr-technology.com, April 2014. [18] Zephyr BioHarness BT UserGuide, http://www.zephyranywhere.com/media/pdf/BH UG PBioHarnessBTUserGuide 20130121 V03.pdf, April 2014. [19] Zephyr BioHarness BT DataSheet, http://www.kwic.nl/healthcare/files/BioHarness BT Data Sheet 2011-03-08.pdf, April 2014. [20] J. A. Johnstone, et. al., “Bioharness multivariable monitoring device. Part I: Validity”, Journal of Sports Science and Medicine, 11, 400-408(2012). [21] Zephyr Manuals and papers, http://www.zephyranywhere.com/support/downloads, April 2014. [22] Android App Development, http://developer.android.com/guide/index.html, April 2014. [23] Android Software Development Kit, http://developer.android.com/tools/help/index.html, April 2014. [24] X. Yu, “Real-time Nonintrusive Detection of Driver Drowsiness”, http://conservancy.umn.edu/bitstream/97650/1/CTS 2009-15.pdf, March 2014. [25] L. Toscani, et.al, “Human heart rate variability and sleep stages”, The Italian Journal of Neurological Sciences, 17, 437-439(1996). [26] H. S. Shin, et. al, “Real Time Car Drivers Condition Monitoring System”, Proceedings of IEEE Sensors Conference, 951.954(2010). [27] S. Elsenbruch, M. Harnish, and W. C. Orr, “Heart rate variability during waking and sleep in healthy males and females”, Sleep, 22, 1067-1071(1999). 59 [28] M. Patel, S. K. L. Lal, D. Kavanagh, P. Rossiter, “Applying neural network analysis on heart rate variability data to assess driver drowsiness”, Exp. Syst. Appl., 38, 72357242(2011). [29] M. Mahachandra, Yassierli; I.Z. Sutalaksana, K. Suryadi, “Sensitivity of Heart Rate Variability as Indicator of Driver Sleepiness”, Proceedings of the 2nd International Conference of the South East Asian Network of Ergonomics Societies, 1-6(2012). [30] H. J. Eoh, M. K. Chung, and S. H. Kim, “Electroencephalographic study of drowsiness in simulated driven with sleep deprivation”, International Journal of Industrial Ergonomics,35,307-320(2005). [31] Wu Qing, Sun BingXi, Xie Bin, Zhao Junjie, “A PERCLOS-Based Driver Fatigue Recognition Application for Smart Vehicle Space”, Proceedings of Third International Symposium on Information Processing, 437-441(2010). [32] Sunghoon Ivan Lee, Charles Ling, Ani Nahapetian, Majid Sarrafzadeh. A Framework for Data Quality Estimation of On-Body Cardiac Sensor Networks. IEEE Consumer Communications and Networking Conference (CCNC), January 2012. [33] Myung-kyung Suh, Chien-An Chen, Jonathan Woodbridge, Michael Kai Tu, Jung In Kim, Ani Nahapetian, Lorraine S. Evangelista, Majid Sarrafzadeh. A Remote Patient Monitoring System for Congestive Heart Failure. Springer Journal of Medical Systems (JOMS), Vol 35, No. 5, pp. 1165-1179, June 2011. [34] Myung-kyung Suh, Lorraine S. Evangelista, Chien-An Chen, Kyungsik Han, Jinha Kang, Michael Kai Tu, Victor Chen, Ani Nahapetian, Majid Sarrafzadeh. An Automated Vital Sign Monitoring System for Congestive Heart Failure Patients. ACM International Health Informatics Symposium (IHI), November 2010. [35] Myung-kyung Suh, Lorraine S. Evangelista, Victor Chen, Wen-Sao Hong, Jamie Macbeth, Ani Nahapetian, Florence-Joy Figueras, Majid Sarrafzadeh. WANDA B.: Weight and Activity with Blood Pressure Monitoring System for Heart Failure Patients. IEEE Workshop on Interdisciplinary Research on E-Health Services and Systems (IREHSS) held in conjunction with WoWMoM 2010, June 2010. [36] Jonathan Woodbridge, Ani Nahapetian, Hyduke Noshadi, William Kaiser, Majid Sarrafzadeh. Wireless Health and the Smart Phone Conundrum. HCMDSS/MDPnP, Held in conjunction with IPSN, April 2009. [37] Sunghoon Ivan Lee, Jonathan Woodbridge, Ani Nahapetian, Majid Sarrafzadeh. MARHS: Mobility Assessment System with Remote Healthcare Functionality for Movement Disorders. ACM SIGHIT International Health Informatics Symposium (IHI), January 2012. pdf [38] Armen Babakanian, Ani Nahapetian. Data Fusion for Movement Visualization in a Remote Health Monitoring System. IEEE International Conference on Mobile Computing, Applications, and Services (MobiCASE), October 2011. 60 [39] Myung-kyung Suh, KyuJoong Lee, Alfred Heu, Ani Nahapetian, Majid Sarrafzadeh. Bayesian Networks-Based Interval Training Guidance System for Cancer Rehabilitation. Conference on Mobile Computing, Applications, and Services (MobiCASE), October 2009. [40] Mars Lan, Ani Nahapetian, Alireza Vahdatpour, Lawrence Au, William Kaiser, Majid Sarrafzadeh. SmartFall: An Automatic Fall Detection System Based on Subsequence Matching for the SmartCane. International Conference on Body Area Networks (BodyNets), April 2009. [41] R. T. Pivik, K. Busby,“ Heart rate associated with sleep onset in preadolescents”, Journal of Sleep Research, 5(1) 3336(1996). [42] Moukabary, “Willem Einthoven (1860-1927): Father of electrocardiography”, T. Cardiology Journal 14, No. 3, 316-317(2007) [43] J. Malmivuo and R. Plonsey, “ Bioelectromagnetism: Principles and Applications of Bioelectric and Biomagnetic Fields”, Oxford University Press (Web Edition), 1995. [44] A.L. Goldberger, “ Clinical electrocardiography: a simplified approach”, Mosby Elsevier 2006. [45] D. Dubin, “Rapid Interpretation of EKGs, Sixth Edition”, Cover Publishing Company, October 2000. [46] Heart Rate, http://en.wikipedia.org/wiki/Heart rate, April 2014. [47] G. Hansson, et.al., “Validity and reliability of triaxial accelerometers for inclinometry in posture analysis”, S. Medical and Biological Engineering and Computing, 39(4), 405-413 (2001). [48] J. VAN DEN BERG, “Sleepiness and Head Movements”, Industrial Health, 44, 564576 (2006). [49] Ki Chang Nam, Min Kyung Kwon and Deok Won Kim, “Effects of Posture and Acute Sleep Deprivatio on Heart Rate Variability”, Yonsei Med Journal, 52(4), 569-573 (2011). [50] Skin Temperature, http://en.wikipedia.org/wiki/Human body temperature, April 2014. [51] A. C. Czeisler et. al., “Timing of rem sleep is coupled to the circadian rhythm of body temperature in man”, Sleep, 2(3), 329346 (1980). [52] K. Krauchi, C. Cajochen, and A. Wirz-Justice, “Waking up properly: is there a role of thermoregulation in sleep inertia?”, Journal of Sleep Research, 13(2), 121127 (2004). [53] Breathing Rate, http://en.wikipedia.org/wiki/Respiratory rate, April 2014. 61 [54] J. Trinder,et.al, “Correlation between ventilation and eeg-defined arousal during sleep onset in young subjects”, Journal of Applied Physiology, 83(6) 20052011 (1997). [55] H. De Rosario, J.S. Solaz, N. Rodriguez L.M. Bergasa, “Controlled inducement and measurement of drowsiness in a driving simulator”, IET Intell. Transp. Syst., 4(4), 280288(2010). [56] HRV, http://en.wikipedia.org/wiki/Heart rate variability, April 2014. [57] “Task force of the European society of cardiology and the North American society of pacing and electrophysiology. Heart rate variability standards of measurement, physiological interpretation,and clinical use”, Circulation, 93(5):1043-1065, March 1996. [58] Kubios HRV 2.1 user guide, http://kubios.uef.fi/media/Kubios HRV 2.1 Users Guide.pdf, March 2014. [59] MG Terzano, L Parrino, A Sherieri, R Chervin, S Chokroverty, C Guilleminault, M Hirshkowitz, M Mahowald, H Moldofsky, A Rosa, R Thomas, A Walters. Atlas, rules, and recording techniques for the scoring of cyclic alternating pattern (CAP) in human sleep. Sleep Med 2001 Nov; 2(6):537-553. [60] Healey JA. Wearable and automotive systems for affect recognition from physiology. MIT Dept. of Electrical Engineering and Computer Science, Ph.D. thesis, 2000. [61] National Institute of Neurological Disorders and Stroke. (2007, May 21). Brain basics: Understanding sleep. Retrieved November 25, 2013, from http://www.ninds.nih.gov/disorders/brain basics/understanding sleep.htm. 62