Non-obtrusive system for overnight respiration and heartbeat tracking Maksym Gaiduka,b,∗, Dennis Wehrlea, Ralf Seepolda,c, Juan A. Ortegab aHTWG Konstanz, Alfred-Wachtel-Str. 8, 78462 Konstanz, Germany bUniversity of Seville, Avda. Reina Mercedes s/n, Seville, Spain cI.M. Sechenov First Moscow State Medical University, 2-4, Bolshaya Pirogovskaya st., 119435 Moscow, Russian Federation Abstract Polysomnography is a gold standard for a sleep study, and it provides very accurate results, but its cost (both personnel and material) are quite high. Therefore, the development of a low-cost system for overnight breathing and heartbeat monitoring, which provides more comfort while recording the data, is a well-motivated challenge. The system proposed in this manuscript is based on the usage of resistive pressure sensors installed under the mattress. These sensors can measure slight pressure changes provoked during breathing and heartbeat. The captured signal requires advanced processing, like applying filters and amplifiers before the analog signal is ready for the next step. Then, the output signal is digitalized and further processed by an algorithm that performs a custom filtering before it can recognize breathing and heart rate in real-time. The result can be directly visualized. Furthermore, a CSV file is created containing the raw data, timestamps, and unique IDs to facilitate further processing. The achieved results are promising, and the average deviation from a reference device is about 4bpm. Keywords: biosignal analysis; sleep medicine; heart rate; breathing 1. Introduction Humans spend a significant part of their life in sleep. It a ff ects our life in general and our wellbeing and health in particular [1]. However, a high number of persons do not feel sleeping well – thirty-five percent of US-citizens characterize their sleep quality as “good, 22% as “fair” and 12% as “poor” according to [2]. To identify the persons with sleep problems and to provide them an appropriate therapy, understanding sleep and performing of the sleep study are necessary. ∗ Corresponding author. Tel.: + 49-7531-206-703. E-mail address:
[email protected]
Polysomnography (PSG) has been used as the standard method for sleep analysis for many years. This procedure follows the guidelines of the American Academy of Sleep Medicine (AASM) [3]. The analysis is performed by sleep physicians based on the recorded signals (sleep electroencephalography, electrooculography, electromyography, electrocardiogram, respiratory flow, respiratory e ff ort, oxygen saturation, etc.). This high number of recorded signals also means numerous sensors attached to human’s body during the night, which could provoke some disturbance for the patients. Furthermore, for the connecting of all necessary sensors, monitoring the process of recording and further evaluation of collected data, several persons have to be involved, which increases the costs of the PSG approach. Besides, there are the costs of the hardware system itself and the necessary sensors. Since PSG as a method includes some aspects that need improvement [4], there are already several research projects that had an aim to develop a system for automatic sleep phase recognition [5]. Non-invasive recording of heart [6] and respiratory signals [7] are also current research topics. Ballistocardiography (BCG), for example, can be used for this purpose, as described [6]. In this work, a simple mathematical model of the BCG waveform was created, which could predict the BCG waves and also physiologic timings and amplitudes of the major waves. Furthermore, the research community has presented the first developments of systems for non-invasive sleep phase recognition. For instance, in [8] a novel approach for the classification of sleep stages using low-cost and contactless multimodal sensor fusion is presented, which extracts sleep-related vital data from radar signals and a sound-based contextual perception technique. This work has stated the improvement of accuracy for sensor-fusion algorithms compared with a single-sensor algorithm. Other types of hardware systems are also known from the research: based on piezoelectric sensors [9], analysis of acoustic signals [10], a combination of heart rate variability and motion [11] etc. In [9] the total accuracy of 93.3% for continuous measurement of respiration rate was achieved. A total number of 63 subjects have participated in the described in this work-study. In [10], 250 patients have participated in the study. Audio signals, using non-contact microphones were recorded and analyzed by developed one-layer, feedforward neural network. The epoch by epoch agreement with the polysomnography approach for REM, non-REM, and Wake stages was equal to 87% with Cohen’s kappa of 0.7. Sleep apnea can also be detected non-invasively, which is presented in, e.g., [12]. In this paper, the challenges of doppler radar technology in health monitoring were identified, and recommended research directions were stated. A good overview of health monitoring systems using sensors on bed or cushion is presented in [13]. A high number of current researches of an alternative to PSG sleep study methods confirms the importance of this topic. However, the known developments have significant disadvantages - some of them have low accuracy, other need sensors attached to human’s body, or they are of high cost, which makes the comprehensive application in a home environment more di ffi cult. Ideally, the system for sleep analysis should be non-invasive and should not cause any disturbance for the persons under monitoring. For reasons of acceptance, however, camera surveillance or comparable techniques are not the optimal solution [14]. The main goal of the described in this manuscript development is to create a non-obtrusive low-cost system for monitoring breathing and heart rate as a part of a sleep study in a home environment. This system should operate fully automatically and should neither disturb the users nor a ff ect the measurement results. These requirements should ensure typical sleep patterns and, therefore, correct data output. 2. Methodology 2.1. General hardware structure and data flow inside of the system All components (both hardware and software) of the developed system are modular, so the exchange of single components can be done without any problems. Obsolete components can be exchanged simply against newer modules, if necessary, for the improvement of the system work. Figure 1 represents the hardware structure and data flow of the developed system. Pressure sensors perform all measurements. They can be placed under the mattress, which was important according to the aim of non-obtrusive measurement. Obtained herewith signal is transmitted from the resistive pressure sensor to the amplifier and filter circuit, using an analog signal. After amplifying and filtering the signal using an operational amplifier and analog filters (both highand low-pass), the analog signal is digitized using an analog to digital converter. The now digitized signal is transferred from the analog to digital converter to the Raspberry Pi using
Fig. 1. Hardware structure. Fig. 2. FSR 406 Resistive pressure sensor. the I2C bus. Further processing and visualization of the signal are performed with the help of the Raspberry hardware. The mentioned parts of the system are detailed in the following sections. 2.2. Pressure sensor A resistive type of pressure sensor was used to measure the pressure variations under the mattress [15]. The main reasons for this choice were low-cost and high sensitivity of this sensor type, whereas one of the main disadvantages – high power consumption is not significant for the developed system because of the possibility to connect to the power supply [16]. It is also important to mention that no absolute values of pressure, but its changes are of interest here. The FSR 406 1 sensor, produced by Interlink Electronics, was selected because of its form (Figure 2), which was well suitable for the planned placement on the bed structure. In order to validate the resistance-pressure characteristic mentioned in the datasheet, several tests were performed. A light plastic plate (weight insignificantly small) was used to distribute the pressure on the pressure sensor evenly. A multimeter was used to record the resistance value for relevant weights. Since the measurement results confirmed the expectations in the setup, the work was continued. The results of the tests were used to compute additional resistors, in order to prepare the sensor for the optimal working range, as described in the section ’Analog circuit’. Figure 2 shows that the surface of the sensor is bigger (black line on sensor’s border) than the sensitive surface (golden lines). The height of both areas (sensitive and non-sensitive) di ff ers insignificantly. Therefore, the pressure over the sensor is distributed over the entire surface. Finally, a decision was taken to distribute the pressure only on the sensitive area, and therefore, a heightening element was placed over the central area of the sensor. Di ff erent materials have been tested, and a felt material showed the best amplification of the pressure. 1 https: // www.interlinkelectronics.com / fsr-400-series
Fig. 3. PCB with mounted components. 2.3. Analog circuit As for obtaining a clear signal not only amplification but also filtering of an input signal with specific frequencies was necessary. Therefore, an own amplification and filtering board was developed. The board performs an analog signal processing. For the determination of the resistance values of a divider circuit, a test with a subject (70kg, 180cm) lying on the mattress was executed. The pressure sensor was placed under the mattress on the chest level, and its resistance was measured. The obtained values were between 0.6 and 1.2 kOhm. These values had to be used for the resistance of the divider circuit to work in an optimal working range with maximal sensitivity of the sensor. In order to be more flexible, a potentiometer was introduced into a final version instead of a fixed resistor. If only a voltage divider circuit is used to measure the resistance of the resistive pressure sensor, only very small signal strokes occur. As the first tests (using electrocardiogram as a reference) have indicated, a typical heartbeat of a test person has generated a signal stroke of approximately 0.5mV. Because of the present noise, the signal amplitude was difficult to recognize. In order to get a clearer signal, it was necessary to perform filtering and amplifying the input signal. As described in [17], to measure the electrical frequencies of a heartbeat frequency is up to 15Hz should be considered. At this frequency, however, the harmonic waves are not negligible, but much higher frequencies can occur. Though, since this measurement method is based on pressure data, the frequencies are significantly lower. Besides, a mattress, the subject, and sensors act as a low-pass filter. Therefore 12.5Hz was defined as the cut-o ff frequency for the low-pass filter. For the high pass filter, the cut-o ff frequency was set to approximately 0.2Hz. Because of this low frequency, the signals of a person’s slow breath (which is more probable while sleeping) can also pass through the filter. In summary, it was necessary to amplify the data very strongly. For this, a gain of 90 was selected. Since several measuring points under the mattress are used for covering the entire chest area, a filter and amplifier circuit board presented in Figure 3 was installed for each point together with a pressure sensor. 2.4. Data digitalisation The next step after filtering and amplifying the signal is converting it in a digital format for further processing. For that, an analog to digital converter (ADC) with I2C bus for the connection to Raspberry Pi was required. An essential requirement for the selection of a converter is the data rate. The minimal data rate for the ADC was determined by 25 samples per second (Hz). This is required because, according to the Nyquist-Shannon sampling theorem [18], the sampling frequency must always be at least twice as high as the highest occurring frequency. In this case, the highest frequency is around 12.5Hz, which is limited by the cut-o ff frequency of the PCBs analog low-pass filter. Another important characteristic is the resolution of the ADC. The resolution must be adapted to the signals to be measured. In this case, according to performed tests, it was assumed that the smallest heartbeat signals have an amplitude of 0.4mV.
Fig. 4. Software structure. This signal should now be resolved with one hundred steps to ensure accurate sampling of the signal. Since factor 90 is already amplified by the operational amplifies, the minimum required resolution is 0.36mV: Minimum resolution = signal amplitude × gain = 0 . 4mV × 90 = 0 . 36mV (1) required resolution of signal amplitude 100 According to Table 1, the ADC requires minimal resolution of 14bits to provide the requested number of 100 steps for the minimal amplitude of a heartbeat. Taking into account the described above requirements, ADC ADS1115 was Table 1. ADC resolutions for 3.3V reference voltage [19]. Bits 12 13 14 15 16 17 18 Resolution (mV) 0.8 0.4 0.2 0.1 0.05 0.025 0.0125 selected for converting the signal. It has a resolution of 16 bit, a sample rate of up to 860 SPS, I2C interface, and a supply voltage from 2V to 5.5V, which is suitable for obtaining the power supply directly from Raspberry Pi. 2.5. Digital signal processing For the software processing of the signals, a Raspberry Pi 3B was selected. This single-board computer fulfills the necessary criteria: (1) it has a compact size, which permits its placement under the bed, (2) it is powerful enough for the signal processing and visualization, (3) the maximum power consumption under stress is equal to 6.7W, (4) input (keyboard, mouse) and output (monitor) devices for data visualization can be connected directly to the computational unit. The entire software structure for signal processing is presented in Figure 4 and consists of two separate software applications (“A” and “B”). These two programs use a data processing part that is nearly the same for both of them. However, the input signal for both applications is di ff erent. The live working program “A” gets its data in real-time from the resistive pressure sensors via the ADC. The querying of these four sensors takes place with exactly 25Hz via an interrupt. The collected data is stored directly in a CSV file. The second program “B” reads the CSV file written by the first program “A” after the finished overnight record. The software part, which is identical for both programs, works according to the following principle that the data from the signals are transformed into the frequency domain using an FFT. The signals are now added together (merged) in the frequency domain. The summed signal is then
Fig. 5. Sensors’ positions in bed under the mattress. transferred back to the time domain using an IFFT. In the next step, filtering is performed in the time domain. A lowpass filter and a bandpass filter are applied over the combined raw signal. The low-pass filter has a cut-o ff frequency of 0.3Hz, which was selected according to the results of the performed tests. As a result, it filters out the breathing signal from the raw signal. The bandpass filter for filtering out the heartbeat signal has a lower cut-o ff frequency of 0.6Hz and an upper cut-o ff frequency of 12.4Hz. These frequencies were determined based on literature research and confirmed during the test series. The signals (breathing and heart rate) are now prepared to be checked for peaks. This part of the algorithm uses two programs. Program “A” (the real-time application) calculates the heart rate and breathing rate from the detected local peaks in the heartbeat and breathing signal. The calculated values are visualized via the local web-server. The program “B”, which can be started only after finishing the recording, calculates the heart rate and respiratory rate at each point in time and saves them in an array. The entire record is being checked for peaks, and this improves the results in comparison to program one, which works in real-time and, therefore, cannot analyze the entire signal but only available time intervals. Raw data, heartbeat, heart rate, respiration, and respiration rate are being displayed on the connected to Raspberry Pi monitor. The visualization of both programs is presented in the section “Results”. 2.6. System costs As stated in the “Introduction” section, one of the objectives of this work was to develop a low-cost system to enable its wide use. For this reason, attempts were made to keep the costs of used components as low as possible while maintaining high quality and accuracy. Table 2 lists the approximate retail costs of used components for one complete system. Table 2. Calculation of system costs. Component Price 4x Resistive pressure sensor (FSR406) 40 € 4x Amplifier and filter circuit 21 € 1x Analog to digital converter (ADS1115) 4 € 1x Raspberry Pi 3B + accessories 45 € Manual assembling (approx. 0.5h) 15 € Total 125 € 2.7. Experiment design In the frame of a small study, five persons have participated in the test (three males and two females) with the developed hardware system. Four FSR406 sensors were placed under the mattress as shown in Figure 5. Every person
Fig. 6. Final representation of the results of application “A” – real-time visualisation. was lying in bed for four minutes in each of the following positions: supine, prone, and lateral. The side of the body for the lateral position was di ff erent for the test participants - two were lying on the left and three on the right side. In total, 12 minutes of recording per subject was done. PULOX PO-100 2 pulse oximeter was used as a reference device for the heart rate measurement. In order to take di ff erent heart rates into account, some subjects have been given additional tasks: two persons should walk up and down the stairs quickly for three minutes before one of measurement (once before prone and once before supine position measurement) and two persons lie quietly in bed for 10 minutes before starting the measurement. This has resulted in measured heart rates starting from 50 and up to 110bpm. 3. Results The results obtained in the experiment are presented in this chapter. For a clearer structure, they are grouped into three subsections. 3.1. Real-time application “A” The program “A” displays in real-time two graphics, the graphic above shows heart rate and the lower one the respiration rate (Figure 6). The visualization is done on running a local server, and it can be accessed from external devices. If necessary, it is possible to zoom in / out the graphics. The program sets a new data point in the plots every 16 seconds. 2 https: // www.pulox.de /
Fig. 7. Final representation of the results of application “B” – visualization after the finished recording. 3.2. Afterwards analysis - application “B” The visualization of program work for the application “B”, which analyses the signal after finishing the recording, can be seen in Figure 7. Visualization of 20 seconds of measurement is presented in this graphic. Figure 7 is structured as follows: In the first plot, the merged (as described in section 2.5) raw data from all sensors are presented. In the second plot, the heartbeat signal can be seen. Below this, the graph of the calculated heart rate value is displayed. The fourth plot represents the breathing signal after filtering. Finally, the graphic at the bottom visualizes the calculated breathing rate, which is stable for the displayed time interval. The small crosses on the heartbeat and respiration graphs tag the detected heartbeat or breathing peaks. 3.3. Evaluation with reference device Figure 8 represents the estimated heartbeat compared with the reference device output. It can be seen that the deviation is typically not higher than 4 bpm. An absolute match is not possible because both systems have small di ff erences in calculation intervals and approximation algorithms due to technical issues. However, both graphs are still very close and have maximal deviation of only 4 bpm. The mean deviation of the estimated heart rate from the reference device for all test persons and positions is presented in the Table 3. From the results presented in Table 3, it can be concluded that the real-time heart rate calculation (application “A”) is less accurate than the heartrates calculation afterward with the application “B”. The reason for this di ff erence is that the calculation afterward makes it possible to analyze the previous and future variations of the signal for every point of time, where the heartbeat has to be found. Therefore, the peaks can be found more accurately. The live calculation in real-time is based on data from the present and past for every point of time. Comparing di ff erent positions, it can be seen that the data recorded in the supine position is the most accurate for both measurements (deviation for realtime – 5.18 bpm and for afterward – 3.38 bpm). The results of measurement in the lateral position have the lowest accuracy (deviation of 12.32 bpm for real-time and 4.3 bpm for afterward measurement). This can be explained by di ff erent weight distribution and distance from the heart to the sensors. However, the deviations from the reference measurement are less different for the afterward calculation.
± Fig. 8. Deviation between a reference and measured values. Table 3. Deviation of estimated heartrate from reference device measurement. Deviation of live estimated heart rate (application “A”) [bpm] Deviation of heart rate calculated afterwards (application “B”) [bpm] Prone position Supine position Lateral position Prone position Supine position Lateral position Subject 1 4.1 (relaxed) 4.1 21.9 1.9 (relaxed) 3.2 6.1 Subject 2 12.8 (after sport) 4.3 10.1 5.9 (after sport) 4.6 4.0 Subject 3 12.9 6.9 12.6 3.1 1.7 2.8 Subject 4 3.7 6.2 (after sport) 9.9 3.2 3.6 (after sport) 3.0 Subject 5 9.3 4.4 7.1 6 3.8 5.6 Mean deviation 8.56 (relaxed) 5.18 12.32 4.02 (relaxed) 3.38 4.3 4. Conclusions The presented system uses pressure sensors placed below the mattress. This placement fulfills the requirement to design a non-obtrusive system to monitor breathing and heart rate. The performed cost calculation shows that the system is low-cost. The exactness of the measured signals (breathing and heart rate) need to be verified. Currently, the mean deviation of the real-time calculated heart rate compared to the reference device is 8.6 bpm, and the later derived calculation shows a deviation of 3.9 bpm. Di ff erent postures and heart rate frequencies were considered in the experiment design. The visualization of the obtained signal facilitates not only the indicating of respiration rate and heart rate but also an accurate plot of the breathing and the heartbeat graphs. Both can be used for further analysis, for example, for recognition of breathing interruptions (apnoea). Compared to state of the art systems that can be placed under the mattress (e.g. [20]) the proposed system has a similar accuracy – about 4% of deviation from the reference device for our system compared to 3% 3% for the [20]. However, the costs of described in this manuscript system are lower (125 € against 199$ for EarlySense Live based on presented in [20] research). Furthermore, the achieved results confirm that pressure sensors are suited to detect the signals mentioned. The placement of the sensors under the mattress ensures comfortable use without disturbing the users. The output of the system can be used, for instance, for the recognition of Wake/Sleep states [21] or sleep stages [22]. Despite the promising results, there is still potential for improvement. Further work is being done to improve the detection algorithm for peaks in the respiratory and cardiac signals. For example, an algorithm for recognition of typical heartbeat patterns (and not only peaks) could be the next step of the developent for achievement of more accurate results, especially in real-time analysis. A lower number of sensors would also be conceivable and it will be tested in future studies. It is also planned to conduct studies with a larger number of participants with di ff erent body mass indexes and covering di ff erent age groups. As far as hardware components are concerned, it is planned to