1. Introduction
The Internet of Things (IoT) connects devices and objects in everyday life through the Internet. IoT allows the integration of sensors and devices with objects that remain connected to the Internet through fixed and wireless networks [
1]. IoT allows a better quality of life since it can collect and analyze data that, together, can become important information and knowledge. The various sensors allow unified communication that facilitates collaboration between heterogeneous teams [
2].
The Internet of things applied in the health area will allow many people, regardless of their social class, to use the services offered through the IoT in many countries. It will serve to constantly monitor our health, taking into account that there are many diseases in which symptoms are silent and that an early diagnosis would allow prevention and possible solutions to diseases that can be fatal [
3].
Recent years have seen significant advances in the sensing capabilities of smartphones and their wearable devices, allowing them to collect rich contextual information such as location, device usage, and human activity at any given time [
4]. These have become a popular way to get accountability on their daily lives, but could we really trust on these data and results? Some of the features these wearables are detecting our heart rate and movement, which then are interpreted as sleep quality throwing us insights and charts [
5]. However, getting a good sleep quality means taking care of diverse factors.
Good quality of life is key in human lives, and to achieve it, the main element is having good health, which is highly related to getting good sleep. Sleep is an essential element of our health in life. In the handbook of psychology, the author Irving B. Weiner says that getting good sleep is as important as eating or drinking water. Our sleep is composed of 2 types of sleep: NREM and REM. NREM is subdivided into 4 different stages which in a complete scheme they form a cycle. These stages are: 1, 2, 3 and 4. Stage 1 is a transitional phase between wakefulness and more night sleep. This stage of sleep is a light one and in this phase the arousal threshold is low. The brain wave signal is characterized by low-amplitude and high frequency waves. Then during stage 2, it lasts between 10 and 15 min which is characterized by falling sleep. Stage 3 and 4 are considered as the deepest stages of sleep and together last between 20 and 40 min. During these stages, people get the deepest sleep and this is where dreams occur [
6].
Bad sleep habits can have a direct effect on the brain. The brain is the most important tool we have in our lives, so we have to protect it and keep it healthy. Bad sleep habits have a direct negative impact on our brain, which affects our neural responses. Bad sleep habits cause sleep disorders that deteriorate our mental health. Some of the most common sleep disorders in people are depression, insomnia, narcolepsy, sleep apnea and restless legs. Each of them have a different consequence on our health that affects our life health. Depression is one of the biggest diseases people is experimenting nowadays and it can be prevented by good sleep habits. This caused thanks to the good mental health sleep provides. Insomnia is another disease which is affecting the majority of people in the world. This disease obstructs the ability to sleep during the night [
7].
The motivation of this work is to analyze the impact of a sensor network on people’s sleep quality. We previously based ourselves on the analysis of the conditions of a person when he sleeps relaxed, with little lighting, little noise, and in a comfortable way. We also study a person’s sleep behavior under stressful conditions, such as lots of light, noise, poor sleeping positions, body discomfort, and so on. By implementing a simple sensor network, we want to analyze the impact of improving sleep and, therefore, on the person’s quality of life. We carry out statistical analysis to verify the real affectation of people under conditions of stress and relaxation when sleeping. We support this experimentation with a qualitative analysis done by the same people to expand and better understand the results.
1.1. Related Work
Historically, the data provided by patients during an outpatient consultation is based on subjective verbal reports from the patient’s experience, memories, and knowledge, or, at best, from paper records. Nowadays, thanks to wearables and digital tools, we have clinically relevant information collected continuously during the time between hospital visits. Thus, we obtain an improved “snapshot” of what has happened since the last time we have seen the patient, be it days, weeks, or months [
8]. In this way, clinical variables are monitored, allowing proactive anticipation and prevention of health problems that we previously could not previously detect. For example, according to a study by the Fitbit brand and the Scripps Research Translational Institute (USA), these devices would have close to 80% reliability in predicting if a person, who has previously reported symptoms, has Covid-19 [
9].
Wearable sleep tracking products are establishing themselves as one of the most critical categories of commercial health products [
10]. These can be a sensor placed directly on the body or a garment used when carrying out the action to be measured. Adopting this technology has caused an awareness about the importance of good sleep for health and the dangers of not doing so. These technologies are becoming more widely accepted and are used as self-diagnostic tools by many users worldwide [
11].
Most smartwatches and fitness trackers have a three-axis accelerometer. It is a device made up of axis-based motion sensors and tracks movement in all directions. Some even come with a gyroscope to measure orientation and rotation. Through actigraphy, the smartwatch translates wrist movements into sleep patterns. Actigraphy monitors one of the parameters, movement.
The data collected by wearables on heart rate or sleep could help predict the evolution of some minor diseases in real-time. Some studies show the impact of the heart rate and the activity of the person while sleeping in order to associate them with minor health conditions and to be able to detect them in advance. In work cited in [
12], they calculated users’ average resting heart rate, sleep duration, and deviations to help identify when these measurements were outside a person’s typical range. During each week, abnormal behaviors were identified if the average weekly resting heart rate was above the overall average and the average weekly sleep rate was not below the overall average. Some apps enhance smartwatches’ ability to monitor blood pressure by uploading data to wireless monitors connected via Bluetooth or WiFi. Related works, refs. [
13,
14,
15], show monitors that stand out for their accuracy in measuring blood pressure, using advanced algorithms, and more remarkable ability to eliminate motion interference. In addition, they provide immediate device information and reading history through the app, allowing patients to share their data with healthcare professionals.
- (A)
Sleep study
Not resting adequately implies a danger when driving vehicles, operating heavy machinery, or carrying out any activity that requires attention, concentration, and the ability to react. It is also reflected in the state of mind (bad mood, irritability, etc.), increasing the level of stress and appearing early aging.
The sleep study is the most powerful tool to diagnose disorders that are difficult to identify through regular medical consultations. Sleep apnea, periodic leg movement syndrome, narcolepsy, restless legs syndrome, and insomnia are among the most common disorders [
16]. They are non-invasive and have the objective of gathering as much evidence as possible through monitoring brain and physical activity at the time of sleep. For this study, the patient must present himself(herself) in a laboratory equipped with a chamber where he will be connected to different sensors, which will take different measurements throughout the night [
17].
Because this type of study gathers data on what happens in a person’s body while they sleep, there are different types of studies depending on the diagnosis to be validated. An interesting exercise is the study of polysomnography [
18]. During a polysomnography study, equipment is used. (a) An Electroencephalogram is placed using electrodes on the user’s head, which measures the stages of REM and nonREM sleep from the patient’s brain activity throughout the night. (b) Motion sensors are placed between the eyes and ears to detect muscular movements in the area. This sensor is mainly helpful in detecting the movement of the eyes when reaching REM. (c) An oximeter is placed on the patient’s index finger, measuring blood oxygen saturation and pulse. (d) A pressure sensor located in a nasal cannula is responsible for measuring the rate of respiration and, at the same time, calculating pulmonary saturation. (e) A microphone that detects and records snoring during the night. (f) A camera that a technician supervises to record the user’s movements during the night. During the study, a specialist technician stays alert if a sensor becomes detached from the patient and has to intervene to return it to its place. Once the study is finished, the patient returns to his/her everyday life to wait for his/her results while the technician collects the data to send them to the patient’s specialist doctor.
- (B)
Technologies for sleep monitoring
Hundreds of companies worldwide have become aware of the public health problem that lack of sleep means and how it affects the productivity of corporations. A new generation of apps and devices may be the way to improve sleep [
19]. Manufacturers are developing gadgets like mobile phone alarms that wake people up at the most opportune time in their sleep cycles and wristbands that monitor heart rate. The work cited in [
20] consists of a sensor that starts working when a person goes to bed and analyzes data related to sleep, such as the time it takes someone asleep before waking up, heart rate, temperature, movement, and snoring. Another exciting initiative of sleep study through technology is polysomnography. This comprehensive recording of the bio-physiological changes during sleep is considered the standard for [
21] sleep studies. Dr. Montgomery-Downs studied the Fitbit, a wristband that tracks sleep and exercise by measuring movement. He determined that it overestimated sleep time and quality by mismeasuring wakefulness as [
22] sleep. These devices can encourage behavioral changes in healthy people who want better sleep by giving people a more accurate idea of how long [
23] is sleeping. The work cited in [
24] proposes a model for detecting generalized anxiety through monitoring heart rate, hours of sleep, and physical activity with commercial wearable devices. The data collected from these devices is recorded in a processed and analyzed database. The decision tree classification algorithm generates the behavioral model corresponding to generalized anxiety disorder. The relevant attributes and the behavior model that determines the level of anxiety corresponding to a generalized anxiety disorder are obtained. Furthermore, it has been proved that determining people’s heart rate is a good indicator to track sleep quality. The work cited in [
25] analyzes heart-rates based on an algorithm that tracks these signs in individual sleep in free conditions. Their algorithm proved that their method could work on free-conditions or laboratory conditions which helps to keep interpreting the importance of sleep. Another implication people faces when sleeping is sleep apnea which is a consequence of bad breathing during night as [
26] states in their research. They designed and implemented a controller for controlling sleep devices that track breathing during sleep. Since detecting breathing disorders during sleep is crucial to get a good quality sleep, it is important to control the pressure of these devices to get a good functionality. Finally, taking care of air quality in people’s environment help improve sleep quality as sleep breathing improves. This is stated in [
27] where they used devices to measure indoor environment. With the aid of this device, they monitored five components of indoor air quality so that air pollution is reduced and in consequence sleep quality improve.
1.2. Comparison with Other Work
Table 1 shows a comparison of our work with other related work proposals. Studies related to portable devices allow repeated measurements, evaluation of temporal patterns, and self-experimentation. The authors in the reference cited in [
28] discuss and compare recent developments in devices designed to monitor sleep-wake activity, as well as monitors designed for other purposes that could be applied in the field of sleep. They review recent developments in devices that can be used for home sleep assessment, some of which are currently available for direct purchase on the wellness market. We analyze the metrics taken into account for monitoring sleep quality. We quantify the percentage of improvement of the system and the type of devices adapted to the body or not. In addition, we have reported the experimentation time to understand the test’s duration, depending on the analysis proposed in each work. The Table deals with studies based on specialized devices from brands such as ResMed, Apple Beddit, Withings, Emfit, or others that help monitor breathing, snoring, and even temperature. In addition, they usually come with a mobile application where we can check all the trends recorded over time and offer recommendations for better rest and other interesting data. Smart watches and bracelets use sensors to track and measure physical activity, such as heart rate, sleep patterns, or weight management. We present several representative studies that base their analysis on sleep monitoring bracelets or bands and their cause or effect on vital signs. In doing so, the bracelets show the user the data obtained and, when connected to other applications, provide recommendations on improving exercise and eating habits, and encouraging physical activity.
2. Materials and Methods
For our experiment proposal, we decided to analyse 3 independent variables: sleep time, light exposure and sleep position.
Sleep Time-Sleep time is essential to get a good quality sleep because our body needs to complete sleep cycles which consist in 90 min each one.
Light exposure-To sleep well during the night, we must sleep with a blackout, which means no light should disturb our time of sleep.
Sleep position-Sleep position is a vital element to have a good quality sleep because it affects directly how we breath and move, so that we should try to adopt a fatal position to improve our sleep.
We began by collecting sleep quality data from sleep habits and quality from a group of 30 people from Guadalajara to tell whether there’s a relationship between sleep quality and adopting 3 good sleep habits (sleeping complete sleep cycles, avoiding light exposure and adopting a fetal position). The following process of 5 phases is our proposal to get our results.
Through the study, we mention the use of non-invasive devices, which we define as devices that are not in direct contact with the person involved. In the medical sector we may use invasive or non-invasive devices that interact directly or indirectly, respectively, with the patient. Since our work uses different system types to determine how our results are obtained. Furthermore, invasive devices should be used by the patient most of the time to obtain these data. In our study, we use mostly non-invasive devices as these are placed around their bedrooms [
41].
2.1. System
Sensors used in home automation are typically small devices capable of detecting and reacting to the different changes that occur around them. With the information collected from these devices, this sensor system offers several clues on adjusting sleep patterns to people’s daily rhythms.
The proposed system with its associated sensors is shown in
Figure 1. In this study, the sensor network has the following sensors in the room: accelerometer, gyroscopes for the doors, movement sensors and light sensors. The person has the following sensors in their bed: smartwatch and band sensor. This network presents the circuits in a plastic box with a pleasant visual presentation in order not to be invasive with the design of the house, as well as to avoid electronic circuits having wires exposed to damage or accidents. The collector device is a radio frequency node operating in the 2.4 GHz band with the IEEE 802.15.4 communications protocol. Working as a Sensor Node, this device has a sensor device for physical variables. This device is responsible for sending the information from the sensors to the network and to transmit such information to the concentrator radio node associated with the computer. Data are processed in a convenient way for the user or the developed system for decision-making. This device can also act or function as a repeater node for the data obtained by a sensor node. The communication protocol with the self-organized wireless network is responsible for telematics, telemetry and radiofrequency. The access control to the medium and the physical layer of the radio frequency nodes comply with the IEEE 802.15.4 standard.
Wearables are being used to increase the efficiency and accessibility of healthcare systems worldwide. They are primarily used to monitor, record continuously, and analyze various vital signs and physical activity parameters. Several sensors are part of our proposed system that help fall asleep and make the person feel more secure and comfortable at bedtime.
Gyroscopic, motion and pressure sensors: They record movement throughout the sleep process, from when we go to bed until we get up. Its values indicate the phases of sleep and their time. When sleep is deep, we barely move, but when sleep is light, the body’s movement is much greater, even if we do it unconsciously. Motion sensors are useful for monitoring device movements, such as tilt, vibration, rotation, or sway. During a sensor event, the accelerometer displays acceleration force data for all three coordinate axes, and the gyroscope displays rotational speed data for those same axes. The gyroscope is located at the room’s doors to count the number of times these doors turn, and the subject enters the bathroom or leaves his room at night. This may be an indicator of poor sleep in the person.
Sensors for measuring the environment: It is essential to know if the environment accompanies us during rest. These sensors measure temperature, lighting, environmental sound (noise), and air quality to find out if external parameters disturb the quality of our sleep. When temperature sensors are used in natural ventilation systems, they measure the temperature inside and outside the house. The difference between the two determines the airflow that must be introduced into the building.
The sensor network in the room system consists of a concentrator or coordinator node, the device connected to the computer via a USB connection. It receives and manages all the information received or transmitted from the network. In addition, it consists of six (6) router/sensor nodes. These devices have eight (8) sensors connected to their communication ports, such as temperature, pressure, humidity, infrared presence (movement), light, sound, gyroscope, and air quality, and they are distributed throughout the room. The parameters are sent via radio frequency to the concentrator or coordinator node in the network.
Figure 2 shows an example of verifying the network of the six operating nodes and one of them requesting the neighbor table of the node with MAC address 0001.
Figure 3 shows the impact of variations in sound in the environment. The sensor detects these variations and reports them. In this case, the first data collection was carried out with the sound of the typical environment without any external source of sound in the room. Subsequently, in the following samples of the sensor, an increase in the sound level is observed because different sound sources were placed through a speaker in the person’s room.
Table 2 complements the types of sensors in the network. Here we describe the main features and specifications of the sensors to be put into operation in the subjects’ room. These sensors are connected to a router node. These router nodes carry the information to the hub node to process the information centrally.
2.2. Questionnaire Discovery
This phase of the methodology consists on a questionnaire that aims to get actual information about people’s sleep habits and quality. We asked the group 8 questions to start with and gain insights to compare. These questions are developed to provide feedback to the proposed algorithm and focus the sensor alerts on the person’s needs. These are the following questions:
Do you enjoy sleeping? Why?: This is dichotomous (Y/N) and open question that helped the experiment get insights into people’s opinion about their sleep.
Do you think sleeping is important? Why?: This is dichotomous (Y/N) and open question that helped the experiment get insights into people’s opinion about their sleep.
Do you know what sleep cycles are?: This is a dichotomous (Y/N) question that helped the experiment know how familiar is the person with sleep.
If you know what sleep cycles are, please explain.: This is an open and dependent question from the last one, which helped the experiment know how deep the person is familiar with sleep.
How many hours do you normally sleep?: This is a multi-choice question that helped the experiment know the habits of the person. The choices were: Less than 5 h, 5–7 h, 8–9 h, More than 9 h.
Do you regularly sleep with exposure to light?: This is a dichotomous (Y/N) question that helped the experiment know how familiar is the person with sleep.
Which position do you normally sleep in?: This is a multi-choice question that helped the experiment know the habits of the person. The choices were: I sleep on my left side, I sleep on my right side, I sleep on my back and I sleep on my stomach.
How well do you sleep regularly?: This is a scale question that helped the experiment know the feelings of the person on their sleep. The scale was 1 to 10.
2.3. Daily Report Bad Habits Experiment
This is the second phase of the methodology which aims to get daily results of people quality sleep. They were asked to sleep in 2 different ways contrary to good quality sleep habits for 1 week and will be reporting daily results of their sleep. They slept on their back or on their stomach and slept incomplete sleep cycles. They were ask the following questions to get the data:
How many hours did you sleep? (Ex: 1, 1.5, 2, 2.5, 3, 3.5, etc.): This is an open question, which helped the experiment know how the person slept in that day.
Were you exposed to light?: This is a dichotomous (Y/N) question that helped the experiment know how the person slept that day
Which position did you sleep in?: This is a multi-choice question that helped the experiment know how the person slept that day. The choices were: I slept on my left side, I slept on my right side, I slept on my back and I slept on my stomach.
How well did you sleep today?: This is a scale question that helped the experiment know how the person slept that day. The scale is from 1 to 10.
2.4. Daily Report Good Habits Experiment
This is the third phase of the methodology focused on changing the habits of people during 1 week. For this time, they were asked to adopt a fetal position to sleep, sleep complete cycles and sleep with blackout. They reported daily their results via a questionnaire that was provided. These are the following questions:
How many hours did you sleep? (Ex: 1, 1.5, 2, 2.5, 3, 3.5, etc.): This is an open question, which helped the experiment know how the person slept in that day.
Were you exposed to light?: This is a dichotomous (Y/N) question that helped the experiment know how the person slept that day
Which position did you sleep in?: This is a multi-choice question that helped the experiment know how the person slept that day. The choices were: I slept on my left side, I slept on my right side, I slept on my back and I slept on my stomach.
How well did you sleep today?: This is a scale question that helped the experiment know how the person slept that day. The scale is from 1 to 10.
2.5. Questionnaire Analysis
This is the fourth phase of the methodology, which consisted on asking the group how was the experience with the experiment. It helped to get insights into the stimulant given to them. We also asked questions regarding the feeling of sleep between weeks. These are the questions we asked:
2.6. Data Analysis
Finally, the fifth and last phase consists on retrieving, grouping and analyzing the data we collected. This questionnaire helped to obtain insights comparing their firsts answers with the final answers.
2.7. Qualitative Approach
Smart sensors give a score to our rest. A system of metrics determines when the REM phase has been entered. This REM phase corresponds to the last 20–30 min of each sleep cycle, which usually occurs 5 or 6 times a night and lasts between 90 and 100 min.
Overall people do not know how important sleep is and in consequence, they do not pay attention to essential details when doing it. In result, their habits seem to affect directly their sleep quality day by day. For the qualitative stage, we have taken values of people’s habits before and after an stimulant. These values gave us a comparative idea of how good habits affect sleep quality. The proposed algorithm runs on the sensors in people’s rooms for two weeks. We have taken measurements and assessments of people without the sensor system (two weeks) and with the sensor system (two weeks).
Table 3 shows the results of the qualitative approach which describes the variables used for the research with 32 samples. These variables are time of sleep, exposure to light and sleep position. The answers for each of the variables were analyzed by comparing whether the participants slept complete cycles or not, whether they had exposure to light or not and whether they slept on a side position, on a back or stomach position. We present the numerical approach of these results to illustrate them. With these results obtained from the 32 samples, we will develop an algorithm to test later on this study.
The results of this study show various figures that help explain how people sleep regularly. First of all, we have figures “before experiment”. These figures indicates people’s actual habits. This helped to obtain base information to move forward into the study. Then we have “during experiment good/bad habits”. We obtained this data from the questions made in a control situation to know how people was responding to the experiment. This experiment was divided in two weeks: the first week people adopted bad habits of sleep while the second week people adopted good habits of sleep. Finally, there are figures called “after experiment n week”. These figures show the data obtained from a final round of questions made to the samples to know how they generally felt during the experiment. This final data helped us to make a comparison between the base information obtained at the beginning, the data during the experiment and the data after all the questions.
Figure 4 shows the amount of hours that people sleep regularly. From the sample size (N = 32), 24 out of 30 persons (80%) confirmed to have from 5 to 7 h of sleep in a regular basis.
Figure 5 shows the amount of people that normally sleep with exposure to light. From the sample size (N = 32), 25 out of 30 persons (83.3%) confirmed to sleep without exposure to light.
Figure 6 shows the position in which people normally sleep. From the sample size (N = 32), 14 out of 30 persons (46.7%) confirmed to sleep whether on their back or their stomach. In the other hand, from the sample size (N = 32), 16 out of 30 persons (53.3%) confirmed to sleep on one of their sides.
After this phase of results, we obtained a second wave of insights where people exposed to an stimulant and adopt bad quality sleep habits.
Figure 7 shows the number of complete sleep cycles that people sleep during the first week of the experiment. From the sample size (N = 32) and 5 days of testing, there were 100 cases where people sleep incomplete sleep cycles.
Figure 8 shows people’s wellness when sleeping in a daily basis with bad sleep habits such as sleeping incomplete cycles. From the sample size (N = 32) and 5 days of testing, 53% of them confirmed to sleep bad.
After this week testing bad sleep habits, we continued with testing during one more week by adopting good sleep habits, such as sleeping complete sleep cycles.
Figure 9 shows the number of complete sleep cycles that people sleep during the first week of the experiment. From the sample size (N = 32) and 5 days of testing, there were 67 cases where people sleep complete sleep cycles.
Figure 10 shows people’s wellness when sleeping in a daily basis with good sleep habits such as sleeping complete cycles. From the sample size (N = 32) and 5 days of testing, 64% of them confirmed to sleep good.
Finally, after two weeks of testing how people was sleeping and obtaining all the insights, we asked them about how was the experiment resulting in a general perspective.
Figure 11 shows the preferences of people by sleeping with or without exposure to light. From the sample size (N = 32), 90.3% confirmed that sleeping without exposure to light was more beneficial to them.
Figure 12 shows the preferences of people sleeping in a certain position. From the sample size (N = 32), 66.7% confirmed that sleeping on one of their sides was more beneficial to them.
Figure 13 shows the preferences of people sleeping certain amount of time, by comparing complete and incomplete sleep cycles. From the sample size (N = 32), 86.7% confirmed that sleeping complete sleep cycles was more beneficial to them.
Figure 14 shows people’s wellness when sleeping in a daily basis from first week of experiment, which was sleeping with bad sleep habits such as sleeping incomplete cycles. From the sample size (N = 32) and 5 days of testing, 50% of them confirmed to sleep bad.
Figure 15 shows people’s wellness when sleeping in a daily basis from first week of experiment, which was sleeping with bad sleep habits such as sleeping incomplete cycles. From the sample size (N = 32) and 5 days of testing, 73.3% of them confirmed to sleep good.
2.8. Proposed Algorithm
Thanks to the validation of the surveys developed in the previous subsection, we have a categorization of the needs of people when they sleep. Some of these needs are light, the number of hours of sleep, external noise, and sleeping position. This gives us a starting point to categorize sensor alerts and turn them into specific recommendations for sleep improvement.
The proposed algorithm is shown in Algorithm 1 is based on monitoring the person while they sleep. The sensors learn the person’s preferred and relaxing positions when sleeping. During the first night, when the person wakes up, we have an amount of data on each sensor acquired while the person slept. Motion, level, temperature, noise, and gyroscope sensors collect information overnight about the amount of personal movement and room conditions. This way, the algorithm can learn the person’s sleep routines and set thresholds for each sensor. The network adapts the light and temperature conditions so that the person’s movement and noise are less. Each sensor initially has a hierarchy variable in the network, which increases that value according to the priority that the sensor must have to improve the room’s conditions. Sensors start with a flag called hierarchy zero. They increase the value of the hierarchy thanks to the person’s needs. On the third day, the sensors adapt their behavior so that the person has the best conditions during their moment of rest. The person monitors her sleep to see how effective the network is concerning the daily report from her smartwatch and/or band. The network seeks to predict sleep behavior in a non-invasive way and similar to the functions that a smartwatch or a band would have. The algorithm seeks to control the room and the person’s movements to give a report of possible improvements. Among these improvements, the algorithm can recommend sleeping at certain times, lowering or raising the temperature, playing relaxing music, or sleeping with pillows to prevent uncomfortable or incorrect positions. The proactive or reactive nature of the nodes depends on their hierarchy to avoid unnecessary expenses in the energy consumption of the network.
Algorithm 1 Pseudocode of the proposed algorithm |
Start
Require: coordinator node starts;
Set avg_ind_vector[] = 0;
Per each node do:
Set Hierarchy = 0;
Set allowed_value;
Set day = 1;
avg_ind_vector[]++;
day++;
if day > 3
for i = 0; i < length(avg_ind_vector[]); i++
avg_met <-- average metric value;
if avg_met >= allowed_value
Hierarchy++;
end if
end for
end if
day++;
end do
while node with higher hierarchy do
Set alert_msg;
Set in active mode;
Set node in reactive mode;
end while
for other nodes
Set in passive mode;
Set node in proactive mode;
end for
end
|
3. Results
For our experiments, we took into account two weeks where people slept with a smart device and monitored their sleep conditions in their daily life and as they had been doing it since before. Later, another two weeks while people have the sensor network with the proposed algorithm and their smart device for sleep monitoring in their room.
We have separated the sample into men (50%) and women (50%). This is done to see if there is any difference in the network effect between genders. Indeed, in
Figure 16, we observe the percentage improvement in sleep quality in the upper graph for men and the lower graph for women. We obtain that the increase in sleep quality for men is around 9%, and for women, it is around 15%. This result is curious, but it may be because women follow the algorithm’s recommendations more closely, guided by the alerts in the sensors. This different result between men and women is interesting because, possibly, women are more strict in following the algorithm’s indications at the end of the day. This leads us to think that the slope of sleep rhythm improvement in women may be caused by the implementation of the device measures. For example, if the person has several stops during the night (detected by the motion sensor), the algorithm routes the recommendations towards lower fluid intake. Another example is based on the fact that if the air quality and temperature sensors show unsuitable conditions for rest, the algorithm’s recommendation may be to close some windows at night. This also happens with the abrupt change of levels in the noise sensor.
We added the
Table 4 with the questionnaire that was applied to the users before performing the experiments to detect primary diseases or basic health conditions. We have chosen a sample of 50 healthy people, non-smokers who do not have heart or lung conditions to avoid bias in the experiment. People who have answered “yes” to any of the questions in
Table 4 have been discarded from the sample.
Figure 17 and
Figure 18 show examples of actual testing in a user’s dream application. Scenario A shows the person’s sleep behavior without the sensor network in the person’s room. Scenario B shows an example of the person’s sleep performance with the sensor network in the person’s room. We can observe the improvement of the person’s sleep quality with the sensor network, even in the number of hours of sleep.
One of the most accessible parameters to measure is the Heart Rate which, during sleep, is directly related to its quality. Since we are measuring the heart rate, it is beneficial to determine if there are any problems related to the heart and if the sensor network helps to maintain calm when sleeping. One of the most common sleep disorders in the cardiac field is sleep apnea. Thanks to smart sensors, it is easier to detect if the person presents some of their most frequent symptoms and if there is a difference when they sleep, monitored by the network of sensors implemented in the bedroom. The same thing happens with breathing. By measuring the snoring volume and the rhythm of inspiration and expiration, it is easier to know if we have any condition in the lungs or bronchi.
For the quantitative research stage, we have taken values of vital sign metrics that are easy to measure at home. These values give us a comparative idea of when the person typically sleeps at home and when the person sleeps under the care of the proposed sensor network.
Table 5 shows the results of the vital signs measured at home. The first column represents the metric we measured. The second column the typical values found for a good quality sleep. The third column shows the average value without a sensor network. Finally the fourth column shows the average value measured with a sensor network. We analyzed each of the values and found that Heart rate (HR), Breathing frequency (BF), Temperature (T) and Deep Sleep (DS) are found between the range of typical values for both with and without using a sensor network. However, we found that values of Oxygen saturation (OS) and REMS sleep (REMS) with the sensor network were out of range from the typical values; they were presented below the range. On the other hand, we found that both values of total sleep time (TST) with or without using the sensor network were below the range. Finally, we found that values from heart rate variability (HRV) and Snoring (S) were higher when using the sensor network rather than without it. This approach shows that when using the sensor network, in most cases the values get out of range from the typical values.
Data presented in
Figure 19 is taken from the 50 people in the sample who experience the absence and presence of the algorithm in the sensor network in their room. It is essential to mention that external conditions can influence the experiment, such as the person’s mood that day, mood swings, momentary changes in the family environment, etc. However, these data were taken quantitatively during the two weeks of experimentation with electronic devices suitable for medical use in homes. So, in the first week, people do not sleep with the sensor network in their room (no sensors). In the second week, people sleep with the sensor network in operation and the proposed algorithm activated in the devices (sensors). This Figure corresponds to the metrics described in
Table 5. Here the behavior of the data is shown in a comparative way and its distribution. We observe how the algorithm’s operation is consistent with the person’s relaxation, and this impacts their way of sleeping. The foremost vital signs show improvements when people sleep with the sensor network in their room (sensors). Measurements are taken with medical devices used at home to measure temperature, heart rate, breathing frequency, and oxygen saturation. We take a measurement every hour while the subject is asleep. These measurements were made during the week when the subjects do not have the sensor network and during the week when they sleep with the sensor network in their room.
The overall sleep score on a smartwatch is a sum of the individual scores for sleep duration, sleep quality, and recovery, with a maximum total score of 100. Most people score between 72 and 83. The sleep score ranges are as follows: Excellent: 90–100, Good: 80–89, Fair: 60–79, Poor: Less than 60. These scores consider metrics such as time asleep and awake, how much a person sleeps, and the quality and recovery (turns that decrease quality) of sleep. Most smartwatches and fitness trackers have a 3-axis accelerometer and gyroscope to measure orientation and rotation. Through actigraphy, the smartwatch translates wrist movements into sleep patterns. These activity bracelets or smartwatches cannot accurately discriminate the stages of sleep.
Now, we consider stress conditions under parameters of noise, poor ventilation, high lighting, and uncomfortable sleeping positions. Relaxation conditions are evidenced by low lighting, cool ventilation (that the person does not feel too cold or hot), low or no noise, and a comfortable sleeping position. Regarding the qualitative analysis, people sleep one week under stress conditions and another one week under relaxing conditions. Afterward, we asked people their opinions (every day) regarding sleep and the number of hours of rest. Regarding the quantitative analysis, we took a sample of 50 people and measured the rhythm of sleep under stress conditions as mentioned above for one week. We then implemented a simple sensor network in the bedroom that regulates lights and noise and monitors air quality and movements.
Figure 20 shows the sleep behavior of each person in the experimental sample. The blue line describes sleep in relaxing conditions, where the person sleeps with low lighting, no noise, rests in a comfortable position, and with good ventilation. Contrary to the previous scenario, the black line shows sleep (for the same sample of people) under stress conditions. It is notable to observe the difference of 22% between the behavior of the person’s sleep during the week of stress conditions compared to the week under the quality of relaxation conditions of the sensor network.
Figure 21 shows that sleep rhythm is a Gaussian distribution because of the box plot patterns that we observe. This Figure shows the box for both sleeping with stress conditions and with relax conditions. For the stress conditions, the box is symmetrical and the median is centered. In the other hand, the box for relax conditions is more asymmetrical and a median low-oriented. As for the first plot, its characteristics are closer to a Gaussian distribution, it is a sign to confirm it.
3.1. Statistic Analysis
The sample size (N = 50) affects the confidence interval and the power of the test. A more extensive sample size results in a narrower confidence interval. The mean summarizes the sample values with a single value representing the center of the data. The mean for the sample of the values under stress conditions is 60.34, and under calm conditions is 78.28. The 17.24 difference in means estimates the difference in population means. Concerning the standard deviation, a person’s sleep rate under stress conditions deviates from the mean by approximately 6.22, and under relaxed conditions, it deviates by approximately 4.40.
To determine whether or not the sensor network positively affected people’s sleep quality, we performed a paired-samples t-test with a significance level of using the following parameters for a sample of 50 people. The sample mean of the differences is −17.94. The sample standard deviation of the differences is 8.4090. We performed the paired-samples t-test with the following hypotheses:
So the t-test statistic is −15.0856, and p is 2.6718 × . We reject the null hypothesis since this p-value is less than our significance level = 0.05. We thus have sufficient evidence to say that the quality of sleep is different before and after having the sensor system installed.
3.2. Data Stability
Figure 22 shows the two-weeks sampling of the sleep rhythm of three persons. We chose these three persons randomly from the total sample of 50 to evidence the data behavior in the sampling period stability. The visual statistical analysis (
Figure 23,
Figure 24 and
Figure 25) shows that the sleep rhythm is close to be identified as Gaussian distribution. We observe how the three figures have key characteristics of a Gaussian distribution.
Figure 23 shows a histogram, which follows a Gaussian distribution with the data obtained.
Figure 24 shows a box plot, which also shows the characteristics for a Gaussian distribution; it is symmetrical and has a median centered. Finally,
Figure 25 shows a Q-Q plot, which shows a normal distribution with few outliers.
3.3. Usability Metrics
This subsection is centered on the measures of usefulness/usability by the user. These parameters are used in user-centered interaction design to evaluate a product through testing with the users themselves.
In designing any application or system, it is essential to reduce uncertainty and relying on quantifiable data obtained in research is advantageous. Therefore some metrics based on the user experience and the appreciation of the tool used to have this information are considered. These parameters are listed in the
Table 6.
We have obtained the responses of the people in the experiment and they have answered a survey related to the questions in the
Table 6. The results show that 93% think that the monitoring system has Effectiveness. 94% think that the system has Efficiency. 96% are satisfied with the system. Finally, 78% feel that the system has the Learnability feature.
4. Discussion
Sleep disorder is one of the main problems affecting society today. This influences the state of health, labor productivity, and also personal relationships. In this sense, technology is presented as a weapon to combat this problem that brings so many people upside down.
Sleep monitoring devices help to measure how well a person sleeps superficially. Sleep is divided into 2 phases REM (rapid eye movement) and non-REM (NREM). These stages alternate, and sleep lasts between 4 and 6 cycles, lasting approximately 90 to 100 min. Typical smartwatches make it possible to find sleep quality based on deep sleep, light sleep, and REM sleep. In deep sleep, the frequency of brain waves, the rate of breathing, and blood pressure decrease during deep sleep. It is essential to stabilize mood, balance the mind and recover energy: the more deep sleep, the better sleep quality. Brain wave activity, heart rate, and breathing slow in light sleep. Being able to wake up from sleep is a defense mechanism; It is essential for health and survival. Too much light sleep can affect sleep quality and cause fatigue. Human eyes hurry from side to side under the eyelids in REM sleep. It is more difficult to wake up than light sleep but easier than deep sleep. In this phase, the muscles are paralyzed as a safety mechanism to prevent us from doing the things we are doing in the dream, and it also explains why we cannot run or scream during dreams. This phase allows mental well-being, improves creativity, and reduces stress.
We focused on doing extensive research into the importance of having a good quality sleep to have a healthy life. Since people are the main responsibles for determining what is better for their lives, we focused our efforts on doing research by digging into their daily lives. The main objective of this experiment was to analyze the correlation between people’s habits and sleep quality. We took 3 main variables as a reference to check whether people’s actions during sleep are causing any effect on their night rest. We use time of sleep, sleep position and complete sleep cycles for analyzing these data.
As we moved forward in the experimentation phase, we obtained valuable information that helped optimize our algorithm. All the data obtained from these two weeks resulted in much improvement in sleep quality from one week to the next. People surveyed affirmed that they felt better after applying good habits when sleeping. Since we needed evidence from the people in the experiment, we asked them to report their sleep every day, so that they could be aware of how they were sleeping and then to be aware of how they were feeling after. The algorithm improvement from these results had a big impact on how good sleep habits have a positive effect on sleep. Another important insight into people’s habits is the false belief that they were sleeping better when adopting bad habits. Since they already had bad habits from years before, they thought they were sleeping well. However, after some days, they realized that when adopting good sleep habits, people were sleeping even better. They confirmed that they had never slept as good as they slept in the second week. These insights helped to improve our algorithm thanks to reaffirming good habits of sleep.