## 3 Materials and Methods
### System of Sensors Network  
Table 4 shows the technical specifications of the proposed system's sensors encompassing 14 nodes. These sensors monitor the main areas of the house in order to know behaviors and be able to send alerts or notifications to the user via email or SMS. The implemented sensors are Motion, Pressure, temperature and humidity (PTH), Noise, Light, Gyroscope, and Air quality. Figure 1 shows real photos of the devices installed for the monitoring system. The distributed sensor network consists of a hub node, which is the device connected to the computer via a USB connection and receives and manages all the information received and transmitted. It has three router nodes with sensors connected to their communication ports, such as temperature, pressure, humidity, light, sound, and the others we have activated. The sensed parameters are sent via radio frequency to the network up to the concentrator node, which can act as a repeater. The power supply can work in two types: (1) Input Voltage 1 (BAT): Acid/Lead Battery (12 V DC at 3.3 Ah). (2) Input Voltage 2 (CS): Solar Cell (12 V DC, 10 W, 0.5A). The graphic software of the network shows the logical neighbors of the node. It presents its relationship with each of its neighbors with respect to the RSSI (Received Signal Strength Indicator) and LQI (Link Quality Indicator) signals. \begin{table}
\begin{tabular}{p{142.3 pt} p{142.3 pt}} \hline
**Sensor** & **Description** \\ \hline Motion & DC 4.5–20 V, 50 \(\mu\)A delay: 5–200 S (adjustable) the range is (0.xx second to tens of second), Operation Temp. Table 5 shows the main vital sign parameters related to sleep and how a person sleeps. A smartwatch can measure the person's main vital signs while he/she sleep. We show typical values for a person in a resting state who does not present cardiovascular or respiratory diseases. Upon the use of accelerometers and gyroscopes, we can monitor the most subtle movements. Pointing at the wrist, we have an optical sensor to capture the changes of each pulsation and calculate the oxygen level in the blood. When the heart rate is low, and there is hardly any movement, it is recorded as deep sleep. When there is much movement, and the heart rate is high, it is considered light sleep. To know the REM phase of sleep, data from heart rate and movement sensors are added to the respiration frequency to make the estimate. Also, we can know when the person is awake because they move enough to do so. Stress measurements can be approximated by measuring changes in the duration between beats, also known as HRV (Heart rate variability). HRV offers a non-invasive way to pinpoint imbalances in the autonomic nervous system. Based on data collected from many people, the variation between beats tends to be less if the system is in a fight or flight mode. In contrast, if the nervous system is relaxed, the variation may be more significant [49]. It is essential to mention that the consent notice given to each person notes that consuming caffeine, nicotine, alcohol, or drugs may alter the results. In addition, the measurements will not be very reliable in people with heart disease or asthma, who are doing sports, or who need to wear the watch correctly. For this last reason, these types of people have been excluded from the experiments. The sensor network is trained with the person's routines and keeps sensors active in the areas where the person spends the most time. In addition, it recognizes patterns of open windows or doors within the person's routine so as not to send unnecessary alerts. The sensor system monitors noise, movement, air quality, level, the door turns, and lights to send notifications of recommendations for improving sleep quality monitored by a conventional smartwatch. The system has an alert algorithm that can improve the quality of the person's sleep.