An EEG Emotion Recognition System Based on the STM32 Microcontroller
Abstract
Mental health issues, particularly depression, have become a significant challenge in global public health. Early screening for depression faces difficulties due to the limitations of subjective diagnostic methods. This study proposes an EEG emotion recognition system based on the STM32 microcontroller, utilizing deep learning for real-time, portable mental health monitoring. The system processes EEG signals captured by the Muse headband using sliding window techniques, combined with time-frequency domain fusion to enhance emotional feature representation. A convolutional neural network (CNN) is employed to classify emotions into negative, neutral, and positive categories. Optimization techniques are applied to adapt the model to resource-constrained embedded devices, achieving a compression rate of 67.4%. Despite performance trade-offs in microcontrollers, the optimized CNN model maintains an accuracy of 81% on the STM32 platform, demonstrating the practical value of the system. Cross-platform comparison analysis shows that microcontrollers exhibit a larger performance gap in more emotionally polarized categories but still hold potential for edge computing applications. This study provides a feasible solution for deploying deep learning models on embedded devices, supporting continuous mental health monitoring in daily life.
References
- World Health Organization. (2022). World mental health report: Transforming mental health for all. https: //www.who.int/teams/mental-health-and-substance-use/world-mental-health-report.
- Xie, L. (2024). A review of diagnostic methods and related interventions for depression. Advances in Social Sciences, 13(1), 1-7. https: //doi.org/10.12677/ass.2024.131001.
- Chen, B. (2017). Beware of hidden depression. Political Work Guide, 4, 49-50. https: //doi.org/10.16687/j.cnki.61 1063/d.2017.04.035
- Haenel, T. (2018). Die larvierte Depression. In: Depression – das Leben mit der schwarz gekleideten Dame in den Griff bekommen. Springer, Berlin, Heidelberg. https: //doi.org/10.1007/978-3-662-54417-4_4.
- Constantinos Halkiopoulos, Evgenia Gkintoni, Anthimos Aroutzidis , et al.Advances in Neuroimaging and Deep Learning for Emotion Detection: A Systematic Review of Cognitive Neuroscience and Algorithmic Innovations [J].Diagnostics (Basel, Switzerland), 2025, 15, (4): 456.DOI: 10.3390/diagnostics15040456.
- Priyadarshani, Muskan, Kumar, Pushpendra, Babulal, Kanojia Sindhuben , et al.Human Brain Waves Study Using EEG and Deep Learning for Emotion Recognition [J].IEEE ACCESS, 2024, 12, 101842-101850.DOI: 10.1109/ACCESS.2024.3427822.
- Ramzan, Munaza, Dawn, Suma.Fused CNN-LSTM deep learning emotion recognition model using electroencephalography signals [J].INTERNATIONAL JOURNAL OF NEUROSCIENCE, 2023, 133, (6): 587597.DOI: 10.1080/00207454.2021.1941947.
- Zhong, B., Wang, P. F., & Wang, Y. Q., et al. (2024). A review of EEG data analysis techniques based on deep learning [A survey of EEG data analysis techniques using deep learning]. Journal of Zhejiang University (Engineering Science), 58, (5): 879-890.DOI: 10.3785/j.issn.1008-973X.2024.05.001.
- Huang, Jingwei, Wang, Chuansheng, Zhao, Wanqi , et al.LTDNet-EEG: A Lightweight Network of Portable/Wearable Devices for Real-Time EEG Signal Denoising [J].IEEE TRANSACTIONS ON CONSUMER ELECTRONICS, 2024, 70, (3): 5561-5575.DOI: 10.1109/TCE.2024.3412774.
- Urigüen, J. A., & Garcia-Zapirain, B. (2015). EEG artifact removal-state-of-the-art and guidelines. Journal of neural engineering, 12(3), 031001. https: //doi.org/10.1088/1741-2560/12/3/031001
- Singh, Kamal, Singha, Nitin, Jaswal, Gaurav , et al.A Novel CNN With Sliding Window Technique for Enhanced Classification of MI-EEG Sensor Data [J].IEEE SENSORS JOURNAL, 2025, 25, (3): 4777-4786.DOI: 10.1109/JSEN.2024.3515252.
- Han, S., Mao, H., & Dally, W. J. (2015). Deep compression: Compressing deep neural networks with pruning, trained quantization and Huffman coding. arXiv.org. https: //arxiv.org/abs/1510.00149
- Sharma, Ramnivas, Meena, Hemant Kumar.Graph based novel features for detection of Alzheimer's disease using EEG signals [J].BIOMEDICAL SIGNAL PROCESSING AND CONTROL, 2025, 103, DOI: 10.1016/j.bspc.2024.107380.
- Asemi, Hanie, Farajzadeh, Nacer.Improving EEG signal-based emotion recognition using a hybrid GWO-XGBoost feature selection method [J].BIOMEDICAL SIGNAL PROCESSING AND CONTROL, 2025, 99, DOI: 10.1016/j.bspc.2024.106795.
- P.-N. Tan, Introduction to data mining. Pearson Education India, 2018.
- Junior, J. C. V. S., Brito, A. V., & Nascimento, T. P. (2015). Testing real-time embedded systems with hardware-in the-loop simulation using high level architecture. In 2015 Brazilian Symposium on Computing Systems Engineering (SBESC) (pp. 142-147). Foz do Iguacu, Brazil. https: //doi.org/10.1109/SBESC.2015.34