Drug overdoses are the leading cause of death for U.S. adults under the age of 50, killing more than 70,000 people in 2017 alone.

This grim fact has left researchers and health professionals scrambling to mitigate the devastation caused by the opioid epidemic. Harm-reduction tactics such as making the opioid antidote, naloxone, freely available have been implemented in some states, but too many people still do not receive the lifesaving drug in time. “Overdose is unique in that it's an acute medical condition that is entirely reversible with naloxone or supported respiratory therapy,” says Jacob Sunshine, an assistant professor of anesthesiology and pain medicine at the University of Washington. “The crux of the problem is connecting people who are experiencing overdose with these known established therapies that work pretty much every time.”

A new Science Translational Medicine paper from Sunshine this week proposes a unique tool to do exactly that: a smartphone app that monitors breathing and can send an alert to emergency medical services if it detects an overdose. Death from overdose typically occurs five to eight minutes after someone stops breathing, giving EMS crews enough time to respond if they are alerted immediately.

The software turns a smartphone’s mic and speakers into a short-range sonar system that can detect impaired breathing. The speakers continuously send out inaudible “chirps,” and those sound waves bounce off the user before traveling back to the phone’s microphone. As the sound waves ping back and forth between the phone and the user, the app tracks any changes to the acoustic signal that indicate movement.

During regular breathing, the rise and fall of the chest creates tiny variations in the signal, which the app registers as normal. If a person is breathing extremely slowly (less than seven breaths a minute) or stops altogether, the signal remains constant and the app diagnoses something is wrong. After 30 seconds without a breath, the app triggers an alarm. If the user does not respond, it can then call 911 or the user’s friends or family members. “We designed the system to have a multitiered approach where you’re not going to disturb the user if you just have a single central apnea event or you have a 10-second duration where the person doesn’t breathe,” says Shyamnath Gollakota, an associate professor in computer science and engineering at Washington and co-author on the paper.

The researchers tested the app in a safe injection facility in Vancouver (there are no legal safe injection sites in the U.S.). Safe injection sites have been proposed as a way to prevent overdoses by allowing drug users to inject themselves in a clinical setting where health professionals can administer naloxone if need be. At the Vancouver facility the app correctly identified 45 out of 47 instances (96 percent) when a user stopped breathing for 10 seconds or longer.

A second test of the app on people who were receiving anesthesia before surgery was also successful. Opioids such as fentanyl are used in anesthesia, effectively causing an induced overdose to help render the person unconscious. (The patient remains on a ventilator.) The app successfully identified the moment when the patient lost consciousness and stopped breathing on their own in 19 out of 20 cases. “I love the idea of the app,” says Sheila Vakharia, a policy manager for the Drug Policy Alliance, a nonprofit organization focused on harm reduction with the goal of ending the war on drugs. “I find it to be the exact kind of technology and innovation we need to be thinking about: How do we develop technologies that acknowledge that people are going to engage in high risk practices, how do we develop solutions that actually are grounded in reality?” she adds.

“It’s a clever application and good use of the capabilities of these mobile phones,” says Levent Degertekin, a professor of mechanical engineering at Georgia Tech who was not involved in the study. “It’s a sound approach.”

Like all new technologies, the app is not without flaws that still need to be addressed. Vakharia points out it does not take into account that many drug users are living and using opioids in chaotic environments. To get an accurate reading, the phone must be stationary on a flat surface, like a table or a nightstand, and within one meter of the user. “People who are unstably housed and homeless are not necessarily injecting in those kinds of situations,” she says.

Another potential issue: the user has to start the app after they have injected themselves. Sunshine maintains a person would have time to hit start before the drug reaches their central nervous system. “From a clinical standpoint, it’s completely possible,” he says.

But Elizabeth Brico, a writer who covers drug policy and her own former heroin use, questions Sunshine’s calculation. She says an overdose can occur immediately on injection, so a person might not have time to start the recording. “I’ve overdosed a few times,” Brico says. “For the majority if not all of [those episodes], I just went instantly out. I would not have had the ability to turn that app on.”

Despite a few reservations, Brico and Vakharia both agree the app has the potential to encourage safer drug use by helping people be proactive about the risk of overdose and could even save lives. And in the current epidemic, any tool that can prevent overdose deaths is worth a try.