Inspiration
The inspiration for SeizureSense came from a deeply personal experience. Witnessing one of our close friends experiencing the constant anxiety and uncertainty that comes with epilepsy, we asked ourselves: "How can technology provide peace of mind when every second matters?"
Traditional seizure detection often relies on physical observation or requires expensive, hospital-grade equipment. We envisioned a system that could:
- Detect seizures in real-time using accessible EEG technology
- Provide instant alerts to caregivers, even when they're not physically present
- Offer comprehensive monitoring through an intuitive dashboard
- Be affordable and accessible for home use
The intersection of biomedical signal processing, real-time machine learning, and IoT hardware presented an obvious technical challenge that could make a real difference in people's lives.
What it does
SeizureSense is a real-time EEG monitoring and seizure detection system that:
Monitors Brain Activity: Continuously processes EEG signals at 178 Hz, analyzing brainwave patterns in real-time
Detects Seizures: Uses an XGBoost machine learning model (98.74% accuracy) to predict seizure probability from extracted features
Sends Instant Alerts: When seizure probability exceeds 70%, the system:
- Sends WhatsApp alerts to caregivers with GPS location
- Provides specific details about the seizure and its nature
- Displays alerts on the dashboard
Provides Real-Time Visualization: Interactive React dashboard showing:
- Live seizure probability charts
- Heart rate monitoring
- Detection history and statistics
- System status and controls
Tracks Location: Automatically includes GPS coordinates in emergency alerts, helping caregivers locate patients quickly
Learns from Feedback: Local feedback system allows users to report false positives/negatives for continuous improvement
How we built it
Phase 1: Data Processing Pipeline We started by building a robust EEG signal processing pipeline:
- Signal acquisition - 178 Hz sampling rate, 1-second windows
- Feature extraction - 11 features total:
- Model inference - XGBoost classification in real-time
Phase 2: Backend Infrastructure The Flask backend serves multiple purposes:
- REST API for status, controls, and data retrieval
- WebSocket server for real-time data streaming
- ML inference engine processing EEG windows continuously
- Alert system integrating Twilio (WhatsApp) and ESP32 (buzzer)
- Location services with GPS and IP-based fallback
Phase 3: Frontend Dashboard The React frontend provides:
- Real-time charts using Chart.js showing seizure probability over time
- Live metrics including heart rate and detection status
- Control panel for starting/stopping monitoring
- Alert history and feedback system
- WebSocket integration for live updates without polling
Phase 4: Alert System We integrated multiple alert mechanisms:
- WhatsApp alerts via Twilio with location sharing and Google Maps links
- Dashboard notifications for immediate visual feedback
- Alert cooldowns to prevent spam
Phase 5: Location Services Added location sharing for emergency situations:
- Browser locater for GPS-level accuracy
- IP-based fallback for approximate location
- Google Maps integration for easy navigation to patient location
Challenges we ran into
- Real-Time Performance: Processing 178 samples per second while maintaining < 100ms latency for medical-grade responsiveness
Our Solution:
- Optimized feature extraction using NumPy vectorization
- Implemented data buffering and batch processing
- Used efficient data structures to minimize memory overhead
- False Positive Reduction: Initial model had high false positive rate, causing alert fatigue and reducing trust in the system
Our Solution:
- Implemented debouncing requiring 3 consecutive detections above threshold
- Added cooldown periods
- WebSocket Reliability: Maintaining stable connections during long monitoring sessions, especially with unreliable networks
Our Solution:
- Added connection status indicators on frontend
- Heartbeat/ping mechanisms to detect dead connections
- Hardware Integration: ESP32 communication failures, port detection issues across different operating systems, and serial port conflicts
Our Solution:
- Auto-detection of serial ports across macOS, Windows, and Linux
- Comprehensive error handling for hardware failures
- Clear user feedback when hardware is unavailable
- Instructions to close Arduino Serial Monitor before use
- Location Privacy: Balancing location accuracy with user privacy concerns
Our Solution:
- Location only sent during actual seizure events (not continuously streamed)
- Clear privacy documentation explaining data usage
- Option to use approximate IP-based location instead of GPS
- All location data stored temporarily in memory, not persisted
- Model Deployment: Ensuring consistent model performance across different environments and handling edge cases
Our Solution:
- Model versioning and validation on test datasets
- Comprehensive logging for debugging inference issues
- Fallback mechanisms when model fails to load
Accomplishments that we're proud of
98.74% Model Accuracy: Achieved high accuracy with XGBoost while maintaining real-time performance
Real-Time Processing: Built a system that processes 178 Hz EEG data in real-time with minimal latency, meeting medical monitoring requirements
Multi-Channel Alert System: Implemented three alert mechanisms (WhatsApp, ESP32 buzzer, dashboard) with intelligent cooldown management
Location Sharing: Added GPS location to emergency alerts, making it easier for caregivers to respond quickly
Robust Error Handling: System gracefully handles hardware failures, network issues, and missing dependencies without crashing
What we learned
- Biomedical Signal Processing
EEG signals are incredibly complex and noisy. We learned to extract meaningful features from raw brainwave data:
Time-domain features:
- Statistical measures: mean, standard deviation, RMS
- Higher-order moments: kurtosis, skewness
- Peak-to-peak amplitude analysis
- Real-Time Machine Learning
We discovered that model selection is critical for real-time applications. After testing Random Forest, Neural Networks, and XGBoost, we chose XGBoost for its perfect balance:
- 98.74% accuracy on test data
- < 50ms inference time per sample
- Low memory footprint for edge deployment
Key learnings:
- Debouncing is essential to reduce false positives
- Threshold tuning balances sensitivity and specificity
- Feature engineering matters more than model complexity for this use case
- Real-time constraints require different optimization strategies than batch processing
- Medical Technology Standards
We learned about critical requirements for medical devices:
- False positive minimization: Debouncing and threshold tuning
- System reliability: Graceful handling of hardware failures
- Data privacy: Local processing and secure communication
- User interface design: Clear, non-alarming visual feedback
What's next for SeizureSense
Short-Term Enhancements
- Mobile App: Native iOS/Android app for on-the-go monitoring
- Multi-Contact Alerts: Alert multiple caregivers simultaneously
- Historical Trends: Long-term seizure pattern analysis and visualization
- Seizure Diary: Manual logging with trigger correlation analysis
Advanced Features
- Multi-Model Ensemble: Combine XGBoost, LSTM, and CNN for improved accuracy
- Seizure Type Classification: Distinguish between tonic-clonic, absence, focal seizures
- Personalized Models: Fine-tune model per user using feedback data
Clinical Integration
- EHR Integration: Connect with Epic, Cerner for healthcare provider access
- Doctor Portal: Web interface for neurologists to review patient data
- Clinical Validation: Partner with medical institutions for validation studies
- Regulatory Compliance: Work toward FDA/CE marking for medical device approval
All-in-all, SeizureSense represents our journey from concept to working prototype, combining machine learning, biomedical engineering, and software development to create something that could genuinely help people live safer, more independent lives.
Log in or sign up for Devpost to join the conversation.