1. Introduction
We live in a society in constant motion, in which time is increasingly finite and valuable, and, often, the 24 h of the day are insufficient to fulfill our obligations; consequently, we end up forgetting the importance of sleep. Sleep is a vital tool for good health and well-being in adults, adolescents, and children alike [
1,
2].
Sleep is vital to the human body and necessary for life, having many functions of enormous importance, as follows: it promotes growth, learning, and cognitive development; it is important at metabolic and cognitive, cardiovascular, and cerebrovascular levels; and it is also a major contributor to good mental health and good mood. The quality and quantity of sleep that a person has also plays an important role in reducing injuries caused by traffic and work accidents, which can result from fatigue and sleepiness [
3,
4].
For a healthy sleep, we must have the following factors in place: adequate time and duration, regularity, good quality, and an absence of disturbances. Although the individual needs of each person may fluctuate, the National Sleep Foundation (NSF) states that, for adults and young adults, the ideal amount of sleep is between seven and nine hours a night; however, for older people this ideal amount is reduced to seven to eight hours [
5].
Many factors are responsible for a bad night’s sleep, such as environmental or behavioral factors (for example, brightness, room temperature, noise, sedentary lifestyle, poor eating habits, and alcohol consumption, among others), as well as sleep disorders such as insomnia, restless leg syndrome, insufficient sleep syndrome, and obstructive sleep apnea (OSA).
Sleep apnea is termed “central” or “non-obstructive” when no breathing effort is present and “obstructive” when breathing effort is present. Obstructive sleep apnea is a breathing disorder that, as the name implies, occurs during sleep, but has implications that go far beyond sleep disruption.
The clinical disease is characterized by recurrent episodes of the partial cessation of oro-nasal airflow (hypopneas) or the sudden complete cessation of airflow (apneas), followed by a collapse of the upper airway during sleep.
Upper airway obstruction during sleep lasting at least 10 s defines an apnea resulting in increased airflow resistance, which compromises and reduces blood oxygen saturation [
6].
The apnea–hypopnea index (AHI) refers to the total amount of apnea and hypopnea episodes that occur during sleep, fractionalized by the hours of sleep. It is commonly used as a measure to describe these breathing disorders, resulting in a scale of disease severity [
7]. OSA can be classified as follows:
Mild—when it presents an AHI that ranges between 5 and 15;
Moderate—when the AHI is between 15 and 30;
Severe—when the AHI value exceeds 30.
The clinical presentation of OSA includes signs of upper airway obstruction, daytime hypersomnia, and insomnia. Before it is detected, the symptoms of this disease usually show up silently and can take the form of snoring, panting breath, or asphyxia. However, until the appearance of more flagrant daytime symptoms, patients tend to underestimate and ignore these signs, thus leading to a delay in diagnosis.
In the early stages of the disease, the patient may easily fall asleep during more sedentary daily activities, such as watching television (which can often be mistaken for tiredness or fatigue). As the disorder worsens, drowsiness invades daily activities and can become dangerous and disabling, with work and traffic accidents increasingly being identified as an inherent risk of this disease.
It is estimated that the monetary value of road accidents associated with OSA is so high that the diagnosis and treatment of all drivers with this condition in the USA would result in savings, and in a decrease in the costs of the damages caused to society because of this disease [
8].
Currently, OSA is also associated with serious complications such as mood disorders, cardiovascular disorders, neurocognitive sequels, hypertension, diabetes, heart failure, arrhythmias, strokes, and pulmonary hypertension [
9].
These complications highlight the heterogeneity of the various clinical manifestations of OSA, as well as its possible health complications.
Nowadays, there is an increased alertness and concern within society towards this disease, which was once considered minor, but which has a direct impact on people’s daily lives. Obstructive sleep apnea syndrome represents a major public health problem with potential singular and collective consequences. The recognition and treatment of this syndrome is increasingly essential, so that a significant burden of risk is avoided and so that there is an improvement in the quality of life of the people who are affected by this disease, both directly and indirectly.
As with the clinical heterogeneity, the pathophysiology of OSA is also multifactorial. It is subdivided into “anatomical” and “non-anatomical” causes [
10].
At the anatomical level, for OSA to be present, there must be some degree of upper airway involvement. Some studies have identified major anatomical abnormalities of the pharynx in people with this disease. For example, narrow pharyngeal airways, increased airway length, and the inner diameter of the pharynx (pharyngeal lumen) are strongly associated with a predisposition of the pharynx to collapse during sleep. The constituent structures of the pharynx that have a direct contribution to airway collapse are the dilator muscles, such as the genioglossus muscle; the soft palate; the lateral pharyngeal walls; and the epiglottis.
Some of the anatomical factors that carry inherent risk factors for this disease and its severity are craniofacial morphology, hyoid bone position, airway surface tension, and fat tongue.
In recent years, factors other than pharyngeal anatomy and craniofacial structure have been a target of study and research, and their potential role has been recognized.
Some of the main non-anatomical factors are unstable breath control during sleep, low respiratory arousal threshold (LRAT), and the poor functioning of the pharyngeal dilator muscle. These factors, when combined with some anatomical factors, can perpetuate the severity of the disease [
11,
12,
13]. There are also other preponderant factors in this disease, such as the following:
Gender—OSA is more common in men than in women. In the general population, the male–female rate is estimated to be 2:1, and the prevalence of nocturnal “snoring” shows similar gender differences. Possible explanations for the male predominance lie in the hormonal effects on the upper airway muscles, differences in body fat distribution between genders, and pharyngeal anatomical differences. Hormonal influence may play an important role in the pathogenesis of OSA in females, as the prevalence is higher in postmenopausal women [
14,
15].
Age—The prevalence of OSA also increases with age. Unlike “snoring”, there continues to be an increase, even after the age of 60. However, the frequency of this syndrome seems to decrease after the age of 65 [
16]. These data are corroborated by a study that was performed on a sample of 5615 male and female individuals, between 40 and 98 years of age. This study found a stabilization in the prevalence of OSA in people over 65 years of age. Although, in previous studies an extremely high prevalence of respiratory diseases have been detected in people over the age of 65. However, the lack of a continuous increase in the prevalence of OSA from the age of 65 to 99 years, has led the researchers to conclude that an age-related increase should occur before the age of 65 [
17].
Obesity—Obesity is an important risk factor for the onset of OSA, and most patients with this disease are overweight. It is estimated that 58% of moderate to severe cases of OSA are due to a body mass index (BMI) equal to or greater than 25 kg/m
2. There are studies that report a decrease in AHI by adhering to a low-calorie diet. However, there is some controversy as to whether specific human body variants, such as neck or waist circumference, are more reliable than BMI. This highlights the need to implement effective dietary education strategies and long-term weight loss programs in order to prevent OSA and address one of the 21st-century pandemics: obesity [
18,
19].
Smoking—The relationship between smoking habits and OSA is still controversial. Smoking is known to impair the respiratory system by causing airway inflammation and breathing instability. A study published in 2015, in which 964 patients, including smokers and non-smokers, were included. Reports have stated that the disease was diagnosed at earlier ages in smoking individuals and that individuals who smoked 25 or more cigarettes per day had more severe OSA levels [
20].
Alcoholism—Alcohol consumption has only recently begun to be evaluated as a risk factor for OSA. Alcohol, by itself, is not a direct factor of OSA; however, in conjunction with other systemic factors, it can lead to a worsening in snoring, can alter sleep architecture, worsen AHI, drive the oropharyngeal wall to collapse, and induce lower oxygen saturation in patients who are more susceptible to OSA [
21].
Despite the growing recognition of OSA as a contributor to a range of problems, in the literature, there is still a paucity of data regarding the prevalence of this disease worldwide [
22]. It is estimated that this prevalence in the general population ranges from 9% to 38%, yet approximately 80% to 90% of cases remain undiagnosed or misdiagnosed [
23]. It eventually became too complex to create a study of the evolution of OSA over the years, as there is a discrepancy in the data obtained by the studies that have been conducted. This discrepancy is due to the fact that there are three different guidelines. According to the American Academy of Sleep Medicine (AASM), there are differences in the scoring rules for hypopneas [
24].
The 1999 and 2007 guidelines have been replaced by their 2012 successors, currently in effect. The 2012 guidelines state that, to prove the existence of hypopnea, the decrease in oxygen flow must be ≥30% and associated with an oxygen desaturation of ≥3%, or else there should be an associated awakening. By using the 2012 AASM criteria in conjunction with an AHI criterion of ≥5 events per hour, then, an estimated 936 million (at 95% confidence), both males and females, aged 30–69 years, suffer from OSA, worldwide. With an AHI criterion of ≥15 events per hour, the estimated figure is 425 million sufferers of this disease. The global estimate shows that China is the country with the largest number of individuals with OSA, followed by the USA, Brazil, and India [
22].
This paper proposes a device for the treatment and prevention of OSA. This device, unlike existing treatments, will not involve any type of surgical intervention; is minimally invasive; and does not produce headaches, a dry mouth and throat, or the nocturnal noise usually associated with the non-invasive treatment technologies on the market.
The device will take the form of a customizable mouth guard, using the dimensions of each user’s lower jaw dentition and programmed to the user’s specific needs.
In addition, this device should be able to detect, through electromyography, electrical signals from the brain, or, in this case, the lack of a weakening of them, and to stimulate the genioglossus muscle so that there is no collapse of the airways. Thus, most of the apnea or hypopnea events will be solved without the bearer of this condition noticing what has happened and waking up.
This stimulation will occur through electrodes placed directly under the tongue, where the stimulation of this muscle will take place indirectly, as this is the most effective place, without resorting to surgery.
This device should be applied daily by the patient when they go to bed, and, when they wake up in the morning, rested, they need only remove it from their mouth and place it on top of the charging base. This base will be connected to the electric current and will charge the device through electromagnetic induction, so that there is no compromise in the impermeability of the device.
The following sections of the paper are organized as follows:
Section 2 presents the related work. In
Section 3, the materials and methods are described. The prototype assembly and testing are discussed in
Section 4. Finally, conclusions and future work are presented in
Section 5.
2. Related Work
The act of breathing is intrinsic to human beings, occurring mostly without us thinking or even realizing it is happening. However, in specific situations, it is possible to control it, for example when we dive underwater or when we sing a song.
The respiration rate is the total number of breaths, or breathing cycles, that occur each minute. This rate can be a good indicator that something is not right, because the rate can change in the presence of an illness. The respiratory rate is controlled by the respiratory center, which is located in the brain, and which responds primarily to changes in the levels of oxygen, carbon dioxide, and pH in the blood [
25].
Ventilation control results from a complex interaction of multiple regions of the brain that send a signal to the muscles used in breathing to contract. The result is, typically, a rhythmic and consistent ventilation rate that provides the body with the necessary amount of oxygen, while removing carbon dioxide.
Although most mammals have rigid skeletal support of the pharyngeal airway, in humans, the upper airway permeability is maintained, primarily, by the activation of soft tissue structures and muscle activation.
The performance and stability of the upper airway play a major role in obstructive sleep apnea, and its collapse has been pointed out as one of the main factors for the occurrence of this disease. However, other factors, such as a low arousal threshold and an instability in respiratory control, may contribute to the poor activation of the upper airway muscles and their collapse during sleep [
26].
Subjects with OSA, for the most part, have a narrowing of the upper airway, with a much higher potential for collapse, than people without this disease.
During wakefulness, to compensate for this anatomical deficiency, they manifest increased activity of the airway dilator muscles. However, this increased muscle activity is lost at the beginning of sleep, which causes the pharyngeal airway to collapse in subjects with OSA [
27].
The great hypoglossal nerve is one of the 12 cranial nerves. The hypoglossal nerve, beginning at the base of the brain, near the brain stem, travels down the neck and past the carotid artery and jugular vein, extending past the back of the throat to reach the lower part of the mouth. It then branches out to connect with the different muscles that control the tongue.
The muscles controlled by this nerve are subdivided into the following two groups: the extrinsic muscles and the intrinsic muscles [
25,
28].
The intrinsic muscles lie entirely within the tongue and are responsible for the changes in the shape of the tongue. On the other hand, the extrinsic muscles extend outside the tongue and their job is to physically move it.
Most of the studies and research on these muscles focus primarily on the genioglossus muscle. This is because it is the largest dilator muscle of the upper airways and is responsible for the action of pulling the posterior portion of the tongue to the front to unblock the airway.
The genioglossus muscle is said to have a phasic inspiratory activity because, during wakefulness, it is spontaneously activated, and its activity is greater during inspiration.
At the onset of sleep, the inspiratory and expiratory activity declines rapidly, both in healthy people and in people with OSA, however, it is more noticeable and of greater intensity in those with the disease. When the negative pressure and respiratory drive increase, the activity of this muscle also increases in order to try to compensate for these effects, which is often insufficient until awakening occurs. Therefore, the activity of the genioglossus muscle directly alters the pharyngeal lumen, and the behavior of the airway varies during obstructive events and is distinct from patient-to-patient. In the literature, one way to innervate the muscle and promote airway patency improvement, is through the electrical stimulation of the genioglossus muscle itself, or even of the hypoglossal nerve [
29,
30].
Detecting and Treating Sleep Apnea
The diagnosis of obstructive sleep apnea syndrome requires the combined evaluation of relevant clinical features, as well as the objective demonstration of abnormal breathing during sleep.
Currently, among all the tests for this disease, the standard test is the complete polysomnography, which provides detailed information about sleep status and respiratory abnormalities through electrophysiological signals [
24].
Polysomnography (PSG), or nocturnal sleep study, is a diagnostic method that consists of continuously and simultaneously recording sleep by means of electrophysiological signals. Generally, this means of diagnosis involves electroencephalogram (EEG), electromyogram (EMG), electrooculogram (EOG), and electrocardiogram (ECG), among others. However, the human respiratory act does not generate any readily detectable electrical signal, which makes the use of sensors necessary so that these data can be read and analyzed in light of current technologies.
These sensors take different forms and functions and can be directly in contact with the upper airways or in contact with other parts of the body, such as the fingers and thorax, among others [
31,
32].
Similar to the methods used for the detection of this disease, there are also a fairly large number of techniques and devices for its treatment [
33]. Examples include the following: surgical treatments [
34], oral appliances [
35], and weight reduction and lifestyle changes [
36].
However, treatment using continuous positive airway pressure (CPAP) is considered the gold standard for the therapy of moderate to severe obstructive sleep apnea. This consists of a device that is used at night and that allows air to pass through the airways by applying constant positive pressure to the upper airways through an oral or nasal mask, using a tubing system [
37,
38]. However, although it is a non-invasive treatment and its effectiveness in treating OSAS is proven, the rate of adherence to this treatment is relatively low. Nasal congestion and mask intolerance are the most common complaints and the main reasons that reduce CPAP compliance [
39].
When more conventional treatment techniques are not well accepted by the patient or are insufficient, nerve stimulation devices can be used.
Three upper airway stimulation devices are currently available for the treatment of obstructive sleep apnea. Although slightly different in design, each of these implants electrically stimulates the hypoglossal nerve. This stimulation causes a contraction of the genioglossus muscle, pulling the tongue forward in order to open the airway.
The
Inspire system [
40,
41] and the
Aura 6000 system [
42,
43] operate identically, by directly stimulating the hypoglossal nerve via electrodes implanted in it and that are controlled by a battery-powered pulse generator, which is implanted in the chest. The major drawback of these two devices is that they require surgery for them to be implanted, as well as to change the battery when it runs low.
The
Genio system is the latest and most innovative implantable device for treating OSA to receive FDA approval [
44,
45]. This system consists of an implantable stimulator that comprises two electrodes, which are placed on the patient through medical surgery in the submental region (under the chin), with the stimulating electrodes close to the right and left branches of the hypoglossal nerve. This is the only part of the whole system that needs to be implanted with surgery and it is controlled by a pre-programmed activation chip, with patient-specific stimulation parameters, and is placed externally, under the chin. Despite being the most advantageous device of the three, the main disadvantage is still the fact that it is an invasive solution and that it is a pre-programmed therapy, which does not act optimally if some of the patient’s physical or physiological parameters change.
3. Materials and Methods
3.1. ESP32 Microcontroller
The ESP32 is a powerful SoC (system on chip) microcontroller, released in 2016 by the Chinese company, Espressif Systems (Shanghai, China). The ESP32 offers the ability to use Bluetooth and BLE (Bluetooth Low Energy), and it integrates an 802.11 b/g/n HT40 Wi-Fi transmitter, allowing it to connect to and interact with a Wi-Fi network. It is also possible for it to configure its own network to allow other devices to connect to it.
It also has a single or dual-core 32-bit Tensilica Xtensa LX6 microprocessor, with adjustable clock frequencies from 80 to 240 MHz, and a total of 48 pins for different uses.
It is a low cost, low power system, as it has a ULP (ultra-low-power) coprocessor, which allows analog-to-digital conversions, computation and threshold levels to be performed while in “deep sleep” mode. This is ideal for battery-powered applications.
It is designed to achieve the best RF and power performance, as well as for robustness, versatility, and reliability in a wide variety of applications, with different power profiles. This chip also has 15 channels of 12-bit ADCs; 2 channels of 8-bit DACs (digital-to-analog converters) to produce true analog voltages; 10 capacitive touch sensors; 3 SPI (serial peripheral interface) interfaces, one I2C (inter-integrated circuit) interface to connect all types of sensors, and 2 I2S (Inter-IC Sound) interfaces for digital audio; and 25 PWM outputs.
Since the ESP32 works with a voltage range of 2.2 V to 3.6 V, this board has a voltage regulator to keep it stable, at 3.3 V, which is the ideal voltage for this microcontroller to reliably supply up to 600 mA.
The ESP32 microcontroller can be programmed in different development environments and the code can be written in C/C++ or MicroPyton. The Espressif Company has provided its own development framework for this chip so that it is possible to make use of all its features. The ESP-IDF (Espressif IoT Development Framework), however, is the easiest and most common way to use the Arduino IDE, which, although is not the best environment to work with the ESP32, has the advantage of being a familiar platform, with a flatter learning curve.
3.2. EMG Sensor
Surface electromyography is the process of obtaining and analyzing the electrical signals from muscle contractions, through electrodes placed in contact with the skin. There are several low-cost solutions available on the market; nevertheless, for this research we have selected the Grove EMG sensor, produced by Seeed Studio.
This sensor detects and collects the muscles’ electrical signals; however, it does not present them in a direct way, which means that the sensor filters, amplifies, and rectifies the signal so that it can be read by the ADC of any microcontroller.
The EMG device detects when muscle cells are activated electrically or neurologically. This activation creates a voltage difference in the muscles that is measured by two of the three electrodes that this sensor uses. The third electrode is used as the ground, and exists in order to reduce electromagnetic noise.
In standby mode, this sensor has an output voltage of 1.5 V. When muscle activity is detected, the output signal increases to a maximum voltage of 3.3 V.
The EMG signal is acquired using the differential amplification technique and is obtained with the help of a high input impedance instrumentation amplifier.
The instrumentation amplifier performs the differential amplification by subtracting the voltages of both electrodes. In this way, the common noise signals between the VIN+ and VIN- electrode are eliminated.
Since noise “dirties” the EMG signal, it must be filtered, even after differential amplification. This noise can have many origins, from sensor drift on the skin to temperature fluctuations, and a high-pass filter is needed to remove it.
A high pass filter is used to remove the low frequencies from a particular signal, and the cut-off frequency is the frequency below which all frequencies are eliminated.
To conclude, the signal, after being properly filtered and shaped to a suitable frequency band, must be amplified. In this case it is amplified with a zero-drift operational amplifier, which is a highly effective solution for applications requiring a high-precision signal.
3.3. Temperature and Humidity Sensor
The DHT11 sensor is a temperature and humidity sensor that consists of the following three distinct parts: a humidity detection component, an NTC temperature sensor, and an integrated circuit on the back of the sensor.
To perform humidity detection, this sensor consists of two electrodes with a moisture absorption plate between them. As the humidity changes, the conductivity of the substrate also changes, which causes the resistance between these two electrodes to change as well.
To measure the temperature, the DHT11 sensor makes use of an NTC (negative temperature coefficient) temperature sensor, or, in other words, a thermistor. Thermistors are, by definition, semiconductors that change their resistance with temperature changes and are made mostly of ceramics or polymers in order to provide larger changes in resistance with small temperature changes. Since we are talking about an NTC whose coefficient of resistance variation with temperature is negative, the resistance decreases with an increase in the external temperature.
The data obtained from both the temperature and humidity are analyzed and converted from analog to digital via the 8-bit integrated circuit, in order to be read in a simplified way by any microcontroller.
3.4. Software
The fundamental pillar of the proof of concept presented here is based on the fact that obstructive sleep apnea comes from the absence or weakening of electrical stimuli from the brain, which causes the tongue muscles to relax, which, in turn, causes them to obstruct the upper airway; this interrupts normal respiratory function.
These electrical signals can be detected by surface electromyography in the largest muscle of the tongue, the genioglossus.
After being acquired through the EMG sensor, these signals can be processed so that when this absence/weakening of the detected signals occurs, it is understood as the beginning of a potential apneic event. In this way, and with this knowledge, solutions can be developed to try to overcome these effects by trying to solve the problem. As described in the literature, and discussed earlier, electrostimulation is an effective way to stimulate the tongue muscles, promoting its normal functioning. Furthermore, it would be important to have access to the data so that the medical specialist can adopt a more incisive and personalized therapy for each patient. These data, which are obtained through the microcontroller, could be stored in a database so that, when necessary, they could be easily visualized.
All the software was developed based on the flowchart in
Figure 1, and was divided into 5 main parts, as follows:
Phase of the charging verification, represented in the Figure with number 1;
Phase of the acquisition of the humidity and temperature values, represented in the Figure with number 2;
Phase of the system initialization and parameter verification, represented in the Figure with number 3;
Phase of reading and processing the EMG sensor values, represented in the Figure with number 4;
Phase of stimulation and sending the values to the database, represented in the Figure with number 5.
3.4.1. Charging Verification, Humidity, and Temperature Values
The first phase is the phase of checking whether the system is in charging mode or not, as shown in the code presented in
Figure 2. This checks whether the device is resting on the charging base, and, until it is removed, the system is in standby mode.
When the system comes out of charging mode, it displays the following message: “Charging complete. Start the system”. The system starts up and moves to the next phase.
After the device is removed from the charging base, it must meet two conditions for the system to be able to proceed. These conditions are intended to confirm that the activation is intentional—in other words, to confirm that the device has been removed from the charging base with the intention of being used by the patient. This prevents erroneous system activations, such as the device being moved from the base accidentally. This is achieved through the temperature sensor. Since the average body temperature of a human being is between 36 °C and 37 °C, the device must comply with this condition. The sensor used has an accuracy of ±2 °C; therefore, the temperature obtained by the sensor must be higher than 34 °C in order to account for this accuracy rate.
Since the oral cavity is constantly bathed in saliva, it makes the mouth a place with quite high humidity. This is a complementary factor to temperature. The DHT11 is able to detect humidity rates of up to 80% and is, therefore, ideal for the inside of the mouth.
Since an ambient temperature of 34 °C can easily be reached during the summer, or in countries where temperatures are higher, it is more effective for the first parameter of comparison to be humidity. The variables “humset” and “tempset” correspond to the limit values for humidity and temperature, respectively, and were defined earlier as shown in
Figure 3.
The variables “hums” and “temps” are set to zero initially, however, these assume the values read by the sensor.
After the system verifies that the device has left the charging base, it takes a humidity reading, adding the obtained value to the “hums” variable, as shown in
Figure 4. A comparison is made between this value and the value set initially. If the value of the “hums” variable is equal to or greater than the value of the “humset” variable, it indicates that the humidity levels are within the defined parameters, and then moves on to the temperature reading.
The process for temperature is similar. The sensor registers the temperature value, that value is added to the “temps” variable and compared to the initially set “tempset” variable.
If these two conditions are met, an indication is given to the system that the device is in the mouth, and ready to be used.
3.4.2. System Initialization and Parameter Verification
Whenever the system starts, it must start a variable with a zero value, represented in
Figure 3 as “X = 0”, which has the function of a counter.
Next, before being able to proceed, it is necessary to check whether there have been any changes in the stimulation values.
These values are the parameters that control the stimulation pulse—one is the pulse amplitude and the pulse duration. These values are stored in the database, which, in this case, was a
Google Sheet, as shown in
Figure 5A.
For the ESP32 microcontroller to access these data, first it needs a Wi-Fi connection, since the data are stored in the cloud. For this, the ESP32 needs two pieces of information: the network name (SSID) and the password,
Figure 5B.
After being connected, it needs to access the Google Sheet to obtain the information about the stimulation parameters. However, for this iteration to happen, and for the ESP32 to interact on a read-only basis with the Google Sheet, a Google Script is needed. This has the function of specifying and automating, through functions, the task that is intended to be performed; of being programmed to work only for a specific Google Sheet, not accessible to anyone else; and operating in three distinct modes, “called” in the ESP32 code, in order to perform the desired tasks.
Through this feature, the values contained in the
Google Sheet are collected and added to its variables, as is visible in the code present in
Figure 6.
3.4.3. Reading and Processing the EMG Sensor Values
This is the most important point of the whole system. It is through the success of this operation that apneic events are expected to be prevented. The EMG sensor, through electrodes placed at the base of the tongue and in contact with the genioglossus muscle, collects and processes the data so that they can be read by the ADC, as explained above.
In turn, the microcontroller transforms the data and compares them to a pre-defined value. This value differs from person to person, requiring an individual prior study to detect the ideal threshold values.
The fundamental premise is based on the fact that the values read by the EMG sensor are much lower during apnea. However, in order to be able to test this, this role was reversed. When conscious, it is possible to contract a muscle in various ways, such as bending the arm or closing the wrist, but the opposite is impossible.
It is not possible to consciously simulate an apnea so that this data can be read by an electromyography sensor. This was achieved using the code in
Figure 7.
3.4.4. Stimulation and Sending the Values to the Database
The fifth and last phase complements the previous phase, in that the comparison of the obtained values is made with the previously defined value. In this specific case, to conduct the tests, whenever the value obtained and handled by the EMG sensor was higher than the set value, a stimulation pulse was sent, as shown in the code of
Figure 8.
This stimulus is produced by the PWM technique, which sends an impulse with an amplitude value and duration obtained earlier, when the parameter checks on the Google Sheet were conducted.
Next, the counter that was started with the system and that had a value equal to zero was incremented by one. This value represents the number of apneas detected and treated for each use of the device, i.e., ideally for each night of use.
The number of apneas and the interval of hours in which they may be more prevalent is extremely relevant for the medical doctor who is following the therapy. Through these data, the professional can see if the device is working as desired and can apply a more personalized therapy to each patient during the duration of treatment. The parametrization of the electrostimulation should be left to the medical doctor, who is the only one able to modify the parameters (see
Figure 9).
For each apneic event, the system increments the counter once, saves that value, and registers the time of the event. It then sends these data to the
Google Sheet, as can be seen in
Figure 10.
In order to send these data to the Google Sheet, it is necessary to use a script, which allows the access the page and write the value in an available cell, saving it automatically.
3.5. Hardware
It must be remembered that software and hardware are intrinsically connected, with the proper functioning of one depending on the proper functioning of the other.
The circuit shown was divided into the following three main parts: the charging circuit part, the power circuit part, and the processing circuit part, as shown in
Figure 11.
In the first part—the charging circuit—the schematic shows a USB port connected to the Qi charging system, more properly the Tx (transmitter) coil. In an idealized device, this circuit would be inside the charging base and be external to the device itself. This induction charging module operates on 5 V input. As such, it could be connected via USB to a conventional transformer in order to charge the circuit when it is nearby.
The power supply circuit is a bit more complex, as some electronics are required for it to work properly.
The Tx coil in the charging base transmits 5 V to the Rx coil in the device to charge the battery. The battery, in turn, has a maximum charging voltage of 4.2 V, and it is not possible to supply it with the 5 V received by the Rx coil. For this power supply to be possible, it is necessary to use a buck converter. This converter converts the input voltage to a specific output voltage so that the battery can be safely charged. In this circuit this converter has the function of lowering the input voltage from 5 V to a voltage of 3.3 V.
Next in this circuit is an LED. This has a visual purpose so as to be perceptible during the testing phase, when the system is charging (LED on), and when it is being powered by the battery (LED off).
A diode is placed between the charging system and the battery. This will allow current from the charging source to flow to the battery; however, it prevents the flow of energy in the opposite direction. This diode is present in the system so that when the circuit is not in the charging base, the battery does not power the Tx coil or the LED.
When the system is running, it is entirely dependent on the battery, since it is a portable device. However, the battery, if used when fully charged, usually has a nominal voltage of 3.7 V. During the first few charging cycles it can reach 4.2 V, which is well above the maximum limit supported by the ESP32.
In order for the system’s input voltage to be in the ideal parameters for the microcontroller to work properly, it is necessary, once again, to use a buck converter to lower the voltage to 3.3 V, which is ideal for powering the circuit.
Finally, the processing circuit is where the hardware and software merge in order to make the system work as desired.
The ESP32 pin D2, which is connected to the output of the charging system, is used to control the start-up of the circuit. Whenever this pin is being powered up, this reports to the system that the device is in the charging base and does not need to be running. As soon as this pin stops receiving a signal, it means that the device has been removed from the charging base, which causes the microcontroller to wake up and check the requirements described in the code.
The temperature sensor, powered by the ESP32 via pins 3v3 and GND, provides the required readings via pin D4.
When all the constraints in the code are met, the EMG sensor can start collecting data through the surface electrodes. It is powered by the same pins as the DHT11 sensor and transmits the data to the ESP32 via pin D34.
Whenever a possible apneic event is detected through the ESP32, an electrical stimulus is sent through the RX2 pin, with the parameters defined in the programming through the stimulation electrode. The LED, again, has a visual function, so that during the tests it could be seen when the stimulus was applied.
3.6. User Interface
Since we live in a society for which smartphones are indispensable, having access to treatment data and having the chance to observe what is really happening during sleep in a more interactive way is certainly a point in favor of this device. More personalized and visually stimulating, a device is most likely to be easier for patients to accept. In this way, an interface was developed to facilitate the visualization of the treatment, as well as to facilitate parameterization so that changes in stimulation parameters could be made instantly, without the need for physical interactions with the device.
The mobile application, which was developed through the MIT APP Inventor platform, was named
SlzzpNea, and a logo was developed for it, as shown in
Figure 12.
The mobile application has the following two main functions: to display the data about the therapy and to control the device.
The first function is directed to the user. It allows the user, after waking up from their night of sleep, to access the history of that night. The application shows the number of apneas prevented during the time the device was used,
Figure 13A, and also allows access to the data of the whole week through graphs,
Figure 13B. To achieve this, the application needs to access the database, in this case
Google Sheet, where the circuit has previously recorded such data during the therapy time.
This ease of access and demonstration of daily and weekly data can be an asset, since a greater number of apneic events during a specific day can be associated with a behavior manifested on the same day. An example of this might be that there is an increase in the number of apneas every Friday, compared to the rest of the week. If the user is used to meeting friends in a bar on Fridays, the increase in the number of apneas can, for example, be associated with the consumption of alcoholic beverages on that day, which, as described above, may be a factor that potentiates the disease. The user who is aware of this increase through the application can voluntarily avoid these risky behaviors in order to reduce the severity of OSA.
The application also allows the user to automatically send the weekly treatment report directly to the medical specialist, and to ask questions and/or obtain advice from their medical doctor directly through the application.
The second aspect of this application meets the medical monitoring, facilitating the doctor–device interaction, in that the parameters of therapy can be changed whenever the medical doctor deems it necessary, without the need for the patient to go to see the specialist, since it can be amended remotely. This differentiates this device from the devices currently available on the market.
Through a login, the specialist can access the parameterization of the device,
Figure 14A. They can, at any time, change the stimulation parameters in a few steps,
Figure 14B, and these are then uploaded to the
Google Sheet. This easy interaction with the treatment is extremely important, since the physician can, after the patient’s complaint or after analyzing the weekly report, modify the therapy to meet the patient’s needs.
5. Conclusions
Through the work developed throughout this article, it is possible to discern that obstructive sleep apnea is, indeed, a problem that has nested in our society and that is taking on more significant proportions, with the prospect of this increasing if it is not faced seriously and if nothing is done to contain it. Many therapies are available on the market, however, patients find them difficult to accept because many of them require surgery for the treatment to be applied. This point makes them unappealing to sufferers of this condition.
In this paper a proof of concept of a device for OSA therapy with a completely different approach was proposed.
The concept of electromyography was studied and explored in order to be able, after data analysis and treatment, to detect apneas when they are about to happen, in order to solve them without the patient waking up from their sleep. One way to overcome this lack of activation of the tongue muscles, which promotes airway collapse, is electrostimulation, as described in the literature. This was simulated in this work using the PWM technique.
Additionally, a smartphone application was developed, which was directed at both the user and the specialist, allowing them to work in a symbiotic way, promoting a more intimate interaction of the patient with the treatment, as well as the doctor–patient relationship, and, thus, obtaining better results.
Through the work developed, it was possible to successfully detect, analyze, and process the muscle’s electrical signals, allowing for the detection of abnormalities and the prevention of potential apneic events, and to store these data in an automated way.
The final, idealized device is shown in
Figure 20.
All the testing, development, and assembly of the circuitry presented above, serves as a proof of concept for its possible implementation in a physical device. This device should take the form of a mouthguard, identical to those used at night for dental alignment. This must be made of a watertight material, such as acrylic resin, in order to be rigid and resistant to all the necessary electronics and components.
This mouthguard must, necessarily, be made with the specific dimensions of each user’s jaw. It must also contain a section made of a more flexible material, which, at the same time, is also resistant, and which houses both the measuring electrodes and the stimulus electrode, pressing them directly against the muscle without causing discomfort.
The electronic component should go through an adaptation of the circuit developed: acquiring more accurate sensors, of a smaller size; and a control system that only has the essential components—in order to have the lowest energy consumption possible—and these components should be designed in a PCB.
The system should be powered by a battery, compatible with the energy needs of the system and the size of the device, which should have enough energy for at least 7 h of operation. The battery should be charged through electromagnetic induction, and the device should be placed in the charging base every day, after use.
The electrodes are a very important element, because the good and effective operation of the system depends on the data collected by these elements. They must be developed especially for this function and be embedded in the system. The myoelectric signal is the electrical manifestation of neuromuscular activation associated with a muscle. This is an extremely complex signal, which can be affected by several factors, such as the anatomical and physiological properties of the muscle under study, the characteristics and accuracy of the sensors used to detect and analyze it, the type of electrodes used to acquire the signal, the stability of the contact of these electrodes with the muscle, and external interference, among others. These adverse factors are mitigated through the use of more precise sensors and electrodes.
For this system to work properly, besides needing a specific mouthguard for each patient, it is necessary that a previous and thorough study of the physiological behavior of each patient is conducted so that the device can be programmed with these characteristics. These will define the stimulation limits as well as the average values collected by the EMG sensor, in order to distinguish a possible apnea from a voluntary movement or relaxation.
As we can see, there are many constraints in the development of this device, the most relevant being the space available inside the mouth, the energy needed to power the circuit, the comfort of the system, and the precision of the readings of the myoelectric signal. Future work will need to address these four points, especially since a solution to the energy consumption may involve the application of Bluetooth Low Energy, thus, saving the system a significant amount of energy.
A study on the materials to be used should also be carried out in order to produce the most solid, resistant, and, above all, watertight product so that infiltrations, both into the circuit and out of the circuit, are not possible.
The method of producing the electrostimulation impulse should also be studied, and a pulse generator that is dedicated to this function should be developed in order to produce and apply the electrostimulus in the most controlled and precise way possible. Additionally, for a practical application, equipment that has been especially developed for the system would be needed, such as the EMG sensor and the contact electrodes that could be placed in the mouth, as well as a semi-rigid support to promote better contact between the electrodes and the muscle surface. The fact that this is a device, although minimally invasive, placed inside the human body, added to the fact that it has a battery, makes this a medium-risk device, and further tests and studies are needed before it can be accepted as a therapy option for obstructive sleep apnea.
In conclusion, the proposed OSA therapy device, despite the need for future adjustments and improvements, may become a good option for the treatment and/or surveillance of this disease.