Research Article

An EEG Emotion Recognition System Based on the STM32 Microcontroller

Chong Chen1,*, Ziyi Zhu2, Yongcheng He3, Wen Xu4
1. Department of Electronic Information, Leeds Joint School, Southwest Jiaotong University, Chengdu 610031, China
2. School of Electronic Information Engineering, Suzhou Institute of Technology, Suzhou 215009, China
3. Department of Life Science and Technology, College of Life Science and Technology, Beijing University of Chemical Technology, Beijing 100029, China
4. International High School, Shenzhen University Normal College, Shenzhen 518060, China

* Corresponding author: [email protected]

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.

Keywords: Mental health monitoring; EEG emotion recognition; STM32 microcontroller; Convolutional Neural Network (CNN); Edge computing; Model optimization; Real-time processing; Wearable devices; Embedded deep learning; Depression detection.
Published: July 4, 2025
DOI: 10.54254/2755-2721/2025.PO24523
Volume: ACE Vol.157
pp. 254-260
Download PDF

References

  1. 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.
  2. 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.
  3. 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
  4. 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.
  5. 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.
  6. 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.
  7. 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.
  8. 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.
  9. 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.
  10. 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
  11. 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.
  12. 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
  13. 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.
  14. 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.
  15. P.-N. Tan, Introduction to data mining. Pearson Education India, 2018.
  16. 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