Embedded Machine Learning on ESP32 for Upper-Limb Exoskeletons Based on EMG - Triwiyanto, Triwiyanto; Maghfiroh, Anita Miftahul; Forra Wakidi, Levana; Dita Musvika, Syevana; Utomo, Bedjo; Sumber, Sumber; Caesarendra, Wahyu; Nugraha, Priyambada Cahya (Jurusan Teknik Elektromedik, Politeknik Kesehatan Kemenkes Surabaya, Indonesia, 2025)
Stroke remains one of the primary causes of long-term disability worldwide and frequently results in persistent impairment of upper limb motor function. To support more effective and intensive rehabilitation, there is a need for wearable devices that can interpret muscle activity and autonomously assist limb movement without relying on an external computer. This study aims to design and implement an upper-limb rehabilitation exoskeleton that is driven by electromyography (EMG) signal classification using machine learning and by real-time elbow angle monitoring, with all models deployed directly on an ESP32 microcontroller. The proposed exoskeleton is built from lightweight, ergonomic 3D-printed components and operates in both unilateral and bilateral modes. Its main contributions include: (1) embedding real-time EMG classification models on the ESP32 so that the device can function independently, (2) integrating EMG-based motor control with elbow angle feedback from an MPU6050 inertial measurement unit, and (3) incorporating a load cell to estimate biceps force during training. EMG signals from the forearm flexor muscles are processed to extract statistical features such as variance (VAR), waveform length (WL), integrated EMG (IEMG), and root mean square (RMS). These features are used to train Random Forest, Decision Tree, Support Vector Machine (SVM), and XGBoost classifiers. The trained models are converted to C code using the micromlgen library for execution on the ESP32. System evaluation involved thirty male participants aged 20–25 years with body weights between 50–85 kg. All tested models achieved 100% accuracy in distinguishing relaxed versus grasping muscle contractions, while the correlation of elbow angles between unilateral and bilateral ESP32 systems reached 0.9469, indicating highly consistent motion detection. The Decision Tree model was selected for deployment due to its superior memory efficiency on the microcontroller. These results demonstrate that the developed ESP32-based exoskeleton provides a practical, efficient, and easily integrable solution for wearable stroke rehabilitation