Opioid overdose detection using smartphones

See allHide authors and affiliations

Science Translational Medicine  09 Jan 2019:
Vol. 11, Issue 474, eaau8914
DOI: 10.1126/scitranslmed.aau8914

Preventing overdose

Opioid addiction and overdose remain serious health concerns in the United States. Naloxone can reverse opioid overdose but requires timely intervention. Toward this goal, Nandakumar et al. converted a smartphone to detect changes in respiration that precede opioid overdose. Using sonar, the smartphone detected respiratory depression and apnea (temporary lack of breathing) in humans after self-injected drug use in a supervised injection facility. Respiratory changes during general anesthesia, which simulates opioid-induced overdose, were also detected in a clinical setting. This proof-of-concept overdose detection device is encouraging; further optimization, including integrating an alert system to notify local emergency medical services of detected overdoses, would be necessary.


Early detection and rapid intervention can prevent death from opioid overdose. At high doses, opioids (particularly fentanyl) can cause rapid cessation of breathing (apnea), hypoxemic/hypercarbic respiratory failure, and death, the physiologic sequence by which people commonly succumb from unintentional opioid overdose. We present algorithms that run on smartphones and unobtrusively detect opioid overdose events and their precursors. Our proof-of- concept contactless system converts the phone into a short-range active sonar using frequency shifts to identify respiratory depression, apnea, and gross motor movements associated with acute opioid toxicity. We develop algorithms and perform testing in two environments: (i) an approved supervised injection facility (SIF), where people self-inject illicit opioids, and (ii) the operating room (OR), where we simulate rapid, opioid-induced overdose events using routine induction of general anesthesia. In the SIF (n = 209), our system identified postinjection, opioid-induced central apnea with 96% sensitivity and 98% specificity and identified respiratory depression with 87% sensitivity and 89% specificity. These two key events commonly precede fatal opioid overdose. In the OR, our algorithm identified 19 of 20 simulated overdose events. Given the reliable reversibility of acute opioid toxicity, smartphone-enabled overdose detection coupled with the ability to alert naloxone-equipped friends and family or emergency medical services (EMS) could hold potential as a low-barrier, harm reduction intervention.


Fatal opioid overdose remains a public health epidemic in the United States (16). Each day, 115 Americans die from opioid overdose, and data from the U.S. Centers for Disease Control and Prevention indicate that the epidemic is worsening (79). Unlike many life-threatening medical emergencies, opioid toxicity is readily reversed with rapid identification and administration of the overdose antidote naloxone or supportive respiratory care (1013). Thus, a fundamental challenge of fatal opioid overdose events is that victims die alone or among untrained or impaired bystanders, with insufficient timely diagnosis and treatment (14). To help connect potential overdose victims with widely available life-saving interventions, we developed algorithms for commodity smartphones that unobtrusively recognize opioid overdose by its physiologic precursors. Our software system, which runs as an application on smartphones, converts the phone into a short-range active sonar system using frequency shifts to identify respiratory depression, apnea, and gross motor movements associated with acute opioid toxicity. By creating overdose detection algorithms that can be used on devices that most high-risk individuals already own (15, 16), we hope to provide a harm reduction system that can automatically connect with naloxone-equipped friends and family or emergency medical services (EMS) to help prevent fatal overdose events (17, 18).

A mobile system that can detect opioid overdose precursors and events in real time does not currently exist because of both design and validation challenges. Existing, human-based approaches to diagnose overdose rely on medical-grade equipment or trained recognition of diagnostic signs of opioid toxicity (1923). Achieving similar sensing capabilities on smartphones, without the need for medical-grade equipment, is challenging because it requires tracking physiological parameters unobtrusively and without violating participant privacy (24, 25). In addition, validating the efficacy of any opioid toxicity system requires access to patients and data while high-risk opioid use occurs, which is difficult because this can represent a medically life-threatening situation. We overcome these challenges with an active sonar-based monitoring solution, leveraging access to two unique environments where people routinely experience overdose-related respiratory physiology without harm: (i) a legally sanctioned supervised injection facility (SIF), where people self-inject previously obtained illicit opioids under medical supervision, and (ii) the operating room (OR), during routine induction of general anesthesia.

Here, we describe a contactless smartphone-based system that matches the performance of an invasive respiratory impedance monitor in identifying three critical overdose precursors: opioid-induced respiratory depression, central apnea, and simulated overdose events (19, 26, 27). We show that a smartphone running our application placed within 1 m of a subject can monitor the subject during the postinjection period. This is the highest risk time for a fatal overdose event and the period during which a potential overdose victim would most benefit from rapid diagnosis and resuscitation.


Concept and algorithms

Our system uses frequency-modulated continuous waveform (FMCW) and converts the smartphone’s native speaker and microphone into a short-range active sonar system (2834) that allows for portable measurement of chest motion and respiration using inaudible acoustic signals. The phone continuously transmits a custom, inaudible, FMCW where the transmitted frequency increases linearly with time between 18 and 22 kHz within a duration of 10 ms (Fig. 1, A and B). These custom acoustic signals reflect off a surface (in this case, a moving chest during respiration), and the echo arrives back to the smartphone’s microphones after a time delay, ∆t, corresponding to the distance of the reflector from the smartphone. The time delay (∆t) is given by 2dvs, where d is the distance of the human body from the smartphone and vs is the speed of sound in air. When the subject’s chest moves because of breathing, the distance (d) to the smartphone and the corresponding time delay of its echo (∆t) at the microphone change. Because the frequency of the FMCW signals increases linearly over time, each of their time delays (∆t) translates to a unique frequency shift (∆f) in the reflected signals. Hence, we can measure the changing distances due to breathing motion by observing the frequency shift caused by the echo over time. The periodicity of the changes generates sinusoidal waves, the peaks of which correspond to a complete breathing cycle (Fig. 1C). A peak detection algorithm then identifies the maximum amplitude of the wave, which enables determination of a subject’s respiratory rate and the presence of apnea.

Fig. 1 Converting a smartphone into an active sonar monitoring system.

(A) Schematic of device operation. The smartphone’s speaker transmits an inaudible, custom FMCW signal (red arrow), which is reflected by the subject (blue-dashed arrow) and recorded using the smartphone’s microphone. (B) The reflections arrive at time delays ∆ti and ∆te during inhalation and exhalation; the changes translate to unique frequency shifts ∆fi and ∆fe. (C) The frequency shifts can be estimated by taking an FFT over 15 chirps; the breathing signal is found in a frequency bin corresponding to the subject’s distance from the smartphone. Motion in the environment from a different distance would appear at a different frequency bin and hence can be separated.

Our system builds from previous work using active sonar to detect sleep apnea (28); however, the opioid use case differs from the sleep environment in several fundamental ways. First, breathing motion is diminished during opioid use, which can complicate respiratory peak detection. In addition, subjects may be under the influence of opioids when they initiate a subsequent use event and thus may have a diminished breathing signal at that time. Unlike the sleep laboratory used in previous work, which is a controlled environment with a lone subject who is primarily stationary, subjects using opioids may have increased motion that can affect the time delay of the echo, may engage in high-risk opioid use behaviors in the presence of others, and are generally in a much less-controlled environment, which introduces other sources of potential interference (35, 36). The SIF where our experiments were performed is a highly dynamic and stimulating environment; recording devices are prohibited within the SIF, but the environment can be observed in a public domain report (37). For example, there are routinely several people around; there is talking among clients; staff and clients walk around; overhead music plays; and occasionally, personal dogs are within the environment. In addition, there is climate control equipment and a special indoor ventilation system (to remove the smoke from heroin preparation), all of which produce ambient noise. In short, there are several environmental elements in the high-risk opioid use domain that differ from the controlled setting of a sleep laboratory.

We developed algorithms that address these challenges. Our algorithm uses FMCW to disambiguate the reflections at different distances from the smartphone, the resolution of which is about 0.7 cm with a typical microphone sampling rate of 48 kHz. Thus, the algorithm can separate the subject’s breathing signal from other movements in the environment that occur at a different distance (for example, those of an opioid-using companion). In addition, by tracking the distance corresponding to the subject’s breathing signal, the algorithm automatically recalibrates when a posture change occurs or when the subject or phone changes position. Figure 2 demonstrates benchmark performance across phone models (Galaxy S4, S5, S6, iPhone 5S, Google Pixel, and Nexus), phone orientations, subject distance and posture, and various environmental noise and motion conditions.

Fig. 2 Breathing rate accuracy across different scenarios.

The system was evaluated across (A) different smartphone models, (B) orientations of the smartphone, (C) various positions of the smartphone with respect to (w.r.t.) the subject, (D) in the presence of interference from another nearby moving subject, (E) with environmental noise from devices placed 75 cm from the subject, (F) as a function of distance from the smartphone, and (G) recalibration accuracy after the subject changes the orientation of the phone, as well as slouches. (H) The fraction of time the subject’s respiration and other motion was captured by the algorithm in the SIF deployment. Individual data for benchmark testing are reported in table S2.

Real-world illicit opioid use (SIF)

We deployed our system in Vancouver, BC, within an approved SIF. Although our primary targeted algorithm user is a person who uses opioids when alone (the demographic at highest risk for fatal overdose), we chose the SIF environment because it facilitates safe, real-world testing and algorithm development based on actual opioid self-injection events. Acute, life-threatening overdose events requiring medical intervention remain relatively uncommon in this environment, occurring in less than 1% of opioid use events (about 500 supervised injections occur per day in the facility) (38). Therefore, our primary outcomes of interest were postinjection central apnea (cessation of breathing for 10 s or longer) (27) and opioid-induced respiratory depression (respiratory rate ≤7 breaths per minute) (39, 40), both of which are necessary precursors to lethal opioid intoxication events.

We recruited participants over 209 self-injection instances (194 unique participants): 115 injection events were used as a development set, and 94 were used as an evaluation set to measure algorithm performance (Table 1). Sixty-four participants (68%) reported using heroin, 19% reported using fentanyl, and 13% reported using morphine or hydromorphone. After injection, 83 participants (88.3%) experienced a decrease in respiratory rate during the monitored postinjection period (fig. S2); 47 participants (50%) experienced clinically important respiratory depression; 49 participants (52%) experienced at least one postinjection central apnea event; and 8 participants (8.5%) had a manual intervention by clinical staff, of which 2 participants (2.3%) experienced an overdose event requiring clinical resuscitation (oxygen, bag-mask ventilation, and/or naloxone therapy). Both overdosed participants were successfully resuscitated by the clinical staff without issue.

Table 1 Demographic summary of participants in algorithm evaluation (SIF and OR).

SIF, supervised injection facility; OR, operating room.

View this table:

The smartphone-based system identified postinjection central apnea events (cessation of breathing for 10 s or longer) with 95.9% sensitivity [95% confidence interval (CI), 86.0 to 99.5%] and 97.7% specificity (95% CI, 88.2 to 99.9%). The system had 87.2% sensitivity (95% CI, 74.2 to 95.1%) for identifying postinjection respiratory depression (respiratory rate 7 breaths per minute) and 89.3% specificity (95% CI, 76.9 to 96.4%; Fig. 3, B to E).

Fig. 3 Measurement of real-world, high-risk opioid use events.

(A) Overview of experimental sequence. Testing was performed in an SIF (InSite). (B and C) Sensitivity and specificity for respiratory depression (RD) and central apnea events (CAE). (D) Postinjection respiratory rate on a smartphone versus reference standard. (E) Postinjection central apnea event detection on a smartphone versus reference standard. (F to I) Smartphone breathing signals (amplitude over time) of four subjects whom InSite staff physically checked on after injection. (F) Overdose: Subject exhibits multiple central apnea periods, followed by deep breath. (G) Overdose: Subject exhibits respiratory depression with an average respiratory rate of four breaths per minute. (H) Intervention: Subject exhibits central apnea, is aroused by staff, and becomes agitated. (I) Intervention: Subject slouches after injection and staff physically check on patient, whose breathing does not meet respiratory depression or central apnea thresholds.

Figure 4A shows the distribution of the number of central apnea events per participant, as identified by our system. Forty-five of the 94 participants (48%) had no central apnea events, all of whom had no interventions by staff. Among those who experienced a postinjection central apnea event, 71% had one to two central apnea events during the 5-min postinjection monitoring period. Figure 4B is a histogram of the durations of these central apnea events. The plot shows that 66% of central apnea events were ≤20 s in duration. We also note that both overdosed participants had a central apnea event of at least 30 s before clinical intervention.

Fig. 4 Distribution of observed central apnea events in the SIF.

(A) Histogram of central apnea events per participant. (B) Histogram of the duration of the central apnea events identified by the smartphone-based system.

Simulated overdose detection (OR)

A key limitation of the SIF environment is the limited occurrences of overdose events requiring clinical resuscitation. To address this, we deployed our system in the OR. This controlled environment allowed us to safely simulate the worst-case scenario of acute opioid toxicity: immediate loss of consciousness coupled with respiratory depression that would be fatal or critically morbid without intervention. Such conditions are safely reproduced during routine induction of general anesthesia (Fig. 5A) when patients receive fentanyl and other anesthetic drugs.

Fig. 5 Measurement of simulated overdose events in the OR.

(A) Illustration of OR setup. The phone is placed within 1 m of the patient on a surgical (Mayo) stand. A respiratory impedance monitor is fitted around the patient’s chest to measure the true respiratory rate and apnea status. Healthy participants wearing all standard OR monitors have general anesthesia induced. (B) Comparison of time to detection of simulated overdose based on algorithm-identified respiratory failure onset (smartphone) versus real-time detection by the reference standard.

We recruited for 35 instances of simulated overdose (34 unique participants): Data from 15 patients were used as a development set to generate the algorithm, and 20 were used as an evaluation set to validate algorithm performance. Results from the evaluation cohort are presented (Table 1 and Fig. 5B). In the evaluation set, as expected, all 20 patients experienced true overdose physiology, characterized by postinjection loss of consciousness and diminished or absent breathing. Our algorithm identified 19 of the 20 simulated overdoses as having disordered breathing. Of the 19 correctly identified patients, 18 patients experienced sustained apnea (terminated per protocol after 30 s), and 1 patient had severely diminished breathing that the algorithm identified as an overdose. The one patient who was incorrectly classified had a breathing signal just above the algorithm’s threshold. In each case where the algorithm correctly identified the overdose event, it detected the onset of respiratory failure similarly to the real-time reference standard (Fig. 5B). We note that specificity is not meaningful in this environment because all participants experience the simulated overdose event (all patients undergoing induction of general anesthesia lose consciousness and experience depressed breathing) (41).


Here, we used a commodity smartphone to run an algorithm to identify opioid overdose precursors. Overdose events are readily reversible with early detection. In the setting of real-world, high-risk opioid use, our results highlight the need for a multitiered interactive phone-based alarm system that escalates or de-escalates based on user feedback. We do not envision the phone-based system alerting a third party or disturbing the user based on an isolated central apnea or respiratory depression event; rather, an alert should be sent only after a subject is unable to respond to a stimulus from the phone after a sustained central apnea or respiratory depression event, representing a potentially life-threatening overdose. Evaluating such a multitiered system would be the next step in enabling an end-to-end overdose detection system using commodity smartphones.

Our study has several limitations. Healthy participants recruited for the OR experiments are likely different from the eventual intended user population. We chose this healthy population in the OR setting for reasons of safety and algorithm development for the worst-case scenario of acute opioid overdose (which is safely reproduced in an OR environment). External validity was addressed by testing in the SIF with participants who are more likely to use the application as it is eventually intended. It is beyond the scope of this study to seek and recruit subjects who use high-risk opioids alone or to conduct our study procedures in a participant’s personal environment outside of the InSite facility. In addition, development of a harm reduction intervention does not ensure adoption and use. For harm reduction interventions to be efficacious, further studies with participant feedback and human factor testing are needed to ensure that the system meets the needs, values, and preferences of people who use opioids, in addition to establishing the system’s safety vis-à-vis its potential to encourage moral hazard. Other harm reduction interventions such as take-home naloxone programs have been found not to increase risky behavior or lead to adverse health consequences (4244). Previous data on harm reduction interventions show that people are willing to engage in behaviors to help keep themselves safe, such as using needle exchanges, take-home naloxone, face shields for mouth-to-mouth respiratory support, and SIFs (4547).

Our benchmark tests highlight that accuracy is best achieved using the phone within 1 m, with the phone oriented at 90° from the subject and away from a separate loud speaker. Formal evaluation of a subject’s ability to comply with these recommendations is an important area of further inquiry.

Another potential concern is whether the system could reliably alert prehospital EMS providers in a time frame that enables successful resuscitation with naloxone or supportive respiratory care. On the basis of historical data from Seattle, King County, involving fatal overdose events and average EMS response times, we believe that a meaningful EMS integration is possible (fig. S1). Such a program would need to incorporate the detection algorithm’s performance characteristics to leverage the operations and resources of a given EMS system. Any integrated program must also acknowledge that, even with rapid connection to EMS, victims could still experience morbidity and mortality after opioid overdose (48).

In summary, we developed a proof-of-concept system that can be implemented on commodity smartphones and can identify simulated and real-world opioid overdose events and their precursors. As a harm reduction intervention, such a system could connect people experiencing potentially fatal overdose events with known life-saving interventions (naloxone-equipped friends, family, shelter personnel, or EMS) in real time. As the number of deaths attributable to opioid overdose continues to rise, new strategies are needed to help mitigate the risk of death and disability from this public health epidemic. One key tool to reverse these events is naloxone, which is increasingly available to first responders (including police) and to people through take-home naloxone programs and is now endorsed by the U.S. government (49). In addition to its use by EMS providers, the administration of naloxone by trained friends and family has been shown to be a safe and effective means of reversing overdose (13, 50). However, neither EMS, friends, nor family can intervene with naloxone or supportive respiratory care in an emergency if they are not immediately aware that an overdose is taking place. Noninvasive self-monitoring via smartphone, as we have described, could address this critical shortcoming and may represent an easily accessible strategy to help keep people safe until they are able to access long-term treatment.


Study design

We investigated the accuracy of a smartphone-based software system for identifying opioid-induced respiratory depression, central apnea, and simulated overdose events. Ground truth (gold standard) measurements were taken with a respiratory impedance monitor. In both the SIF and the OR, a development set was used to develop the algorithm and an evaluation set was used to prospectively evaluate algorithm performance. To demonstrate feasibility, we chose to stop recruitment after >200 instances of illicit opioid self-injection. In the OR, because the algorithm was highly sensitive in detecting sustained apnea after induction of general anesthesia, we did not pursue beyond 35 participants. Randomization was not applicable, and investigators were not blinded. All participants provided informed consent, and the studies were approved by the University of Washington Institutional Review Board (IRB), the University of British Columbia Office of Research Ethics, and the Vancouver Coastal Health (VCH) Ethics Services (VCH operates the SIF, InSite).

Active sonar detection of breathing signals

Our system transmits FMCW signals and analyzes the frequency shifts resulting from human motion. The frequency shift, from which the respiratory rate is derived, was determined by performing a fast Fourier transform (FFT). We chose an FMCW chirp period of 10 ms, which gives a frequency resolution of 100 Hz. The unique challenge with opioids acting on the central nervous system is that breathing motion can be severely depressed. For our FMCW signal with a 4-kHz bandwidth, this minute motion can translate to a frequency shift less than 8.33 Hz. To extract this, we perform an FFT over 15 consecutive chirps, which linearly increases the frequency resolution to 6.66 Hz and thus captures even severely depressed breathing motion, down to a chest movement of 0.7 cm. By taking an FFT over 15 chirps, any high-frequency motion within this duration is averaged and hence lost. However, because the average breathing rate of human subjects is less than 20 breaths per minute, which is a relatively low-frequency motion, no breathing motion is lost within the 150-ms FFT duration.

To extract the breathing signal, the algorithm first estimates the distance of the person’s chest from the smartphone over time. The breathing signal is present in a unique frequency bin corresponding to this distance. To identify this bin, the algorithm starts by looking from the 18-kHz bin (corresponding to distance zero, directly in front of the phone) and proceeds to 18.320 kHz (corresponding to a distance of 1 m away from the phone). For each bin, it examines changes in the power value over a duration of 30 s by performing a second FFT over it. If a peak between 0.5 and 0.7 Hz (the typical breathing frequency of a human) is observed, then that bin corresponds to the breathing signal. Therefore, the second FFT occurs until the bin that corresponds to the breathing signal is found. In the worst-case scenario, the system may iterate through 48 bins before isolating the breathing signal. Once found, the signal recurs within the same bin as long as the subject remains in place. However, when a subject moves, the bin corresponding to the distance has a motion signal instead of breathing. In this scenario, the system reinitiates the search for the new bin containing the breathing signal. In particular, if the distance of the subject from the smartphone changes, then we estimate the new distance by computing the bin corresponding to the breathing after the motion.

Detecting opioid-induced depressed breathing

Breathing motion is diminished when people use opioids. To overcome this, we make two changes to the peak detection algorithm. First, to remove any small motion noise, we run the data through a bandpass decimating Cascaded integrated comb filter. The filter removes any motion noise higher than a frequency of 1 Hz and also decimates the signal by a factor of 2. Second, we collect a baseline breathing signal for a duration of 1 min before the self-injection event. From the baseline collection period, the algorithm calculates the subject’s average peak amplitude, peak prominence, and average peak distance. These parameters are used to identify the peaks during postinjection monitoring. For the baseline signal, the algorithm leverages the periodicity of the breathing signal and the frequency limits of the breathing signal (less than 20 breaths per minute) to estimate breathing peak parameters. Specifically, only peaks that are separated by a minimum of 20 samples (corresponding to a maximum breathing rate of 20 breaths per minute) are considered. During postinjection monitoring, we combine this condition along with the average peak parameters that we estimated in the first step. Peaks separated by a minimum of 20 samples that have an amplitude of at least 50% of the baseline and 30% of the peak prominence are classified as breathing peaks. If the number of peaks is less than or equal to seven, then the epoch is marked as a respiratory depression event. If the distance between the peaks is greater than 10 s, then we mark a central apnea event. If the number of breaths in the epoch is at least greater than three, then we update peak amplitude, peak prominence, and distance values with the combined average of new peak values. If a specific peak is twice as great as the average peak values, then the system does not use that peak in average peak parameter computations.

Differentiating breathing from motion

Because subjects’ faces and hands are close to their chests and are about at the same distance from the smartphone, the change caused by motions of these body parts can be added to the breathing signal in its frequency bin during the primary algorithm’s FFT operation. Moreover, this motion has higher amplitude compared to the more subdued breathing motion and can overpower the breathing signal, making it difficult to extract the breathing motion. Although such motion noise would typically be problematic, the presence of motion provides additional information about the subject. Specifically, sustained motion indicates that the subject is active and not overdosed. Similarly, motion that is followed by breathing indicates that the subject is active and thus not overdosed. On the other hand, motion within the operational range that is followed by an absence of breathing likely indicates an overdose scenario. Hence, we modify the algorithm to differentiate between a signal corresponding to periodic, low-frequency breathing motion and one that belongs to high-frequency body motion, which is aperiodic and high amplitude. We identify this by looking at the peaks in the second FFT operation of the 30-s signal corresponding to each bin. If the peaks have higher frequencies and an amplitude at least twice that of the breathing frequency peaks, then the instance is classified as a motion epoch. If the motion is absent or present only for a few seconds, then the algorithm considers it to be a breathing signal and processes it to identify the respiration rate.

Distance recalibration

When we encounter a motion epoch, the distance of the subject with respect to the smartphone can change. Hence, after every motion epoch, we need to run the recalibration step to detect the frequency bin that corresponds to the new distance of the subject from the smartphone. When we encounter the first motion epoch, we set the motion bit to 1 and examine the next epochs. For subsequent epochs, we search all the nearby FFT bins until we detect the bin that has the breathing signal. We then use this new bin for the next set of epochs until we see the next motion epoch. For the first breathing epoch after the motion epoch, we update the peak parameter values to the average values of the new epoch corresponding to the new distance of the subject.

To review, we first filter the recorded signal using a high-pass filter to remove audible environmental noise. We then split the data into 30-s epochs and run the distance estimation step described above on the first epoch to identify the bin that contains the breathing signal. We estimate average breathing peak amplitude, peak distance, and average peak prominence for this epoch. For subsequent epochs, we check the same frequency bin in the distance estimation algorithm. If it contains the breathing signal, then we use the previously estimated amplitude and prominence values to determine the breathing peaks in this epoch and subsequently update them with the new peaks of the current epoch. This continues until the bin contains a motion signal instead of breathing signal. If the subsequent epoch does not contain the breathing signal and instead contains the motion signal (high amplitudes, more peaks), then we mark it as a motion epoch and run the recalibration step for the subsequent epochs until we find the new breathing signal.

Suppressing environmental motion

High-risk opioid use commonly occurs as a group activity, which introduces another source of potential interference (35, 36). In this case, the interfering subject’s breathing or motion may change the received echoes at the smartphone. However, because the interfering subjects will mostly be located at different distances with respect to the smartphone, their breathing motions (as determined by the primary FFT operation) would occur at different frequency bins than that of the subject of interest. Assuming that the smartphone is closest to the intended subject, namely, within 1 m, the first frequency bin containing the breathing signal likely corresponds to the breathing motion of the intended subject. The algorithm therefore filters out any breathing detected at farther distances.

Computational complexity

In the worst case, our algorithm performs 54 FFT computations per second and one linear peak estimation algorithm. Such operations can each be computed within tens of milliseconds on an off-the-shelf smartphone (51, 52). This delay is within the expected human response time (for visual overdose identification) of a few seconds. Last, on the basis of the duration of high-risk opioid self-injection events, we expect the application to run for less than 45 min per day and not more than 15 min per event. The algorithm’s computations along with the sensor data collection consume 6 to 18% of a phone’s battery power for this duration. In addition, most fatal overdose events occur within a private residence, hotel, or motel (53), which should have an available power source.

Vancouver SIF

Participants. All people who inject opioids and use the SIF, who were over 18 years old, and had capacity to provide informed consent (as determined by InSite staff) were eligible for study inclusion. People under the age of 18 and impaired individuals were not eligible (per SIF protocol, severely impaired individuals are assisted and are unable to use the facility). Potential participants were identified at the time they checked into the SIF for the purposes of supervised opioid self-injection and were approached by a research assistant for informed consent. Participants were approached consecutively after check-in into the facility. Participants were given a coffee gift card worth $5 for participation.

Measures. We computed the breathing rate to identify respiratory depression and central apnea occurrences, both of which can indicate or precede a fatal opioid overdose. We defined a breathing rate of ≤7 breaths per minute to be a respiratory depression event, and the absence of breathing for 10 s or longer to be an opioid-induced central apnea event. We chose a respiratory rate of ≤7 breaths per minute because the Agency for Healthcare Research and Quality has found this respiratory rate to be sufficiently dangerous to recommend as a trigger for a hospital’s rapid response system (39, 40). The U.S. Food and Drug Administration (FDA) defines an apnea event as cessation of breathing for 10 s or longer and requires FDA-approved apnea devices to detect this threshold (27).

Protocol. Clients, who consented obtained sterile injecting equipment per routine, were assigned to a monitored injection stall and were asked to prepare their drugs as they normally would. Monitored stalls were equipped with a dedicated off-the-shelf phone with our preinstalled app, which was placed on the tabletop. All subjects, regardless of participation, received standard clinical monitoring by the SIF clinical staff according to institutional protocols. Postinjection overdose detection by staff was defined by standard institutional triggers listed (table S1). Notably, routine staff monitoring relies on visual monitoring for acute clinical distress and does not involve active respiratory monitoring equipment.

Once participants had prepared their equipment and drugs, they were fitted with a respiratory impedance monitor for reference standard monitoring. Then, the participants were asked to remain seated and breathe normally for 1 min to establish a baseline respiratory rate. A Galaxy S4 smartphone, placed within 1 m of the participant on the injection stall table, began respiratory monitoring at the initiation of the 1-min baseline measurement (Fig. 3A). Participants then self-injected opioids and monitoring continued for 5 min. We chose 5 min because this represents the critical period when an acute overdose would occur; from a pharmacology perspective, fentanyl reaches a peak plasma concentration within 3 to 5 min and more than 80% of the injected dose leaves the plasma by 5 min (54). If an overdose event occurred, or a participant was in a clinical state sufficiently concerning that a trained medical staff member walked over to check on a patient, then it was recorded by the research assistant and counted as an intervention event.

As we note in the main text, there were eight instances where a staff member checked on a participant after injection out of concern for their clinical state. In the six instances (including the two reversed overdoses) where the respiratory impedance monitor identified disordered breathing, the algorithm identified respiratory depression or central apnea in all six. In the two other instances, the subjects had fallen asleep and slouched in their chairs after injection; however, both had respiratory patterns that did not meet the respiratory depression or central apnea thresholds (the smartphone and respiratory impedance monitor correctly identified normal breathing, wheareas the staff misclassified potential clinical distress, although appropriately checked on the patient).

Operating room

To optimize surgical conditions, patients are routinely given fentanyl and other potent drugs immediately before surgery to purposefully induce apnea. The physiologic equivalent of drug overdose occurs each time a patient undergoes general anesthesia; however, patients are unharmed by this induced “overdose” because of their supraphysiologic oxygen stores and the timely ventilatory support that the anesthesiologist provides. Therefore, anesthetizing a patient in the OR offers a unique way to safely simulate an otherwise lethal overdose event (characterized by unconsciousness and diminished or absent breathing) induced by fentanyl and other opioids.

Healthy patients free of cardiopulmonary disease, aged 18 to 55 and scheduled for elective surgery, were eligible for the OR study and were approached on the day of surgery. Participants were given an Amazon gift card worth $50 for participation. Once inside the OR, patients were fitted with standard anesthesiology cardiopulmonary monitors: pulse oximeter (Nellcor OxiMax, Medtronic), blood pressure cuff (NovaPlus, Welch Allyn), and 5-lead electrocardiogram (Philips IntelliVue). In addition to the standard anesthesiology monitors, participants were fitted with a Vernier respiratory belt to provide reference standard respiratory monitoring. The smartphone (Galaxy S4) was placed on a surgical stand ≤1 m away at about chest level (Fig. 5A). Next, the clinical team conducted their standard OR preinduction safety procedures (safety surgical and preanesthesia checklists). The ventilation mask was affixed to the patient with a strap. OR personnel were asked to stand away from the patient; the attending anesthesiologist was beside the patient and immediately available. Next, per standard anesthetic procedure, the participant breathed 100% oxygen for 3 to 5 min until their expired oxygen stores were greater than 85%—a threshold deemed safe to administer induction doses of anesthetic agents to induce apnea (55). This standard preoxygenation procedure allows the body to be safely apneic without having the oxygen saturation fall to unsafe levels during apnea periods that may persist for as long as 7 min under normal conditions (56). The attending anesthesiologist then administered induction doses of fentanyl and propofol in doses at his/her discretion for standard induction of general anesthesia (the average fentanyl dose was 1.4 μg/kg; the average propofol dose was 2.9 mg/kg). The attending anesthesiologist announced the moment when the patient had become apneic, at which time a timer was started. The timekeeper announced the elapsing time in 10-s intervals until 30 s was reached [we chose 30 s of apnea as a suitably safe period for a preoxygenated individual to be completely apneic before intervention (56) and termination of the protocol]. At 30 s, the protocol was officially over, at which point the anesthesiology team assumed control of the airway (administered a neuromuscular blocking agent, if indicated) and provided manual ventilation and inserted an endotracheal tube or laryngeal mask airway. No neuromuscular blocking agents were administered during the protocol. Once the participant’s airway was secured and it was deemed safe by the clinical team, the study team removed the research equipment and exited the OR. As per the IRB protocol, the attending anesthesiologist could intervene at any moment and for any reason during the protocol should the patient require intervention. Breaking protocol was in no cases required during the study because all patients safely tolerated the procedure.

Statistical analysis

We used standard analyses to assess the respiration rate measurements of the smartphone-based system against the reference measurements from the impedance monitor. In particular, we assessed the accuracy using scatter and bubble plots equipped with trend lines. To determine the accuracy of the opioid overdose precursor detection algorithm, we used standard techniques to calculate sensitivity (true positive rate) and specificity (true negative rate) and we report Clopper-Pearson CIs around these estimates. For all the benchmark experiments, we compute the bias error (μ, mean of the errors) and precision error (σ, SD of the errors) to compare the respiration rate measurements of our system against the standard impedance monitor.


Materials and Methods

Fig. S1. Connecting overdose victims with EMS.

Fig. S2. Postinjection respiratory rate decrement.

Table S1. InSite institutional overdose indicators.

Table S2. Benchmark testing and individual data for Fig. 2.

Reference (57)


Acknowledgments: We thank our participants and the clients of InSite. We acknowledge J. Buxton, R. Joe, and C. Banta-Green for facilitating access to InSite in Vancouver, BC. We also thank A. Gee, S. Blawatt, and K. Scott for assistance with participant recruitment. We thank S. Kaplan, S. Sharar, M. Crowder, P. Morgan, S.-I. Lee, and L. Ceze for critical feedback on the manuscript. We also thank M. Sayre, J. Hood, T. Rea, and C. Clasen for providing data and insight on fig. S1. Last, we thank V. Iyer for assistance with conducting experiments in Vancouver, BC, and J. Chan for help with formatting the figures. Funding: This work was supported by the Foundation for Anesthesia Education and Research (FAER), the National Science Foundation (1812559), and the UW Alcohol and Drug Abuse Institute (ADAI). Author contributions: All authors designed the experiments, interpreted the results, and wrote the manuscript. R.N. conducted the experiments and performed the analysis with technical supervision by S.G. R.N. and S.G. designed the algorithms. J.E.S. conceptualized the study. Competing interests: All authors are inventors on U.S. provisional patent application no. 62/675560 (submitted by the University of Washington), which is related to this work. All authors have equity stakes in Sound Life Sciences, Inc., which is related to the technology presented in this manuscript. S.G. is a paid consultant to Jeeva Wireless Inc. and Edus Health, Inc. Data and material availability: All data necessary for interpreting the manuscript have been included. Code is available with a noncommercial license; contact license{at}

Stay Connected to Science Translational Medicine

Navigate This Article