Nuansa Informatika
Vol. 20 No. 2 (2026): Nuansa Informatika 20.2 July 2026

TinyML-Based Stress Detection Using Time-Domain HRV Features and a Lightweight DNN on ESP32: Deteksi Stres Berbasis TinyML Menggunakan Fitur HRV Domain Waktu dan DNN Ringan pada ESP32

Sarmayanta Sembiring (Universitas Sriwijaya)
Kemahyanto Exaudi (Universitas Sriwijaya)
Abdurahman - (Universitas Sriwijaya)
Jorena (Universitas Sriwijaya)
Hadir Kaban (Universitas Sriwijaya)
M. Buffon Prima (Universitas Sriwijaya)
Rahmat Fadli Isnanto (Universitas Sriwijaya)



Article Info

Publish Date
10 Jul 2025

Abstract

Stress is a psychophysiological condition that requires continuous and objective monitoring. However, existing wearable stress detection systems often rely on cloud-based processing or computationally intensive algorithms, limiting their applicability for real-time inference on resource-constrained embedded devices. This study presents a TinyML-based framework for real-time stress detection using the MAX30102 sensor and an ESP32 microcontroller. The proposed framework integrates four time-domain Heart Rate Variability (HRV) features (BPM, SDNN, RMSSD, and pNN50), a lightweight Deep Neural Network (DNN), full INT8 TensorFlow Lite quantization, and on-device inference to enable efficient edge-based stress classification. The DNN model was trained and evaluated using the WESAD dataset. Experimental results showed that a decision threshold of 0.70 yielded the best classification performance, achieving an accuracy of 82% and an F1-score of 0.63 for the stress class. The quantized TensorFlow Lite INT8 model preserved 100% prediction compatibility between the Python and ESP32 implementations. Furthermore, the MAX30102 sensor achieved a BPM measurement accuracy of 98.74%, while the HRV feature extraction implemented on the ESP32 produced results consistent with the reference calculations. These findings demonstrate that the proposed end-to-end TinyML framework enables accurate and computationally efficient HRV-based stress detection on resource-constrained microcontrollers, providing a practical foundation for real-time wearable edge-health monitoring

Copyrights © 2026






Journal Info

Abbrev

ilkom

Publisher

Subject

Computer Science & IT

Description

NUANSA INFORMATIKA adalah jurnal peer-review tentang Informasi dan Teknologi yang mencakup semua cabang IT dan sub-disiplin termasuk Algoritma, desain sistem, jaringan, game, IoT, rekayasa Perangkat Lunak, aplikasi Seluler, dan ...