Baktiyar Ablaikhan
λ 478.4 nm

EpiCare

A wearable on the ESP32-S3 that detects falls on the device itself, without sending raw data to a server.

Period
2025 – 2026
Role
Independent project
accuracy, fall vs daily activity
97.0%
accuracy, fall vs daily activity
recall
98.9%
recall
windows in the evaluation split
901
windows in the evaluation split

Abstract

EpiCare is a low-cost wearable engineering prototype designed to detect high-risk convulsive emergency events locally and to initiate a caregiver alert without depending on continuous cloud inference. The system combines an ESP32-S3 microcontroller, an MPU6050 inertial sensor, an AD8232 electrocardiography module, and a MAX30102 optical oxygen-saturation sensor. The machine-learning component was evaluated on the SisFall benchmark, which contains falls and activities of daily living (ADLs), rather than clinically confirmed epileptic seizures. In the implemented pipeline, 2-second inertial windows with 75% overlap are converted into seven statistical features and classified by XGBoost. From the reported test confusion matrix (518 true ADL, 23 false alarms, 4 missed falls, and 356 detected falls), the derived window-level performance is 97.0% accuracy, 93.9% precision, 98.9% recall, 96.3% F1-score, and 95.7% specificity. The trained model was converted to C-compatible logic for local execution on ESP32-S3. Physiological measurements and a 10-second manual-cancellation stage are used as safety layers around the motion classifier, while a Flask/Streamlit interface supports remote monitoring and logging. The results demonstrate an edge-computing architecture with high fall-event sensitivity on the selected benchmark, but they do not establish clinical seizure-detection accuracy. Future work requires seizure-specific data, subject-independent validation, synchronized physiological recordings, and clinical supervision. The work may be of interest to students and researchers in embedded AI, biomedical engineering, and assistive wearable systems.

1 Research objective

To design, implement and evaluate a multimodal edge-computing wearable architecture that can recognize high-risk motion events in real time, combine the result with physiological safety checks, and support a human-in-the-loop emergency-alert workflow on low-cost hardware. The measurable objective is to quantify the performance of an edge-ready XGBoost classifier on a public fall-versus-ADL benchmark and to verify that the complete sensing, local-inference, alert-state and remote-monitoring pipeline can be integrated into an ESP32-S3 prototype.

2 Hypotheses

H1. A compact feature vector computed from 2-second inertial windows can enable an XGBoost classifier to distinguish high-impact fall events from activities of daily living with recall above 95% on the project test split.

H2. The trained tree model can be converted into embedded C-compatible decision logic and integrated with ECG, SpO₂, acoustic feedback, a manual override button and remote monitoring without requiring cloud-based inference for the primary motion classification.

The hypotheses are intentionally limited to the available evidence. Because SisFall is not a seizure dataset, successful fall-versus-ADL classification is treated as an engineering proxy for detecting dangerous high-motion events, not as proof of clinical seizure diagnosis.

3 Research stages

StageFocusOutput
1Scientific problemReview wearable seizure-detection literature, identify limitations of motion-only alerts, and define the scope as an engineering proof of concept.
2Hardware designIntegrate ESP32-S3, MPU6050, AD8232, MAX30102, buzzer and manual-override button.
3Signal processingSegment inertial data into 400-sample windows with 75% overlap and compute a compact statistical feature vector.
4Machine learningTrain and evaluate an XGBoost binary classifier on SisFall fall-versus-ADL data.
5Edge deploymentConvert the trained tree ensemble into C-compatible conditional logic using m2cgen and integrate it into the microcontroller workflow.
6Safety and interfaceImplement the pre-alert/cancellation state machine, HTTP telemetry, Streamlit dashboard and CSV logging.
7Critical analysisDerive evaluation metrics from the confusion matrix, identify threats to validity, and define seizure-specific validation as future work.

4 Research procedure

4.1 Scientific context and design rationale

Wearable seizure-detection research is motivated by the need to recognize generalized convulsive seizures outside continuous clinical observation. The ILAE/IFCN clinical practice guideline reports strong evidence for automated wearable detection of generalized tonic-clonic and focal-to-bilateral tonic-clonic seizures when clinically validated devices are used as an adjunct, and stresses that clinical utility and accurate validation remain essential [1]. EpiCare therefore investigates an engineering architecture and does not claim diagnostic equivalence to EEG or to a clinically validated wearable.

Inertial sensors capture large rhythmic motion directly but can confuse intense daily activities with emergencies; photoplethysmography carries autonomic information but is vulnerable to motion artefacts during strong movement [2]. EpiCare separates responsibilities: inertial data drive the edge classifier, ECG is an auxiliary heart-rate signal, SpO₂ is a secondary trend, and the alert workflow includes a user-cancellation stage.

ApproachStrengthMain limitationRole in this study
Clinical EEG / video-EEGRich neurological reference informationNot convenient for continuous everyday use; requires specialist setupReference standard for future validation
Inertial-only wearableLow-cost, direct motion sensing, efficient on edge hardwareCan confuse exercise or abrupt ADLs with dangerous eventsPrimary ML input, but not sole alert mechanism
Optical PPG / SpO₂Can reflect autonomic/oxygenation changesStrong motion can distort optical waveformsAuxiliary trend only
EpiCare architectureEdge ML + ECG/SpO₂ checks + manual override + remote loggingMore hardware complexity; not clinically validatedEngineering integration investigated in this project

4.2 Hardware architecture

The prototype is built around the ESP32-S3-WROOM-1 N16R8 module (dual-core Xtensa LX7 up to 240 MHz [3]; 16 MB flash and 8 MB PSRAM in this configuration), suitable for local signal processing and compact decision-tree inference.

Figure 1. Integrated EpiCare hardware wiring architecture used for the prototype.
Figure 2. Physical EpiCare prototype with ESP32-S3 and connected sensing modules.

4.3 Edge signal-processing pipeline

The offline training pipeline follows SisFall's 200 Hz sampling rate [4]. Each inertial segment contains N=400N = 400 samples (2.0 s); 75% overlap gives a 100-sample (0.5 s) step. Instead of sending raw three-axis sequences to a large model, each window is compressed into seven statistics. The signal magnitude vector

SMV(t)=ax(t)2+ay(t)2+az(t)2\mathrm{SMV}(t) = \sqrt{a_x(t)^2 + a_y(t)^2 + a_z(t)^2}

reduces dependence on device orientation. For every window the project computes mean, minimum, maximum, standard deviation, signal magnitude area (SMA), skewness and kurtosis: mean/min/max describe scale, standard deviation and SMA describe movement intensity, and skewness and kurtosis capture distribution shape. Boosted decision trees suit this small tabular vector because they represent nonlinear thresholds without a large neural-network runtime [5].

  • skewness58.25
  • kurtosis10.26
  • max_smv6.23
  • sma5.53
  • std_smv3.60
  • mean_smv3.01
  • min_smv2.91

Figure 3. XGBoost feature-importance values from the project model. Skewness is the dominant feature in the recorded training run.
Data
FeatureGain
skewness58.25
kurtosis10.26
max_smv6.23
sma5.53
std_smv3.60
mean_smv3.01
min_smv2.91
Original ↗

4.4 Alert and monitoring procedure

Event detection is separated from emergency escalation. The device enters a pre-alert state when either (i) the model's event probability exceeds 0.70, or (ii) heart rate rises more than 10 BPM above the calibrated baseline while SpO₂ falls below 90%. These thresholds are engineering prototype values, not validated clinical cut-offs. During pre-alert the buzzer sounds and the user has 10 seconds to cancel with the physical button; otherwise the device enters a confirmed-alert state and transmits status telemetry.

A Flask endpoint receives JSON telemetry (event probability, heart rate, SpO₂, alert status); a Streamlit dashboard shows the latest values and short-term trends, and time-stamped CSV logging supports later review. The cloud component is for monitoring and record keeping only; primary motion inference stays on the device.

Figure 4. EpiCare monitoring dashboard used to display event probability, heart rate, SpO₂, and alert state.

5 Experimental methodology

5.1 Dataset and task definition

The experiment uses SisFall, a public fall-and-movement dataset recorded with wearable inertial sensors [4], containing 19 activities of daily living and 15 fall types. Fall trials were performed mainly by younger participants for safety; older participants contribute mainly ADL recordings. The dataset is appropriate for benchmarking fall detection but is not a clinical epilepsy dataset. Labels form a binary problem: Fall (positive) versus ADL (negative). An earlier manuscript used the combined label "seizure/fall"; this submission removes that wording from the quantitative evaluation because SisFall has no electroclinical seizure ground truth.

5.2 Preprocessing and feature extraction

  1. Read tri-axial acceleration recordings and preserve the 200 Hz temporal order.
  2. Form 400-sample (2 s) windows with 75% overlap; adjacent windows advance by 100 samples (0.5 s).
  3. Compute SMV from the three axes to obtain an orientation-robust scalar sequence.
  4. Extract seven features per window: mean, minimum, maximum, standard deviation, SMA, skewness and kurtosis.
  5. Assign the binary label (Fall or ADL) and use the feature vectors as XGBoost input.

5.3 Model training and evaluation

An XGBoost classifier was trained with a 70/30 train–test split; the reported confusion matrix contains 901 test windows. Because the original project record does not specify a participant-wise split, the paper describes it as a random project split and treats the metrics as internal benchmark performance, not subject-independent clinical generalization.

PredictedADLFallTrue
ADL
Fall

Figure 5. Reported test confusion matrix for Fall versus ADL classification (n = 901 windows).
Data
True \ PredictedADLFall
ADL51823
Fall4356
Original ↗
MetricDefinitionDerived value
Accuracy(TP + TN) / N97.0%
Precision (Fall)TP / (TP + FP)93.9%
Recall / SensitivityTP / (TP + FN)98.9%
F1-score2PR / (P + R)96.3%
SpecificityTN / (TN + FP)95.7%
False-positive rateFP / (FP + TN)4.25%

The strongest result is recall: 356 of 360 positive fall windows were detected (98.9% sensitivity on this split). Twenty-three ADL windows were misclassified as falls — an understandable trade-off for a safety-oriented system, and the motivation for the manual-cancellation stage and future subject-independent evaluation.

5.4 Embedded deployment test

The trained model was converted with m2cgen into C-compatible nested conditional logic and integrated into the ESP32-S3 workflow, removing the Python runtime dependency. The project demonstrates functional integration of sensing, feature calculation, model decision, buzzer/button state handling, Wi-Fi telemetry and dashboard visualization. Power consumption, memory profiling and repeated end-to-end latency were not documented and are not reported.

5.5 Threats to validity

  • SisFall contains falls and ADLs, not clinically verified epileptic seizures; the metrics cannot be read as seizure sensitivity or diagnostic accuracy.
  • A random 70/30 split can be optimistic if windows from the same person or recording appear in both sets; leave-one-subject-out or group-wise cross-validation would be stronger.
  • Overlapping windows are highly correlated; splitting after windowing may further inflate train–test similarity unless grouping is enforced.
  • The XGBoost input is inertial only. ECG and SpO₂ enter rule-based alert logic, so the classifier metrics do not measure learned multimodal fusion.
  • The physiological thresholds and 10-second cancellation interval have not been clinically validated.
  • No patient study, video-EEG ground truth, prospective false-alarm-per-24-hours measurement, battery-life study or medical-device safety certification was performed.

6 Novelty and degree of independence

6.1 Research novelty

The novelty is architectural and engineering, not a new clinical seizure-classification algorithm. One low-cost prototype combines (1) compact statistical inertial features, (2) XGBoost inference converted for edge execution, (3) physiological safety checks using ECG and SpO₂, (4) an explicit pre-alert/manual-override state and (5) remote monitoring with time-stamped logging. Detection and escalation are separated: the model raises suspicion locally, and a human-in-the-loop stage reduces the practical cost of residual false alarms. A second contribution is methodological transparency — distinguishing what is measured (fall-versus-ADL window classification) from the intended future application (convulsive-seizure safety monitoring).

6.2 Degree of independence

Submitted as individual student research. The student developed the concept, assembled and integrated the hardware, implemented the feature-engineering and XGBoost workflow, converted the model for embedded execution, implemented the alert-state logic and monitoring interface, analysed the confusion matrix and prepared the report. The mentor provided engineering supervision and guidance. No clinical patient data were collected.

7 Results and conclusions

7.1 Main results

ResultEvidence / interpretation
Edge-ready event classifierOn the reported 901-window test split, the fall-versus-ADL XGBoost model achieved 97.0% accuracy, 98.9% recall, 93.9% precision and 96.3% F1-score.
Compact feature representationSeven statistics from 2-second windows were sufficient for the reported performance; feature importance identified skewness as the largest contributor.
Hardware integrationThe model was converted to C-compatible logic and integrated into an ESP32-S3 prototype with inertial, ECG, SpO₂, acoustic, button, Wi-Fi and dashboard components.
Safety workflowA 10-second pre-alert state enables cancellation before escalation, addressing residual false positives.
Scientific boundaryThe experiment validates fall-event classification and system integration only; it does not validate clinical seizure detection.

7.2 Conclusion

Within the proof-of-concept scope both hypotheses are supported: the compact inertial pipeline and XGBoost classifier exceeded the 95% recall target for fall events on the project split, and the model was deployable as embedded decision logic within an ESP32-S3 system that also handles physiological sensing, local alerts, manual cancellation, Wi-Fi telemetry and remote visualization. The key conclusion is not that EpiCare already detects epilepsy clinically, but that the edge architecture is technically feasible and promising enough to justify seizure-specific validation: synchronized, clinically labelled multimodal recordings; participant-independent evaluation; sensitivity reported with false alarms per 24 hours and detection latency; a genuinely multimodal model; and prospective testing under medical and ethics supervision. Until then EpiCare is a research prototype, not a diagnostic or emergency medical device.

7.3 Practical significance

The prototype shows how inexpensive embedded hardware can perform local classification and keep a usable safety workflow when connectivity is unreliable. The same architecture could be studied for other high-risk motion events needing local detection, confirmation, cancellation and caregiver notification; its practical value is the reproducible integration pattern, while the medical application remains a future validation target.

Author statement before submission: All quantitative claims are limited to the experiments documented above. EpiCare has not been evaluated on patients and is not presented as a clinically validated medical device.

Bibliography

  1. S. Beniczky, S. Wiebe, J. Jeppesen, W. O. Tatum, M. Brazdil, Y. Wang, S. T. Herman, and P. Ryvlin, "Automated seizure detection using wearable devices: A clinical practice guideline of the International League Against Epilepsy and the International Federation of Clinical Neurophysiology," Epilepsia, vol. 62, no. 3, pp. 632–646, 2021. doi: 10.1111/epi.16818.
  2. F. Mohammadpour Touserkani et al., "Photoplethysmographic evaluation of generalized tonic-clonic seizures," Epilepsy Research, vol. 159, art. 106255, 2020.
  3. Espressif Systems, "ESP32-S3 Series Datasheet," ver. 2.2, 2026. Technical documentation.
  4. A. Sucerquia, J. D. López, and J. F. Vargas-Bonilla, "SisFall: A Fall and Movement Dataset," Sensors, vol. 17, no. 1, art. 198, 2017. doi: 10.3390/s17010198.
  5. T. Chen and C. Guestrin, "XGBoost: A Scalable Tree Boosting System," in Proc. 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, 2016, pp. 785–794. doi: 10.1145/2939672.2939785.
  6. O. Salem, K. Alsubhi, A. Mehaoua, and R. Boutaba, "Nocturnal epileptic seizures detection using inertial and muscular sensors," IEEE Internet of Things Journal, vol. 10, no. 5, pp. 3912–3924, 2023.
  7. M. A. Sayeed, S. P. Mohanty, E. Kougianos, and H. P. Zaver, "Neuro-Detect: A machine learning based fast and accurate seizure detection system in the IoMT," IEEE Transactions on Consumer Electronics, vol. 67, no. 3, pp. 233–242, 2021.
  8. M. Habtamu et al., "A novel wearable device for automated real-time detection of epileptic seizures," Biomedical Signal Processing and Control, vol. 88, art. 105585, 2024.
  9. World Health Organization, "Epilepsy – Key Facts," 2024.
  10. R. S. Fisher et al., "Operational classification of seizure types by the International League Against Epilepsy," Epilepsia, vol. 58, no. 4, pp. 522–530, 2017.
  11. BayesWitnesses, "m2cgen: Transform ML models into native code," open-source software repository, accessed Aug. 2026.

From the record

Build

  • ESP32-S3 with inertial, ECG and SpO₂ sensors.
  • An XGBoost model trained in Python, converted to plain C with m2cgen and compiled into the firmware.
  • A pre-alert the wearer can cancel, Wi-Fi telemetry and a remote monitoring view.

Outcome

On the 901-window split of falls versus everyday activity (SisFall data): 97.0% accuracy, 98.9% recall, 96.3% F1 — 4 missed falls out of 360.

Limits

The evaluation covers falls, not seizures, and establishes nothing about clinical seizure detection. The test split was drawn at random after cutting the signals into overlapping windows, so neighbouring windows can sit on both sides of the split; the scores are probably optimistic.

Figures

  • MPU6050I2C3-axis accelerometer (motion)
  • MAX30102I2Cpulse and SpO₂
  • AD8232analogECG front-end
  • ButtonGPIOcancels a pre-alert within 10 s
controllerESP32-S3 (N16R8)16 MB flash, 8 MB PSRAM. Runs the XGBoost model compiled to C.
  • BuzzerGPIOpre-alert and confirmed alert
  • Remote dashboardWi-FiFlask endpoint, Streamlit view, CSV incident log
Hardware: three sensors and a button feed the ESP32-S3, which runs the model and raises the alarm.Original ↗

Evidence

  • 01Classification report from the training run — 901 windows, accuracy 0.970
  • 02Remote monitoring dashboard

From the presentation

  • Annotated photo of the prototype labelling the MPU6050 (accelerometer), MAX30102 (pulse/SpO2), AD8232 (ECG), ESP32 N16R8 (8 MB PSRAM), buzzer and confirmation button.
    Hardware architecture slideAnnotated photo of the prototype labelling the MPU6050 (accelerometer), MAX30102 (pulse/SpO2), AD8232 (ECG), ESP32 N16R8 (8 MB PSRAM), buzzer and confirmation button.
  • ROC curve of the XGBoost fall-vs-ADL classifier on the test split; the legend reports an area of 1.00 (rounded).
    ROC curveROC curve of the XGBoost fall-vs-ADL classifier on the test split; the legend reports an area of 1.00 (rounded).
  • Density plot of the per-window maximum signal-magnitude vector (in g) for ADL and fall windows; fall windows are shifted to higher accelerations.
    Max SMV distribution: fall vs ADLDensity plot of the per-window maximum signal-magnitude vector (in g) for ADL and fall windows; fall windows are shifted to higher accelerations.
  • Screenshot of an earlier dark-theme Streamlit monitor ("EpiCare: Multimodal Monitoring") with AI probability, heart-rate and SpO2 metrics above a chart area.
    Early Streamlit monitorScreenshot of an earlier dark-theme Streamlit monitor ("EpiCare: Multimodal Monitoring") with AI probability, heart-rate and SpO2 metrics above a chart area.
  • Code snippet: XGBClassifier with n_estimators=200, max_depth=5, learning_rate=0.1, scale_pos_weight=3, eval_metric="logloss", fitted on X_train, y_train.
    XGBoost parametersCode snippet: XGBClassifier with n_estimators=200, max_depth=5, learning_rate=0.1, scale_pos_weight=3, eval_metric="logloss", fitted on X_train, y_train.
  • Bar chart of window counts per label (0 = ADL, 1 = Fall) in the prepared dataset; the axis has no printed values on the bars.
    Window label distributionBar chart of window counts per label (0 = ADL, 1 = Fall) in the prepared dataset; the axis has no printed values on the bars.
  • Title slide of the school presentation "EpiCare — multisensor epilepsy monitoring" with author, supervisor, NIS PhM Astana 2026 and a prototype photo.
    Title slideTitle slide of the school presentation "EpiCare — multisensor epilepsy monitoring" with author, supervisor, NIS PhM Astana 2026 and a prototype photo.
  • Slide describing the 2-second sliding window with 75% overlap, skewness/kurtosis features and the signal-magnitude-vector formula, with the max-SMV density plot.
    Feature engineering slideSlide describing the 2-second sliding window with 75% overlap, skewness/kurtosis features and the signal-magnitude-vector formula, with the max-SMV density plot.
  • Top view of the breadboard prototype on a transparent background, without ECG leads attached.
    Prototype (cut-out)Top view of the breadboard prototype on a transparent background, without ECG leads attached.