SciELO - Scientific Electronic Library Online

vol.34 issue2Development of radiofrequency ablation device for surgical hepatocellular carcinoma treatment in agreement with Brazilian standardsQuantitative MRI data in Multiple Sclerosis patients: a pattern recognition study author indexsubject indexarticles search
Home Pagealphabetic serial listing  

Services on Demand




Related links


Research on Biomedical Engineering

Print version ISSN 2446-4732On-line version ISSN 2446-4740

Res. Biomed. Eng. vol.34 no.2 Rio de Janeiro Apr./June 2018  Epub May 28, 2018 

Original article

Alternative class III distributed polysomnography system

Felipe Britto Azevedo Schneider1  2  * 

Alexandre Secchin de Melo3 

Rodrigo Varejão Andreão3 

Rodolfo de Figueiredo Dalvi4 

1 Assisted Technology Group, Federal University of Espírito Santo, Vitória, ES, Brazil.

2 i9Lab – Laboratório de Inovação Tecnológica, Vitória, ES, Brazil.

3 Department of Electrical Engineering, Federal Institute of Espírito Santo, Vitória, ES, Brazil.

4 Laboratory of Computation and Neural Systems, Federal University of Espírito Santo, Vitória, ES, Brazil.



Impairment of sleep quality directly increases the risk of heart attack, obesity, and stroke, among other conditions, which makes polysomnography (PSG) an important public health tool. However, the inherent problems with PSG render the correct diagnosis of sleep diseases a difficult task. As a novel alternative to the class II PSG system, this work presents a distributed system composed of three modules, which together are capable of the simultaneous monitoring of environmental variables and patient signals. This system could reduce the distress of a PSG exam in certain cases, dismiss the need for an overnight sleep in a healthcare/sleep centre, and facilitate self-setup and internet-based diagnosis.


Hardware and software capable of synchronously monitoring, processing and logging into a µSD card environmental parameters (temperature, humidity, visible light intensity and audible noise level) and directly measured patient signals (electrocardiogram, electrooculogram, and body and limb posture) were designed and implemented.


A novel alternative to the class III PSG system was demonstrated with independent boards capable of operating for more than 16 hours powered by a 750 mAh/3.7 V battery with 0.003% data loss during preliminary PSG exams. Additionally, a computer-based library capable of reading, decoding, estimating respiration through ECG, and calculating the heart rate was developed and described.


This article contributes to PSG research through the development of a new PSG system and the improvement of patient comfort. All software and hardware developed are fully open source and available on GitHub.

Keywords Polysomnography; Biomedical instrumentation; Sleep; EDR; Homecare


Many studies have correlated sleep diseases with chronic cardiovascular diseases, obesity, diabetes and depression ( Grandner and Pack, 2011 ; Kawada, 2015 ; Ramos and Gangwisch, 2015 ). Even in patients without major sleep problems, the reduction in sleep quality alone may affect mood, concentration and learning ( Müller and Guimarães, 2007 ).

In-laboratory polysomnography (PSG) is the gold standard exam for the diagnosis of sleep diseases and impairments ( Jafari and Mohsenin, 2010 ). PSG equipment and procedures can be sorted into four classes originally created by the American Academy of Sleep Medicine (AASM) ranging from the most complex (class I) to the least complex (class IV) (American…, 2012a; Jafari and Mohsenin, 2010 ).

Class I or II PSG is characterized by the presence of an electroencephalogram (EEG) together with at least seven other sensors, such as electro-oculogram (EOG), electromyogram (EMG), respiratory flow and effort. This type of exam directly interferes with patient comfort and sleep quality, which are disturbed by the number of sensors, connectors and equipment placed on different locations of the body. Moreover, PSG class I requires an overnight stay at a sleep centre, which may trigger a syndrome known as the “first night effect” ( Agnew et al., 1966 ). All of these issues have an important influence on the variable of interest: the sleep itself. Additionally, PSG class I or II is an expensive exam and is normally not easily accessible to the majority of the population, even in wealthy countries, resulting in long waiting lists ( Escourrou et al., 2000 ; Flemons et al., 2004 ). However, the precision of class IV PSG is not sufficient to identify and diagnose most sleep diseases because it is composed of only one or two sensors. Class III is composed of four or more sensors, and an important class III feature is the absence of an electroencephalogram (EEG). This absence makes it impossible to discern between the internal non-rapid eye movement (NREM) stages (N1, N2 and N3). However, the presence of other biological markers makes it possible to distinguish among the sleep macrostructure phases of wakefulness (W), NREM and REM sleep.

According to the specialized literature, class III polysomnography must also be capable of detecting sleep apnea. To achieve this goal, the common recommendation is that oximeter and respiration signals should both be monitored. Although new portable devices have been proposed to acquire these signals, the discomfort caused by cables and sensors remains a problem ( Cattrysse et al., 2014 ; Goodrich and Orr, 2009 ). To minimize discomfort, some studies have proposed the elimination of a specific respiration sensor with the use of ECG-derived respiration approaches ( Penzel et al., 2000 ; Sharma and Sharma, 2018 ; Song et al., 2016 ). Moreover, Song et al. (2016) showed that it is possible to detect obstructive sleep apnea using ECG signal processing.

Several studies have noted a reduction in patient distress using two distinct approaches: the use of new sensor methods, i.e., Doppler radar ( Lubecke and Boric-Lubecke, 2009 ) or a piezoelectric sensor attached to the bed and pillow ( Lokavee et al., 2012 ), and the use of modular PSG solution, which is composed of smaller and possibly wearable modules ( Chang et al., 2012 ). The use of actiography (ACTG) was stated as a promising alternative in a systematic review conducted by Van de Water et al. (2011) even though this technique tends to overestimate the sleep time in patients with low sleep quality, which diminishes its accuracy.

Nonetheless, the new sensor methods are not suitable for home-care use because they are expensive and are capable of monitoring only a few patient parameters, and together with relatively low accuracy, a less appropriate environment for diagnosis is created. Furthermore, the system presented by Chang et al. (2012) is not composed of specialized boards, which increases the system volume and patient distress. Furthermore, this setup does not monitor ambient parameters.

To this end, this paper proposes an alternative class III polysomnography method that acquires environment variables together with biological data from the patient, such as ECG, ECG-derived respiration (EDR), and EOG.

Environmental conditions do influence sleep quality ( Halperin, 2014 ; Okamoto-Mizuno and Mizuno, 2012 ; Rosenthal et al., 1990 ), but they also influence other important parameters not directly related to sleep, such as cardiac autonomic response during sleep ( Okamoto-Mizuno and Mizuno, 2012 ).

Thus, environmental and biological data allow a physician to infer whether one or more arousals was caused by physiological reasons (apnea or restless legs) or environmental reasons, thus improving treatment.

This is the first report of a modular sleep monitor that meets the main class III PSG requirements and captures environmental variables such as temperature, humidity, visible light intensity and audible noise level. All of the software and hardware designed and developed in this study are available at the first author’s Github page ( Schneider, 2017 ).


Proposed modular system

The proposed system is divided into three modules denominated in this work as MD-EOG, MD-ECG and MD-ACC. The boards can acquire different signals from the patient and from the environment to compose a complete scenario. Thus, an expert physician can determine and distinguish among the W, REM and NREM sleep stages.

The MD-EOG (82×60 mm) is the only module that should not be placed on the patient’s body, and instead, it should rest on the bedside. This approach is necessary because this module is responsible for acquiring environmental data. The MD-ECG (81 × 40 mm) is responsible for acquiring the ECG signal and the trunk posture and has the ability to acquire and store data from two external analog three-axis accelerometers and a commercial SpO2 module. The MD-ECG remains inside a pocket on an elastic strap, which is fastened on the patient's trunk just below the chest. This installation position allows the patient to turn over in bed during sleep.

The MD-ACC module (54×28 mm) is attached to the patient’s right ankle with a strap similar to the one used in the MD-ECG and is responsible for acquiring and storing the patient’s limb posture and movement using a triaxial accelerometer.

Only two constraints apply for the use of the boards. The first constraint is that the boards must be powered by batteries, since the actual hardware project does not cover the safety requirements presented in IEC-60601 and related standards for line-powered equipment. This first limitation is not necessarily a problem because the boards are powered by 750 mAh batteries (10.8×24.8×46.0 mm) and supply at least 16 consecutive hours of sleep monitoring. This long operation period is achieved using low-power-consumption components and proper circuit design. The monitoring period could be amplified by placing the microcontrollers (µC) into deep-sleep mode and reducing the sampling frequency, but further research must be performed to evaluate the impact of these actions on the system performance.

The second constraint is that all of the boards must be synchronized prior to the start of data acquisition. The synchronization is achieved by wiring the three boards together and pressing a button placed on the MD-EOG board for 2 seconds. This type of wiring process is shown in Figure 1 .

Figure 1 Finished modules presented (left) from top to bottom: MD-EOG, MD-ECG and MD-ACC. The coin has a diameter of 25 mm. The red circle highlights the synchronization button. On the right, the prototype encapsulation and all wire connections must simultaneously start the data acquisition.  

Any module can be removed from the system without harm to the functionality of the other modules. This is an important feature that enables a less intrusive sleep monitoring system if a system of this nature is needed. It is also possible to use boards similar to those presented in this work to monitor bioelectric patient signals such as the electromyogram (EMG) and EEG with restrictions.

Sensor features

The boards are equipped with 8-bit ATXMEGA microcontrollers (ATXMEGA128A1U in MD-ECG and MD-EOG and ATXMEGA128A4U in MD-ACC). The variables acquired by the complete distributed system shown in Figure 1 are summarized in Table 1 and described as follows:

Table 1 Data acquisition main characteristics. 

Variable Main acquisition device Sampling rate Signal & ADC resolution Acquisition protocol Maximum range
EOG ADS1293 400 Hz 10 nV – 24 bits SPI ±0.80 V
ECG ADS1293 400 Hz 10 nV – 24 bits SPI ±0.80 V
Ambient Sound Noise Demodulation circuit 100 Hz 12 bits µC ADC 52 to 84 dBA
Patient movement ADXL335 40 Hz 0.006 g – 12 bits µC ADC ±3 g
Ambient Iluminance OPT3001 10 Hz 0.01 lux 1 23 bits I2C 0.01 to 83k lux
Ambient temperature HDC1050 1 Hz 0.01°C 2 14 bits I2C -40 to 125 °C
Ambient humidity HDC1050 1 Hz 0.006%RH 14 bits 3 I2C 0 to 100% RH 4
Battery voltage ADC Atxmega 1 Hz 0.02 V – 12 bits µC ADC 0 to 5.2 V

1Lowest full-scale range;

2Accuracy of ±0.2°C;

3Accuracy of ±3%;

4Without condensation.

    •. Bipolar EOG and ECG: These measurements have an analog front end via the ADS1293 integrated circuit (IC), which is specialized for acquisition of bioelectrical signals from the human body with a 24-bit analog-to-digital converter (ADC) and dedicated circuits such as the right leg drive (RLD) that reduce the common mode noise. These signals are sampled at a rate of 400 Hz, which is twice the minimum recommended by the American Association of Sleep Technologists (AAST) (American…, 2012b). Additionally, the EOG and ECG cables are electrically shielded and produced specially for this system to improve patient mobility and size reduction. A set of 1 kΩ patient protection resistors is placed in the boards to avoid use of the traditional box for connectors used in ECG cables;

    •. Ambient sound noise level: To detect the levels and noise spikes in the audio signal that might disturb sleep, a circuit based on discrete components was developed to extract the envelope of the signal (smooth curve outlining the extremes of a signal). The audio signal is captured by an electret microphone and is amplified and passed through an amplitude demodulation stage to extract its envelope. The circuit used to achieve this goal is presented in Figure 2 and is explained in the ambient noise amplification and demodulation circuit (ANA) section;

    Figure 2 Ambient noise amplification and demodulation circuit. 

    •. Patient accelerometry: The presented system uses two three-axis accelerometers (ADXL335), placed on the trunk and on one ankle, with both running at a sampling rate of 40 Hz to enable the system to estimate patient posture and movement. These parts supply information that improves the sleep scoring and allows future correlation of sleep quality and body posture for a specific patient;

    •. Ambient illuminance: This process uses an OPT3001 sensor, and is sampled at 10 Hz. This component has spectral sensitivity similar to that of the human eye (Texas…, 2014);

    •. Ambient humidity and temperature: This sensor uses a HDC1050 part and is sampled at 1 Hz;

    •. Battery voltage: Via a resistor divider, the battery voltage is sampled at a rate of 1 Hz and prevents overdischarge of the battery and possible battery damages.

Management of different sampling rates and system coherence is assured by the use of a single high-priority microcontroller internal timer interruption and individual software pre-scalers. These features were also needed to assure that in the worst-case scenario, the sampling of all variables does not take longer than 2.5 ms.

For EOG and ECG, the resolution and maximum range were derived by comparing the sampled signal to a referenced signal. For ambient sound noise, the values were calculated after calibration (additional information is supplied in the ambient noise amplification and demodulation circuit (ANA) subsection). For patient posture (accelerometer) and ambient temperature/illuminance/humidity, the values were calculated or directly extracted by referencing the respective component datasheets.

The OPT3001 and HDC1050 parts are fabric calibrated, and their datasheets supply equations to convert the raw data into their respective units of interest (Texas…, 2014; 2015). A first-order three-point fit (-1 g, 0 g and 1 g) was conducted to calibrate each accelerometer axis.

Ambient noise amplification and demodulation circuit (ANA)

As previously mentioned, an ANA has been developed and is fully presented in Figure 2 . The ANA circuit is divided into three stages; its functionality is now briefly described.

The first stage, known as the pre-amplifier, is responsible for feeding a DC bias current into the electret microphone’s internal JFET. In the presence of sound waves, an AC current component is added to the DC, and only the AC component passes through the 2.2 µF capacitor placed between the electret microphone and the inverting input of the operational amplifier (OPA). This component is pre-amplified by the first OPA, which also adds a voltage offset to the signal. This first stage was developed based on the one implemented by Caldwell (2015) .

The second stage is the amplifier and is responsible for removing a portion of the initial offset and supplying an extra gain. All resistor values were adjusted while measuring the output port of the second OPA with the aim of reducing the DC offset in a relatively quiet office room and simultaneously avoiding saturation of the signal with the audio produced by close human conversation.

The third stage is the envelope-capture circuit and is responsible for rectifying the signal and extracting its envelope or energy. The analog-to-digital conversion pin (represented by ADC) is connected to this circuit through a resistor divider. This component is necessary because the ANA is powered by 6.6 V, which is twice the ADC voltage reference. Supply of the ANA with 6.6 V is required for correct operation of the electret microphone. Any single-supply and rail-to-rail operational amplifier with an appropriate frequency response could be selected to replace the OPA2333 presented in Figure 2 . The full board circuit is available at the first author’s Github page ( Schneider, 2017 ).

After complete manufacture of the board, the calibration of the audio circuit was conducted with the aid of the decibel meter CR:162C, which was set up to operate with an ‘A’ attenuation curve. Both the decibel meter and the board were positioned equi-distant from the computer speakers in a quiet and closed room. The computer executed a script based on the Sox Software Audio Synthesizer ( GitHub, 2013 ), which synthesizes a wide spectrum of white noise and changes its volume every 10 seconds from the lowest (30% of the sound system capacity) to the loudest (80%) setting in steps, i.e., 30%, 35%, 40%, etc. Between one step and the next, the value in decibels was noted. Notably, preliminary tests showed that volumes below 30% did not have sufficient intensity to sensitize the proposed circuit, and volumes above 80% saturated the system.

Calibration was conducted by comparing the sound level recorded by the CR:162C with a 7-second average of the signal recorded by the MD-EOG. A first-order polynomial was calculated by fitting the base 10 logarithm of the digital sound values read by the MD-EOG and the dBA values read out from the CR:162C. The fit has a maximum error of 0.75 dBA. The fitting equation and its characteristic coefficients (with 95% confidence bounds) are presented in ( Equation 1 ):

YdBA=log10(XAD)*p1+p2where: p1=24.05±1.1 and p2=3.005±3.36 (1)

When implemented, this technique permits sampling of the signal by the µC at a low rate, more precisely, at 100 Hz instead of 44.1 kHz, which is a common sampling rate for audio signals. Such a high sampling rate demands much more memory and hardware processing capabilities, which are incompatible with the proposed hardware. Furthermore, using the signal envelope instead of the entire signal grants privacy to the patient.

Data storage features

The firmware implemented for each µC uses the FATFS library (version 0.11a), which is an open-source library written in C by Chan (2016) and is able to create, open and handle FAT32 files in flash storage devices while consuming less than 16 KB of µC flash memory, and in doing so, it dismisses the need for an additional datalogger board.

After the synchronous start of data collection, each board sends a package of data collected every second to its respective µSD card. Beyond the data, this package contains a header, an id number, and a 2-byte checksum that allows the descriptor program to identify package loss and data corruption.

Prior to the overnight tests, a benchmark of the FATFS library at the chosen µC architecture was constructed by writing generic packages with different sizes into the SD card. The library throughput varies from 625 Bps when a package size of 16 bytes is chosen to near 24 KBps when the system is configured for packages of 2 KB.

The amounts of data generated by the boards per second are 1694 (MD-EOG), 1926 (MD-ECG), and 246 bytes (MD-ACC). For these package sizes and using the worst matching system throughput, the process that saves the data acquired by the modules into the µSD card takes 8.5 ms, 9.6 ms and 5.6 ms, respectively. This process reduces the time needed to store the data, and a double buffering process and a microcontroller capable of handling multiple priority interruption ensures the system coherency.

The storage features include a theoretical limit of 9 patients monitored for a maximum of 99 hours without the need to download the data to a computer. Notably, the FAT32 protocol can handle up to 4 GB of data (for each module), and this is the upper limit for the data storage system described in this paper.

Computer-based library

Three MATLAB scripts, one for each module, were developed and compose the library, and they are responsible for conducting the following actions:

    •. Read, interpret, scale, reorganize and graphically present the data saved by the Modular PSG into the µSD cards;

    •. Identify package errors or losses (but the current library is not able to correct them);

    •. Remove the baseline wander (BW) of the ECG and EOG signals by applying a second-order Butterworth high-pass filter with a cut-off frequency of 0.05 Hz, thus preserving the signal characteristics, as noted by Buendía-Fuentes et al. (2012) ;

    •. Apply a 10 Hz second-order Butterworth low filter to the accelerometer data;

    •. Estimate patient posture using a simple algorithm that analyses the trunk accelerometer signal to find the axis with the largest acceleration module (most aligned with the gravity) and analyse its signal to extract the patient posture;

    •. Find the QRS peaks, calculate the heartbeat frequency, extract the respiratory signal, and estimate apnea events. These tasks are better explained in the next subsection.

Removal of the BW in a computational level is beneficial to the application because it saves microcontroller processing thus reducing power consumption. Moreover, this implementation allows an expert clinician to edit the filter process, thus facilitating the use of a non-linear filter such as that reported by Hao et al. (2011) .

The use of this library is relatively simple and demands that the user copy and paste the files into the script’s folder and change the variable that indicates the name of the file that will be read. A brief tutorial is available in the Github project.

Respiratory frequency and apnea detection algorithm

The ECG module’s script is responsible for evaluating and detecting the apnea events. This goal is accomplished with the use of a three-step algorithm that estimates the EDR signal, calculates the respiratory frequency and detects apnea events.

Related to the first step, different techniques are applied to perform the EDR, i.e., the heart rate variability, which is the time interval between two R peaks ( Drinnan et al., 1998 ). These techniques include use of principal component analysis ( Sadr and De Chazal, 2016 ) and the R wave attenuation signal, which involves evaluation of the amplitude of the R peak ( Huang et al., 2012 ).

The methodology used to estimate the EDR signal in this work consists of three steps: the ECG signal is read and filtered with a median filter, QRS wave detection is run using the algorithm developed by Pan and Tompkins (1985) , and the R wave area technique is applied to estimate the respiration signal developed by Silva and Moody (2014) .

To detect the respiration frequency and identify the apnea events, the frequency response of the EDR signal was analysed. According to Huang et al (2012) the signal is categorized by its frequency component, whereas normal breathing EDR can be categorized with a frequency response peak between 0.15 and 0.30 Hz (or 9 to 18 cycles per minute, cpm), and an apnea event could have a frequency response peak with frequencies as low as 0.01 Hz (0.6 cpm).

Following this methodology, the EDR frequency response was analysed. The fast Fourier transform (FFT) with window size of 2^15, which represents a resolution of 0.18 cpm – Physionet data and 0.73 cpm for the proposed system sampling rate. The FFT was performed in 60-second windows of the EDR signal. The window is moved to 12 seconds, and the FFT is recalculated. The DC component is discarded, the component with highest amplitude of the EDR frequency domain is found, and this peak is the respiratory frequency of that specific window. To detect apnea events, a threshold of 0.12 Hz (7.2 cpm) was applied, and this value was empirically determined after tests with five records randomly selected from the Physionet Database ( Goldberger et al., 2000 ).

To test the apnea detection algorithm, 28 sleep intervals belonging to the different records of the Physionet database were selected. Each interval contained approximately 83 minutes of ECG with a sampling rate of 100 Hz. The final accuracy was 74.8%, the sensitivity was 75.6% and the specificity was 73.91%. In other words, the proposed system correctly classified approximately 62 out of the 83 minutes on average. Figure 3 illustrates the aforementioned process.

Figure 3 Example of QRS detection (red dots), ECG-derived respiration (EDR) extraction and apnea detection from Physionet’s ECG signal. The red line in the respiratory frequency graph represents the threshold. A high level in the apnea detection means that an apnea event has occurred. The non-specified units in the ‘X’ axis are seconds.  


To evaluate the system performance, bench tests and volunteer overnight sleep tests were conducted. Bench tests are necessary to evaluate the global safety, functionality, and coherence of the proposed system, whereas overnight sleep tests evaluate the system noise rejection, comfort, storage capabilities, and mechanical resistance (among other system features) during a natural night of sleep.

Importantly, these tests were performed with the module disconnected from the electric power grid.

Bench tests

To validate the system, a luminaire equipped with a 60 W incandescent lamp was positioned near the MD-EOG board, and its electrodes were connected to the face of one of the authors. The MD-ECG board was connected to the R&D Mediq HS-14 ECG simulator. The test is described as follows, and the data collected from these stimuli are shown in Figure 4:

Figure 4 Result of one bench test. The light red and blue zones in the EOG graph indicate execution of the first and second eye movement cycles, the light grey zone indicates the natural eye blink and the dark grey zone indicates the forceful blink. The non-specified units in the ‘X’ axis are seconds.  

    •. The data were collected simultaneously from the three boards in a similar manner as in a sleep test;

    •. The ECG simulator was initially configured to generate a 2 Hz square wave, and after few seconds, its setup was switched to a 60 bpm ECG signal;

    •. The author (volunteer) turned on the luminaire. As shown in Figure 4 (illum., temp., and hum. plots), the illuminance and board temperature increased, and the local relative humidity decreased. Additionally, the effects can be noted on the audio plot in the same figure, with a peak due to the switch click. The lamp was turned off near the 18th second;

    •. The audio was tested with white noise generated by a small audio box, which remained on for approximately 7 seconds from the 10th to the 17th second, notably close to the MD-EOG. The small audio box was subsequently pushed away from the MD-EOG, as can be observed in Figure 4 in the audio plot;

    •. The EOG was tested with the use of disposable Ag/AgCl electrodes, and a solid KCl gel was positioned according to Silber et al. (2007) . After turning on the lamp, the author completed two cycles by moving the eyes to the left, right, up and down. All of the movements are captured because of the electrode positions. The author held the eyes in a resting position and blinked three times naturally and one time forcefully. All of these actions were performed over 20 seconds according to Figure 4 and the EOG plot;

    •. During nearly the entire test, the MD-ECG and MD-ACC boards maintained random movement, as shown in Figure 4 and plots Trunk Acc. and Ankle Acc. These plots were compared with the ECG plot (in the same figure) and showed evidence of the system robustness because no noise was exhibited in the ECG signal as a result of those movements.

A specific test was conducted to evaluate the system synchronization. After one hour of data acquisition, the time difference between the modules was 0.1 seconds for the MD-ECG and MD-EOG and 5 seconds between the MD-ACC and the others. The clock difference can be removed by the computer application after the microcontrollers run the bare-metal code (without an operational system) that reduces the processing jitter to a negligible level. Once the system has proven its functionality, the next step is to evaluate its performance as a sleep test.

Sleep test

Three tests were performed with two healthy (without apparent sleep disorders) people (two of the three authors). Both people slept in their own houses and on their own beds. One person was monitored for 2 nights and slept for 8 hours per night. The other person was monitored during a single night over 8 hours. For both, the stored data had an approximate size of 107 MB per night. Neither of the volunteers reported arousals caused by possible discomfort related to the PSG system.

The ECG electrodes were placed following the Technical Guideline described by the AAST (American…, 2012a). The data directly acquired during a volunteer’s third hour of sleep are exhibited in Figure 5 together with variables that are available after signal processing.

Figure 5 Plot of all signals collected and processed by the system. The light red, blue and green zones in the truck acc. graph indicate that the patient is in left, dorsal and right decubitus, respectively. The non-specified units in the ‘X’ axis are seconds.  

For the purpose of data comparison, 3 frames of EOG with a duration of 100 seconds were cut from different moments of a single night and are presented in Figure 6 . The difference in the eye movement pattern is evident and indicates different sleep stages.

Figure 6 EOG signal comparison of 100 seconds of sleep for a single individual and at different moments in the same night. The only signal processing applied to those shown in this figure is a movement average filter with a size of 11 (27.5 ms) and represents the mean removal.  


To address the sleep classification performance of the proposed system, several authors have used data collected from alternative sensors to successfully classify the sleep macrostructure (wake, non-REM and REM sleep) or even its complete structure. For example, Kortelainen et al. (2010) used an Emfit sensor foil placed in the bed to extract the heartbeat interval and movement activity and to subsequently classify the sleep. Stepnowsky et al. (2013) used a single-channel EOG to derive a bipolar EEG and automatically estimate all of the sleep stages (wake, N1, N2, N3 and REM), reaching a mean positive percent agreement across subjects and stages of 72.6%. Redmond and Heneghan (2003) used an electrocardiogram-based automatic macrostructure sleep staging system in people with disordered breathing and reached an accuracy of 61% when a subject-dependent classifier was implemented, indicating that ECG alone is not a robust feature for classifying the sleep macrostructure in patients with breathing disorders.

Comparison of the clock of the three modules showed that the clock skew is constant among modules, enabling data re-sampling with no loss. In terms of data corruption, without the use of cyclic redundancy check (CRC) recovery algorithms, only six seconds (packets) of samples (approximately 0.003% of the total) had at least one byte corrupted. Such a low level of data corruption dismisses the need for on-board data check algorithms and reduces the processor power consumption.

Relative to the data security and privacy, this system saves the data using a particular protocol and organization, does not use any type of wireless communication, and does not record patient images, video, or audible sounds. Therefore, the system respects patient privacy and is secure for particular use.

The relative operational simplicity of the system, the increase in mobility and patient comfort, and the possibility of self-setup enables the patients to evaluate the quality of their sleep. Those facts mirror the international trends in the health care arena, such as wellness and healthiness. The possibility of removing or adding additional modules might result in better monitoring of sleep quality and cost reduction once the PSG system can be adapted to monitor only the parameters chosen as problematic by an expert physician, which can reduce the number of invasive sensors placed on the patient, thereby reducing patient discomfort. Moreover, it is also possible to monitor and evaluate the sleep environment before the patient goes to bed, which might improve further diagnosis and treatment.

Including all three boards, the electronic components and the cables, a total of 199.22 USD was expended to manufacture the presented system. This is a considerably low cost for this type of application.

This work should be viewed as a prototype with the aim of presenting and discussing a solution that increases patient autonomy and comfort during sleep monitoring and considers other variables (such as environmental variables that are not monitored in current commercial equipment) and may contribute to a more accurate diagnosis. To reach this point, the system must comply with the regulations in force. The apnea detection accuracy could be improved by introducing a device capable of measuring the blood oxygen saturation level or airway flow, but the tradeoff is the increase in patient distress: patients would have to wear a facemask or an ear clip to measure airway flow or SpO2, respectively. With respect to the system performance, future studies will need to compare the proposed system against a gold standard class I PSG commercial system.


The authors acknowledge financial support from the CNPq via grant no. 487098/2013-7 and FAPES via grant no. TO041/2016.

How to cite this article: Schneider FBA, Melo AS, Andreão RV, Dalvi RF. Alternative class III distributed polysomnography system. Res Biomed Eng. 2017; 34(2): pp-pp. DOI: 10.1590/2446-4740.03317.


Agnew HW Jr, Webb WB, Williams RL. The First Night Effect: an EEG study of sleep. Psychophysiology. 1966; 2(3):263-6. . PMid:5903579. [ Links ]

American Association of Sleep Technologist – AAST. Technical Guideline - Out of Center Sleep Testing (OCST). Chicago: AAST; 2012a. [ Links ]

American Association of Sleep Technologist – AAST. Technical Guideline - Standard Polysomnography. Chicago: AAST; 2012b. [ Links ]

Buendía-Fuentes F, Arnau-Vives MA, Arnau-Vives A, Jiménez-Jiménez Y, Rueda-Soriano J, Zorio-Grima E, Osa-Sáez A, Martínez-Dolz LV, Almenar-Bonet L, Palencia-Pérez MA. High-Bandpass filters in electrocardiography: source of error in the interpretation of the ST segment. ISRN Cardiol. 2012; 2012:1-10. . PMid:22778996. [ Links ]

Caldwell J. Single-supply, electret microphone pre-amplifier reference design. Dallas: Texas Instruments; 2015. [ Links ]

Cattrysse F, Peeters M, Calaerts S, Ferson K, Degryse J-M. Detection of sleep apnea by case-finding and home monitoring with Somnolter®: a pilot study. BMC Res Notes. 2014; 7(1):616. . PMid:25200902. [ Links ]

Chan E. FatFs - Generic FAT Filesystem Module. 2016. [cited 2016 Feb 5]. Available from: [ Links ]

Chang D-W, Liu Y-D, Young C-P, Chen J-J, Chen Y-H, Chen C-Y, Hsu Y-C, Shaw F-Z, Liang S-F. Design and Implementation of a Modularized Polysomnography System. Instrum Meas IEEE Trans. 2012; 61(7):1933-44. . [ Links ]

Drinnan MJ, Murray A, Griffiths CJ, Gibson GJ. Interobserver variability in recognizing arousal in respiratory sleep disorders. Am J Respir Crit Care Med. 1998; 158(2):358-62. . PMid:9700107. [ Links ]

Escourrou P, Luriau S, Rehel M, Nedelcoux H, Lanoe JL. Needs and costs of sleep monitoring. Stud Health Technol Inform. 2000; 78:69-85. PMid:11151608. [ Links ]

Flemons WW, Douglas NJ, Kuna ST, Rodenstein DO, Wheatley J. Access to diagnosis and treatment of patients with suspected sleep apnea. Am J Respir Crit Care Med. 2004; 169(6):668-72. . PMid:15003950. [ Links ]

GitHub. Sox software: command line audio synthesizer. 2013. [cited 2017 October 6]. Available from: [ Links ]

Goldberger AL, Amaral LAN, Glass L, Hausdorff JM, Ivanov PC, Mark RG, Mietus JE, Moody GB, Peng C-K, Stanley HE. PhysioBank, PhysioToolkit, and PhysioNet: components of a new research resource for complex physiologic signals. Circulation. 2000; 101(23):E215-20. . PMid:10851218. [ Links ]

Goodrich S, Orr WC. An investigation of the validity of the Lifeshirt in comparison to standard polysomnography in the detection of obstructive sleep apnea. Sleep Med. 2009; 10(1):118-22. . PMid:18083629. [ Links ]

Grandner MA, Pack AI. Sleep disorders, public health, and public safety. JAMA. 2011; 306(23):2616-7. . PMid:22187285. [ Links ]

Halperin D. Environmental noise and sleep disturbances: a threat to health? Sleep Sci. 2014; 7(4):209-12. . PMid:26483931. [ Links ]

Hao W, Chen Y, Xin Y. ECG baseline wander correction by mean-median filter and discrete wavelet transform. In: EMBC, 2011 Annual International Conference of the IEEE Engineering in Medicine and Biology Society; 2011 Aug 30-Sep 3; Boston, MA. USA: IEEE; 2011. p. 2712–5. PMid:22254901. [ Links ]

Huang TC, Chen HY, Fang WC. Real-time obstructive sleep apnea detection based on ECG derived respiration signal. In: IEEE International Symposium on Circuits and Systems (ISCAS); 2012 May 20-23; Seoul, South Korea. USA: IEEE; 2012. vol. 1, p. 341-4. . [ Links ]

Jafari B, Mohsenin V. Polysomnography. Clin Chest Med. 2010; 31(2):287-97. . PMid:20488287. [ Links ]

Kawada T. Acute myocardial infarction and sleep apnea. Int J Cardiol. 2015; 187:486-7. . PMid:25846659. [ Links ]

Kortelainen JM, Mendez MO, Bianchi AM, Matteucci M, Cerutti S. Sleep staging based on signals acquired through bed sensor. IEEE Trans Inf Technol Biomed. 2010; 14(3):776-85. . PMid:20403790. [ Links ]

Lokavee S, Puntheeranurak T, Kerdcharoen T, Watthanwisuth N, Tuantranont A. Sensor pillow and bed sheet system: Unconstrained monitoring of respiration rate and posture movements during sleep. In: IEEE International Conference on Systems, Man, and Cybernetics (SMC); 2012 Oct 14-17; Seoul, South Korea. USA: IEEE; 2012. p. 1564-8. . [ Links ]

Lubecke VM, Boric-Lubecke O. Wireless technologies in sleep monitoring. In: RWS 2009 IEEE Radio and Wireless Sympium Proceedings; 2009 Jan 18-22; San Diego, CA. USA: IEEE; 2009. p. 135-8. . [ Links ]

Müller MR, Guimarães SS. Impacto dos transtornos do sono sobre o funcionamento diário e a qualidade de vida. Estud Psicol. 2007; 24:519-28. . [ Links ]

Okamoto-Mizuno K, Mizuno K. Effects of thermal environment on sleep and circadian rhythm. J Physiol Anthropol. 2012; 31(14):1-9. . PMid:22738673. [ Links ]

Pan J, Tompkins WJ. A Real-time QRS detection algorithm. IEEE Trans Biomed Eng. 1985; 32(3):230-6. . PMid:3997178. [ Links ]

Penzel T, Moody GB, Mark RG, Goldberger AL, Peter JH. The apnea-ECG database. Comput Cardiol. 2000; 2000(27):255-8. . [ Links ]

Ramos AR, Gangwisch JE. Is sleep duration a risk factor for stroke? Neurology. 2015; 84(11):1066-7. . PMid:25716359. [ Links ]

Redmond S, Heneghan C. Electrocardiogram-based automatic sleep staging in sleep disordered breathing. In: Computers in Cardiology; 2003 Sep 21-24; Thessaloniki Chalkidiki, Greece. USA: IEEE; 2003. p. 609-12. . [ Links ]

Rosenthal NE, Joseph-Vanderpool JR, Levendosky AA, Johnston SH, Allen R, Kelly KA, Souetre E, Schultz PM, Starz KE. Phase-shifting effects of bright morning light as treatment for delayed sleep phase syndrome. Sleep. 1990; 13(4):354-61. PMid:2267478. [ Links ]

Sadr N, De Chazal P. A fast approximation method for principal component analysis applied to ECG derived respiration for OSA detection. In: Proceedings of the IEEE 38th Annual International Conference of the Engineering in Medicine and Biology Society (EMBC); 2016 Aug 16-20; Orlando, FL. USA: IEEE; 2016. p. 6198–201. . [ Links ]

Schneider FBA. Distributed_PSG [Internet]. 2017. [cited 2017 Nov 7]. Available from: [ Links ]

Sharma H, Sharma KK. ECG-derived respiration using Hermite expansion. Biomed Signal Process Control. 2018; 39:312-26. . [ Links ]

Silber MH, Ancoli-Israel S, Bonnet MH, Chokroverty S, Grigg-Damberger MM, Hirshkowitz M, Kapen S, Keenan SA, Kryger MH, Penzel T, Pressman MR, Iber C. The visual scoring of sleep in adults. J Clin Sleep Med. 2007; 3(2):121-31. PMid:17557422. [ Links ]

Silva I, Moody GB. An open-source toolbox for analysing and processing physionet databases in MATLAB and Octave. J Open Res Softw. 2014; 2(1):e27. . PMid:26525081. [ Links ]

Song C, Liu K, Zhang X, Chen L, Xian X. An obstructive sleep apnea detection approach using a discriminative Hidden Markov Model from ECG signals. IEEE Trans Biomed Eng. 2016; 63(7):1532-42. . PMid:26560867. [ Links ]

Stepnowsky C, Levendowski D, Popovic D, Ayappa I, Rapoport DM. Scoring accuracy of automated sleep staging from a bipolar electroocular recording compared to manual scoring by multiple raters. Sleep Med. 2013; 14(11):1199-207. . PMid:24047533. [ Links ]

Texas Instruments. OPT3001 Ambient Light Sensor. Dallas: Texas Instruments; 2014. [ Links ]

Texas Instruments. HDC1050 low power: high accuracy digital humidity sensor with temperature sensor PACKAGE. Dallas: Texas Instruments; 2015. [ Links ]

Van de Water ATM, Holmes A, Hurley DA. Objective measurements of sleep for non-laboratory settings as alternatives to polysomnography - a systematic review. J Sleep Res. 2011; 20(1 Pt 2):183-200. . PMid:20374444. [ Links ]

Received: June 22, 2017; Accepted: April 30, 2018

* Corresponding author: Av. Vitória, 1729, Jucutuquara, CEP 29040-780, Vitória, ES, Brazil. E-mail:

Creative Commons License  This is an Open Access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.