1 Introduction

Age-related changes in people’s health demands necessitate novel approaches due to the ongoing population rise, especially among the elderly. Health care benefits greatly from telemonitoring, especially for those with chronic illnesses. The daily data collection is made possible by the recording of vital signs, for instance on electronic equipment at home, which allows for continuous measures and inspections. By sending the gathered data to medical staff afterwards, it will be possible to reduce the number of unnecessary hospital visits by the population.

According to the International Classification of Sleep Disorders (ICSD) (Sateia 2014), there are two types of nighttime apneas that can be classified: Central Sleep Apnea (CSA) and Obstructive Sleep Apnea (OSA). CSA is defined as the absence of respiratory activity caused by a transient loss of the nervous stimulus headed for respiratory muscles during sleep. It is generally correlated to neurological or neuro-muscular diseases (Sharma et al. 2018), such as Alzheimer. Repeated episodes of total, partial, or protracted upper airway obstruction while you sleep are referred to as OSA. One in five American individuals has moderate OSA during sleep, which is more common than CSA according to accurate research using polysomnography (PSG) (Shamsuzzaman et al. 2003).

Sleep apnea and snoring have been proven to cause memory decline even at an early age. Authors of Osorio et al. (2015) showed that, in a group of subjects with Alzheimer’s and cognitive impairment but without memory problems, those with breathing problems during sleep were diagnosed with cognitive impairment almost 10 years earlier than people without these conditions. There are many therapies to treat OSA, such as nasal continuous positive airway pressure (Mar et al. 2003), however, it is far more important to prevent apnea. In Borel et al. (2012) has been shown that people who tend to be obese, smokers or excessive alcohol consumer, may be predisposed to OSA. For these reasons the first step to prevent OSA is to avoid alcohol, drugs relaxing the central nervous system (e.g., sedatives), smoke and to promote a weight loss. The OSA treatments must be accurate and carried out by specialist physicians (pulmonologists or neurologists), supported by nutritionists, maxillofacial surgeons and/or otolaryngologists.

To provide the ability to continuously monitor and prevent these treatments, a possible solution is the placement of an accelerometric sensor under the mattress with a subsequent accelerometric signal processing. In reality, varied information regarding a subject’s sleep quality may be gleaned from an overnight BallistoCardioGraphic (BCG) signal acquisition (Meriheinä 2017). This is made possible in part by a log that makes it possible to preserve all the sensor-extracted data. Utilising commercially available instruments, data must be processed to perform a classification analysis and, generally, to guarantee good measurement reliability (Inan et al. 2009).

A more general non-invasive analysis of physiological parameters based on the BCG signal, with focus on the heart rate extraction, has been carried out with two approaches in Mack et al. (2008), by studying changes in the relative positions of BCG peaks and by setting a threshold for BCG peak detection in combination with the derivative BCG waveform. The respiration detection was simplified considering a variable amplitude threshold. The results were compared with respect to ECG, pulse oximetry, and respiratory inductance plethysmography (RIP).

In another paper Zhao et al. (2015), authors applied the wavelet decomposition to extract the BCG signal in time-frequency domain in order to estimate the HeartBeat Interval (HBI) time series, obtaining a total average system precision of 90.46%.

In Liu et al. (2016), authors considered the event phase segmentation of the BCG signal; the respiratory pattern is extracted by exploiting an adaptive threshold-based division algorithm to distinguish between OSA and non-OSA events. By using Back Propagation (BP) neural network, 90% of OSA events are detected.

In Jaworski et al. (2019), authors compared the results obtained by combining actigraphy (Domingues et al. 2010) and BCG data with the gold standard PSG, and classified sleep/wake states by exploiting the integrated approach. The subjects participated to the tests have worn simultaneously an actigraphy sensor on their wrist, a PSG monitor, and contemporary, a BCG sensor has placed in the bed. The integrated system has shown an accuracy of 86.3%.

A commercial sensor (EMFIT) is used and compared with respect to a PSG, which is simultaneously used and taken as a reference in the unobtrusive BCG approach used in Huysmans et al. (2019), which has demonstrated the possibility for home monitoring screening of people suffering from sleep apnea. Locating the sensor in two different positions, close to the thorax and on top of the mattress, and developing an unsupervised algorithm based on Robust Spectral learning (RSFS) (Shi et al. 2014), the authors have demonstrated the similar results extracted with the sensor and the PSG.

More recently, authors of Bernardini et al. (2021) have proposed the use of convolutional deep learning architectures to extract key features from physiological signals. Models based on such an architecture are then exploited to detect OSAS events in stroke unit recordings obtained from the monitoring of unselected patients. Convolutional recurrent neural network are also used in Choi et al. (2022), where, in combination with a 60 GHz frequency-modulated continuous-wave (FMCW) radar, demonstrate the feasibility of the automated detection of apnea-hypopnea events for OSA diagnosis on a dataset consisting of 44 subjects.

Finally, a different approach based on a wearable system is proposed in Maritsa et al. (2021). Human contexts such as breathing, heartbeat pattern, and swallowing are recognized using an audio sensor with an accuracy of 76.9%.

This study aims at deepening the work done in Gambi et al. (2021). We propose the implementation of a home autonomous monitoring, alternative to the traditional intrusive ElectroCardioGraphy (ECG) or PSG techniques, by exploiting the BCG signal analysis, which is a well-known non-contact approach to measuring vital factors, such as heartbeat and respiration (Nurmi 2016). Instead of using electrodes in direct contact with the skin or a respiration belt fastened to people’s chests, an accelerometric sensor that monitors and records mechanical body vibrations induced by heart activity is used to collect the BCG signal. The same instrument acquires vibrations from the subjects’ breathing activities as well as from the body’s movements while they are sleeping. As a result, to retrieve the needed information, a suitable processing method must be applied to the signal obtained from the device. The purpose of this work is to describe the accelerometric signal processing in order to detect and determine heart rate, respiratory rate, and to recognize the presence of night apneas or different activities, using a commercial accelerometric sensor.

The rest of paper is organised as follows. Section 2 introduces the BCG signal and the sensor calibration, while the methodologies for the heart rate and respiratory rate estimation are presented in Sects. 3 and  4, respectively. In Sect. 5 the method for identifying sleep apnea is outlined, and the system’s results are presented, while in Sect. 6 the signal processing for automatic actions recognition is shown. Finally, Sect. 7 provides some conclusive remarks.

2 The BCG signal

Mechanical forces connected to the subjects’ heart activity produce the BCG signal (Meriheinä 2017). The mechanical activity of the heart expelling blood causes the body to recoil, which can be observed in the form of a graph to produce the BCG signal and reveal information about the overall functionality of the circulatory system (Manjula and Sharma 2016).

Gordon (1877) and Henderson (1905) are credited with developing BCG, which describes how changes in the subject’s posture while they were standing still on a scale were detected by the needle and synchronized with their heartbeat. The blood that was discharged from the aorta was identified as the source of these variations, and it was directed in the other way (Manjula and Sharma 2016; Kurumaddali et al. 2014; Inan et al. 2014). In fact, the basic principle of BCG is that for every mass movement that occurs within the human body, there is an opposite movement (Shao et al. 2016) intended to maintain the human body’s center of mass undisturbed. Therefore, blood movements in the vasculature cause a displacement of the center of mass, and the BCG signal captures the minute movements linked to the reflux forces that oppose this displacement in order to maintain the total moment (Inan et al. 2014).

Fig. 1
figure 1

Acceleration directions

The records are expressed in terms of three-dimensional acceleration (see Fig. 1). In contrast to transverse BCG (x-axis), which measures the back-ventral movements (Inan et al. 2014), we will exclusively use the longitudinal BCG (y-axis) in this work, which measures the deformations of the body in a head-to-foot orientation. The equipment used must be placed under the mattress.

The BCG signal can be interpreted using a variety of parameters, and it can be detected by a number of sensors (for example, force and pressure sensors, extensometers, piezoelectric sensors, etc.). In this work the measurements have been carried out with MEMS type sensor (Meriheinä 2017), an electromechanical device with integrated control, data acquisition and signal conditioning circuit. It has one or more axes (e.g., a triad of orthogonal vectors, see Fig. 1). Since acceleration a is a vector, it can be measured as the scalar product of its module by the cosine of the angle between their directions (e.g., x-axis, \(a \cdot cos(\theta )\)) of the MEMS. Similar to the ECG, the BCG signal consists of characteristic peaks (see Fig. 2) corresponding to the cardiac activity and peripheral circulation.

Fig. 2
figure 2

Typical trend of BCG signal with respect to the ECG. The R peak of ECG is the equivalent to the J peak of BCG

The BCG peaks can be described as follows.

  • H is the first positive peak, synchronous to ventricular isovolumetric contraction, in pathological conditions its amplitude may exceed the J peak;

  • I is the first negative peak, representing the ventricular systole;

  • J is the maximum peak, analogous of the R peak of ECG signal, identifies the blood acceleration in the descending aorta;

  • K peak is the blood deceleration that reaches the minor vessels, it is synchronised with the closure of the semilunar valves;

  • L, M, N peaks reflect the conditions of peripheral circulation.

The J peak is the most representative peak in order to detect the beats and measure the heartbeat. In fact, the J peak is more easily recognized in comparison to the other peaks due to its amplitude, which is larger than the other peaks and is caused by the acceleration in the head-foot direction, i.e., the foot-head reflux force.

2.1 Calibration, operating and transmission mode

The Murata SCA11H (Meriheinä 2017), a tiny sensor (\(83.7 \times 40.7 \times 17.6\) mm) that may be used for tests carried out both in hospitals and at home, is a commercial device that was used to acquire the BCG signal for the experiments described in this study.

After the device has been placed correctly, the calibration process must be carried out. Since it sets up the sensor to record the vibrations transmitted on the measurement bed, the calibration phase is crucial. The calibration method must be carried out again each time the measuring environment changes. The method is based on two one-minute long BCG signal acquisitions, the first with an empty bed and the second with the bed occupied by the person who will be tracked. Following calibration, the sensor produces a stream of 1000 accelerometric measurements per second.

The configuration phase is useful for the choice of the sensor operating mode, which is programmed to work in:

  • RAW MODE or DATA LOGGER: the sensor processes a signal with a frequency of 1000 samples per second.

  • BCG MODE: the sensor updates, with a frequency of 1 Hz, ten parameters which provide to physiological information relative to the patient, but different from the BCG signal; in this case it is necessary to carry out a more meticulous calibration procedure, including threshold values to identify any movement or noise artefacts.

The possible transmission modes are as follows:

  • CLOUD MODE: mode to be selected when the sensor is operating in BCG MODE, since it provides an interface by which it is possible to have access to the real-time updating of the ten vital output parameters, but there is not the possibility to save them in a file.

  • LOCAL MODE: transmission mode related to operation in DATA LOGGER, which offers the possibility to transfer the data processed by the sensor directly to the PC using the WiFi network, selected in Network Settings, to which both the device and the PC are connected.

In this work, the analyses were carried out by setting the sensor in DATA LOGGER and LOCAL MODE. The data acquisition was made possible thanks to a Python extension program, generating a text file consisting of data in hexadecimal format, updated once per second. It is used an additional program, written in C++, through which it was possible to convert the acquired data into decimal format, in order to obtain the text file containing the “raw data” which represent the raw BCG signal.

3 Cardiac rate estimation

With the aim of obtaining information on heart rate from a raw BCG signal a test involving a healthy subject was considered, during an entire night with alternation of sleep and wake phases, where the subject under test was asked to sleep in a supine position.

Fig. 3
figure 3

Time trend of the entire signal acquired during the night; the 30 min signal range, on which the analysis will be performed, is highlighted in black

In our analysis, a time window of about 30 min of the signal is firstly isolated, being characterised by a trend as regular as possible, in order to process the signal present in this time interval (Fig. 3). With the selection of this time window the peaks of the signal, due to involuntary movements of the subject, are avoided.

Fig. 4
figure 4

Time Trend of a window of 30 s of the raw BCG signal; the numerous peaks are associated with artefacts

Fig. 5
figure 5

BCG band-pass filtered in [1,12] Hz and J peaks

For a better data visualisation, a sub-interval of the chosen time window of about 30 s (see Fig. 4) is extrapolated, where it is visible that the signal due to heart activity is overlapped by noise and a periodic oscillation related to the movement of the subject. The desired signal is then filtered in the frequency range of [1, 12] Hz, by applying two 6th-order Butterworth filters. This ensures a signal output that is free of the high frequency components responsible for the noise, but which continues to be overlapped by a periodic oscillation (as visible in Fig. 5) due to the low frequency components related to the presence of the respiration contribution (Lydon et al. 2015). Among these peaks, it is however possible to recognise the J peaks (highlighted in Fig. 5), which will be fundamental for heart rate extraction.

Fig. 6
figure 6

BCG signal squared and threshold value

In order to discriminate the oscillations of the respiration from those that can be associated with the peaks J, each sample of the signal is raised to the squared, the signal is so called Filtered Squared Signal (Manjula and Sharma 2016), but keeping its sign, and a fixed threshold in amplitude is applied, in our case with a value of 20. All the samples below the threshold are forced to zero, while the others retain their value (Fig. 6). A further filtering it is carried out, consisting of two 6th-order Butterworth filters, a high-pass type with a cutoff frequency of 0.8 Hz and a low-pass type with a cutoff frequency of 2 Hz. The choice of the filters frequency range [0.8, 2] Hz is related to physiological reasons. In fact the heart rate of a healthy adult subject at rest is about 1 Hz (i.e. there are about 1.16 beats in a second).

Fig. 7
figure 7

BCG signal filtered and J peaks marked

Figure 7 shows the BCG signal filtered and J peaks are now distinguishable. The beat-to-beat time corresponds to the time distance between two adjacent J peaks (J–J interval), while the Heart Rate (HR) mean in bpm is calculated as 60/\((J_i - J_{i-1})\), where \(J_i\) is the ith peak and \(J_{i-1}\) is the previous adjacent peak.

Fig. 8
figure 8

a Heart rate (HR) time trend and HR mean extracted in the portion of 30 min of the signal. b J–J peaks time trend and J–J mean in the portion of 30 min of the signal

Finally, Fig. 8a and b show the HR time trend and the J–J time trend, respectively. In the test, the HR mean estimated by considering the entire sequence of the 30 min of the signal is 69.3 bpm, as shown in Fig. 8a.

4 Respiratory rate estimation

The respiratory rate estimation is processed from the same signal acquired for the heart rate measurement. The same portion of 30 min of the signal is investigated. In order to clarify the results, the analysis is conducted on the window of 30 seconds in the portion considered. A 6th order low-pass type Butterworth filter is applied to the initial acquisition of the “raw” signal, with a cutoff frequency of 0.7 Hz, with the aim of removing the components located in a frequency range higher than that of the respiratory rate.

It is possible to note in Fig. 9a that the filtered resulting signal is strictly dependent on respiration, since the signal trend varies over time with a R–R interval (we call R the peaks related to the respiration signal to discriminate them from J peaks related to the heart rate) of about 3–4 s (measurable by observing the distance between adjacent R peaks). According to human physiology, in a healthy subject at rest the respiratory rate is around 0.2–0.4 Hz, equivalent to a respiratory periods between 2.5 s and 5 s. In order to extract the respiratory period, it is necessary to analyse the useful peaks of the signal, by squaring it in the positive half-plane of the y-axis, called Breaths signal.

Fig. 9
figure 9

a Respiration signal as a function of time, filtered with a 6th order Butterworth low-pass filter. b Breaths signal with R–R peaks highlighted

The output signal is shown in Fig. 9b. In the case of a subject under test regularly breathing, one of the following approximations can be used to overcome the problem of the presence of false peaks.

  • In presence of peaks too close each other to be considered more than one, these can be replaced with a single peak located in the middle.

  • Both in presence of peaks too close or too distant each other, the value considered in the previous instant can be attributed to the cardiac period.

Similarly to what has been presented for the heart rate, the graph as a function of time in Fig. 10 shows all the values taken from the respiratory rate (Fig. 10a) and respiratory period (Fig. 10b) and their mean values calculated over the signal portion of 30 min considered.

Fig. 10
figure 10

a Respiration Rate (RR) and b R–R peaks as a function of time

5 Automatic sleep apnea recognition

Subjects 1 and 2, whose data are reported in Table 1, were involved in the tests for the automatic sleep apnea recognition. With the intention of examining the respiratory trend, both participants are supine on the bed. The volunteers were instructed to adjust their breathing pattern in order to alternate between the two conditions described below:

  • REST: subjects breath with a regular and natural trend.

  • APNEA: subjects hold the breath for an interval that can physiologically simulate the apnea phenomenon.

Table 1 Characteristics of the subjects under tests for automatic sleep apnea recognition

Due to the similarities in the results between Subjects 1 and 2, we will only include the graphs for Subject 1 in this report. The signal recorded for Subject 1 is 7.5 min long. After obtaining the raw accelerometric signal, the application of a 6th-order Butterworth filter of the low-pass type with a cut-off frequency of 0.7 Hz is needed to remove components other than those related to respiration. At this point, the characteristic relating to the amplitude of the apnea intervals is taken into consideration when developing the automatic apnea recognition method. In fact, the signal is subjected to a set threshold with an amplitude near to zero, forcing any samples below the threshold to be eliminated while the others keep their value. We are able to retrieve the test subject’s breathing pattern in this way. However, it is crucial to keep in mind that the signal still contains a number of low-frequency noises brought on by movement artefacts despite the filtering procedure, which is why we chose a threshold value in amplitude slightly higher than zero, roughly 0.2, marked in red in Fig. 11.

Fig. 11
figure 11

Filtered BCG signal time trend for Subject 1 with application of the amplitude threshold

The respiratory period, or the space between two successive peaks in breathing, is also computed by the automatic sleep apnea recognition method. The calculated mean R–R time interval ranges from 0.8 to 0.95 s. As a result, it is safe to state that a sleep apnea is unquestionably present if the time interval between two adjacent R peaks is larger than 20–30 s. The automatic algorithm works according to the following steps:

  1. 1.

    All signal intervals with a distance between adjacent R peaks greater than 20 s are highlighted.

  2. 2.

    The value of this “abnormal” distance is associated with the duration of the identified relative apnea.

  3. 3.

    Events of the number of apneas and the corresponding duration are noted on the graph above each abnormal interval.

The algorithm outcome is shown in Fig. 12, where apnea activities were identified with the relevant time duration.

Fig. 12
figure 12

Number and duration of sleep apnea activities (denoted as A) detected by the automatic recognition algorithm

It is also feasible to analyze the signal in the frequency domain by using the Fast Fourier Transform (FFT), as illustrated in Figs. 13 and 14, to increase the accuracy of the automatic approach for recognizing apnea periods. The frequency spectrum of each REST-APNEA interval is examined and isolated in order to determine the greatest frequency peak.

Fig. 13
figure 13

Rest maximum frequency peak extracted with FFT

Fig. 14
figure 14

Apnea maximum frequency peak extracted with FFT

6 Automatic actions recognition

As previously described, the processing of the signal generated by the accelerometric bed sensor allows to detect the vital parameters of the subjects in a completely non-invasive and unobtrusive way. The same signal can be used for the recognition of particular actions during sleep, or for the identification of any sleep apnea. In order to recognise different activities performed on the bed, three potentially healthy adult subjects participated in the test, whose age, sex and body mass index (BMI) are reported in Table 2.

Table 2 Characteristics of the subjects under tests for automatic actions recognition

Subjects 3, 4 and 5, lying on the bed, performed four activities as described in the following.

  1. 1.

    REST: subjects stay for one minute at rest in supine position

  2. 2.

    TALK: subjects were asked to talk for one minute in supine position

  3. 3.

    MOVE: subjects were asked to change their position from supine to lateral

  4. 4.

    REST: subjects remain one minute at rest in lateral position

  5. 5.

    TALK: subjects were asked to talk for one minute in lateral position

  6. 6.

    MOVE: subjects were asked to change their position lateral to supine

  7. 7.

    REST: subjects remain one minute at rest in supine position

  8. 8.

    MOVE: subjects were asked to leave the bed

  9. 9.

    EMPTY: the bed remains empty for about 30 s.

With the purpose to automatically recognise these activities, a calibration phase, consisting in setting specific ranges in amplitude and variance, is applied. The signal is therefore split into intervals and the corresponding activity is assigned to each one, with respect to variance and amplitude values which characterise the signal portion. Finally, the signal is represented in diagrams with four colors, each one associated to a specific activity as follows.

  • R \(\rightarrow\) Red \(\rightarrow\) Empty

  • G \(\rightarrow\) Green \(\rightarrow\) Rest

  • B \(\rightarrow\) Blue \(\rightarrow\) Talk

  • K \(\rightarrow\) Black \(\rightarrow\) Move

Looking at the acronym associated to the corresponding activity, we decide to call the signal “RGBK”.

Figure 15 shows the signal, related to Subject 3, in its original form, before being processed by the activity recognition algorithm.

Fig. 15
figure 15

Original signal of Subject 3

Figure 16 shows the RGBK signal corresponding to the different activities performed by Subject 3. The activities have been distinguished with high precision, proving that the algorithm is able to discriminate the different phases of the test.

Fig. 16
figure 16

RGBK signal of Subject 3 after the application of the activity recognition algorithm

The RGBK signals for the tests performed by subjects 4 and 5, after the application of the activity recognition algorithm, are depicted in Fig. 17 and in Fig. 18 respectively.

Fig. 17
figure 17

RGBK signal of Subject 4 after the application of the activity recognition algorithm

Fig. 18
figure 18

RGBK signal of Subject 5 after the application of the activity recognition algorithm

The system performance results very accurate for both Subjects 3 and 4, since it is possible to identify the different activities performed during test (Figs. 1617). On the contrary, the RGBK associated to Subject 5 (Fig. 18) does not report differences between the REST and the TALK activities. This problem could be due to the following reasons:

  1. (a)

    The body mass index (BMI) of subject 5 could be too low to produce detectable TALK activity; a study (Albukhari et al. 2019) stated that BMI values too low or too high should be excluded from tests, since they produce unreliable data.

  2. (b)

    Subject 5 could have particular vocal characteristics (i.e., extension, acoustic intensity, timbre,...) that do not allow to discriminate the TALK activity with respect to the others.

According to these hypotheses, we carried on the analysis of the signal spectrum of subject 5, in particular for what concerns the signal portion related to the TALK activity, shown in Fig. 19, comparing it with respect to the spectra of subjects 3 (Fig. 20) and 4 (Fig. 21).

Fig. 19
figure 19

TALK spectrum for Subject 5

Fig. 20
figure 20

TALK spectrum for Subject 3

Fig. 21
figure 21

TALK spectrum for Subject 4

It is evident that the spectra of the three subjects have substantial differences, which can be summarised as follows.

  1. 1.

    Subject 3 exhibits an amplitude in the order of 105, clearly greater than the others, whose amplitude is in the order of 104. The reason of this amplitude difference is probably due to the fact that subject 3 is a male adult and his acoustic intensity is higher than the others, who are feminine adult subjects.

  2. 2.

    Both Figs. 20 and 21 show a similar trend of the peaks at low frequency, around 3.5 Hz, which is also exhibited by subject 3 in Fig. 19. This observation, together with the three peaks located around 5, 6 and 9 Hz in both spectra of subjects 4 and 5, suggests that these subjects have a comparable vocal range.

7 Conclusion

In this work we have demonstrated, through a series of different analyses, the feasibility of a cardio-respiratory monitoring technique and its benefits in terms of cost, versatility and comfort. The main problems, which hindered the use of an accelerometer as a device for the detection of physiological parameters, concerned the quality of the signal, sometimes compromised by movement artefacts. Despite this problems, the use of accelerometric sensors presents several advantages. For example, the ease of installation in nursing homes allows people to avoid excessively long waiting times caused by the exclusive use of PSG. In fact, this could represent a seriously harmful problem for those who urgently need a diagnosis and therefore to undertake adequate therapy. The accelerometric device is useful not only to study the sleep quality by monitoring a person lying on a bed; moreover, it could be employed in a wide range of applications. It constitutes a non-invasive approach to verify the “bed occupancy”, in order to monitor (e.g. in hospitals or nursing homes) if the patient is actually in bed or not. Finally, the use of accelerometric sensors is often fundamental to prevent sleep apnea, thus avoiding a risk condition that may imply serious repercussions on health. Future works will involve collecting data from a larger number of subjects and with different devices, including gold standards, in order to expand the dataset and increase the research.