Inspiration

About 70,000 people died of overdose in the US last year. About 3/4 of those were alone when it happened. Overdoses slow breathing and then stop it. It can be revereesd with Naloxone, but only if someone gets there in time. I wanted to build something to get someone there in time, with only what the person already owns.

What it does

BreathBuddy uses high-frequency sound pulses to track breathing, then calls a friend and tells them your location if breathing stops.

A friend can set it up and text a link with no install required. You open the link, press one button to start, then sync your breathing with a cloud mascott to find your chest. The sound is too high frequency for most people to see and they microphone receives the echo from your chest. Once it finds where your chest is, it tracks that area for breathing patterns

If breathing stops it plays an alert sounds and asks "Are you okay?" out loud then gives six seconds to tap the screen. If you dont respond, an AI voice agent calls the friend that sent you the link. It tells them what happend, says where you are naturally like "at home at [address]" or "at CVS on Main street"), then tells them to all 911 if they are unable to reach you. If your friend misses anything they can ask the agent questions.

How it works

It's sonar running in a browser tab. The page loops a short chirp between 20 and 22 kHz and records the echo. Echoes from farther away come back later, so each delay maps to a distance, and every moment becomes a row of distance slices about 6 cm apart.

When you breathe, your chest moves a few millimeters, and that nudges the echo's timing back and forth just slightly. That tiny shift is the breathing signal. To find your chest without asking, I score every slice by how much its motion repeats at a breathing rhythm, and the best slice within 80 cm wins. The app learns how much your chest normally moves, and if that motion drops to a quarter of normal for two seconds while you're sitting still, it raises the alarm.

From there, a small Python server on a Vultr machine places a call using an ElevenLabs voice agent over Twilio. It looks up the GPS location on OpenStreetMap so it can actually name the place.

To test it properly, I built a recorder that saves raw audio with labels like "breathing," "holding," and "moving," plus a replay tool that runs those recordings through the exact code the app uses. That way every change shows up as a score instead of a guess.

Challenges I ran into

The obvious approach picked the wrong thing. My first version just looked for the slice with the most slow motion, and it kept locking onto spots a meter or more away while my chest was at 30 cm. Drift and fidgeting are slow too, but they don't repeat like breathing does, so I switched to scoring repetition.

At one point it found a dog. When I let it search out to 120 cm, it locked onto a dog breathing 114 cm away, so now it caps the search at 80 cm.

Movement was the hardest part, because shifting in your seat changes the echo way more than breathing does and can look like your breathing changed. Now movement blocks the alarm, and there's a six-second countdown for the false alarms that still slip through. I also wanted to text a friend, but carriers blocked texts from my number until a registration got approved, so for now it only calls.

Accomplishments that I'm proud of

It caught 11 out of 11 live breath holds in a quiet room, and 23 of 29 on my harder recordings where I was moving around. The whole loop works for real: you hold your breath, and a few seconds later a real phone rings with a voice explaining why. No audio ever leaves your device, since all the sonar runs in the tab. And it feels like a friend checking in, not a medical monitor, which matters for someone who's alone and maybe scared.

What I learned

An ordinary speaker and mic can measure millimeter chest movement from arm's length, which is still kinda crazy to me. Noticing that breathing stopped turned out to be the easy part. The hard part is not freaking out every time someone moves. Scoring changes against labeled recordings beat tuning by feel, and a few "fixes" that felt better actually scored worse. Every number here comes from one person on one laptop, so next I want to test on more people and on phones, and catch breathing that's slowing down before it stops.

Built With

Share this project:

Updates

Submission history