Inspiration
Every year, over 1 in 1000 people die from SUDEP — Sudden Unexpected Death in Epilepsy. Most of them are found alone, at night, in their beds. Clinical research shows that nighttime supervision and seizure monitoring devices can meaningfully reduce this risk, yet the monitors that exist today cost $300 or more, require subscriptions, and depend on hospital infrastructure that millions of families simply don't have access to. We wanted to build something that could sit under a mattress, cost under $50, work with minimal setup, and alert a caregiver the moment a seizure begins — no subscription, no proprietary hardware, no barriers.
What it does
SeizureDetector is an under-mattress seizure monitoring system built on a Raspberry Pi and an accelerometer. It:
- Detects tonic-clonic seizures by analyzing the rhythmic vibrations they cause through a mattress
- Sounds a local buzzer and flashes a red LED the instant a seizure is confirmed
- Sends a push notification to the caregiver's phone via ntfy
- Escalates with a second alert if no acknowledgment is received within 60 seconds
- Displays a live dashboard showing real-time acceleration data, system status, and a seizure event log The device is contactless — the patient never wears anything. It just lives under their pillow or mattress.
How we built it
Hardware
- Raspberry Pi 4
- GY-521 (MPU6050) 3-axis accelerometer connected via I2C
- Piezo buzzer (GPIO 17), push-button acknowledgment (GPIO 27)
- Red, yellow, and green LEDs (GPIO 24, 23, 22) for visual status
Detection Algorithm
The core of the system is an FFT-based (Fast Fourier Transform) seizure detector running at 50 Hz sampling rate. Every second, it analyzes a 4-second sliding window of acceleration magnitude. It then computes the power spectral density and isolates energy in the seizure frequency band (3–6 Hz). A seizure is flagged when two conditions are both true:
- Rhythmic: band ratio > 0.4
- Strong: amplitude>5×σbaseline
If both conditions persist for 10 consecutive seconds, a seizure is confirmed and alerts fire.
Software Stack
- Detector.py — sensor loop, FFT analysis, seizure confirmation logic
- Alerts.py — GPIO control (buzzer, LEDs, button) + ntfy push notifications
- Dashboard.py — Flask web server with live Chart.js visualization
- Main.py — launches both detector and dashboard in a single command
- Logger.py — records sensor data to CSV for threshold tuning during setup
- Analyze.py — computes statistics on recorded CSV data
Notifications
We used ntfy.sh — a completely free, open-source push notification service. The Pi sends a simple HTTP POST request when a seizure is confirmed. The caregiver subscribes to a topic name in the ntfy app on their phone. No account, no API key, no cost.
Challenges we ran into
- Merge conflicts
- Choosing the right alert system
- Threshold tuning
Accomplishments that we're proud of
- Connecting Raspberry pi to our devices
- Sending alerts on phone during a seizure
What we learned
- How FFT works in practice — moving from theory to real sensor data
- team communication, git hygiene, role clarity
What's next for Seizure Detector
- Expand detection beyond sleeping
- Add LCD display
- A unit to contain our raspberry pi and the breadboard
Log in or sign up for Devpost to join the conversation.