Machine and Deep Learning-Based Detection of Forearm Muscle Contraction Onset Using EMG
Abstract
Accurate identification of muscle contraction events plays a crucial role in the development of emerging technologies in the field of bioelectrics. In this study, a hybrid approach based on surface Electromyography (sEMG) signals and deep learning algorithms is proposed for the detection of the onset and offset of forearm muscle contractions. Muscle activity data were collected from six healthy volunteers using silver/silver chloride (Ag/AgCl) electrodes and Arduino-based signal amplification modules. Following preprocessing steps, including Butterworth filtering and noise removal, the signals were segmented into 5-second windows. Subsequently, ten time- and frequency-domain features were extracted from each window. In the next stage, data classification was performed using three algorithms: 1) a Multilayer Perceptron (MLP), 2) a Gaussian Mixture Model (GMM), and 3) a Convolutional Neural Network (CNN). The results demonstrated that the CNN classifier achieved superior performance, with an accuracy of 94.21%, compared to GMM (76.15%) and MLP (68.81%). These findings highlight the high effectiveness of deep learning–based methods in the accurate detection of muscle contraction events. The limitations of this study include the small sample size and the lack of full control over the participants’ physiological conditions. Therefore, future research is recommended to employ larger datasets and more realistic movement conditions.
Keywords:Deep learningMachine learningGaussian mixture modelMultilayer perceptronConvolutional neural
network.
1. Introduction
Electromyography (EMG) is a diagnostic technique used to measure and record the electrical activity produced by muscle cells during contraction. This method identifies and analyzes muscle electrical signals through the use of surface electrodes placed on the skin or needle electrodes inserted directly into the muscle
Among the major applications of EMG are the diagnosis of neuromuscular disorders such as myopathies, neuropathies, and diseases including Amyotrophic Lateral Sclerosis (ALS). This technology is also widely used to assess muscle function in fields such as physiotherapy and rehabilitation. Furthermore, EMG plays a significant role in biomechanical studies, sports movement analysis, control of prosthetic devices, and the development of Brain–Computer Interface (BCI) systems [1].
In general, EMG can be classified into invasive and non-invasive types. In the non-invasive approach, known as surface Electromyography (sEMG), the overall activity of superficial muscles is recorded and is primarily used for general and clinical applications. In contrast, the invasive or needle EMG method involves inserting the electrode directly into the muscle and is employed for detailed analysis of motor units [2]. Event detection is a fundamental step in intelligent biomedical engineering systems, which can be performed through the analysis of images or physiological signals such as Electrocardiogram (ECG) and Electroencephalogram (EEG) to assess an individual’s health status, including the detection of arrhythmias. In biomedical engineering, the process of automatic event recognition (event detection) involves analyzing biological data and signals, enabling early disease diagnosis, real-time patient monitoring, and the reduction of human errors [2]. Applications of event detection include diagnostic methods and signal processing, which consist of two main stages: 1) preprocessing—involving noise removal, the use of digital filters, and 2) signal transformations—and feature extraction, which focuses on identifying key signal characteristics such as amplitude, frequency, and signal morphology [3].
Other applications include the analysis of clinical features, where the detection of cardiac arrhythmias or myocardial ischemia can be achieved through the processing of brain neural activity. Additionally, sleep apnea detection through the analysis of respiratory signals represents another important application area [1], [3]. In the field of sports, event detection has been widely applied to the automatic identification of significant occurrences in sporting events by leveraging multimodal data processing, including video, audio, sensors, and metadata [2], [3].
Key applications of event detection include live broadcasting and highlight generation, player and team performance analysis, automated officiating, image processing, and machine learning. These events require high accuracy and the real-time integration of multimodal data [4]. EMG signals record the electrical activity generated by muscle cells and serve as a powerful tool for detecting both voluntary and involuntary movements. Event detection in EMG refers to the extraction of key moments from these signals [4]. Advanced applications of event detection in intelligent prosthesis control include the recognition of movement patterns and the provision of real-time responses with minimal latency [1], [4].
Other applications of this approach include muscle fatigue detection using various indices and the study of brain–computer interactions. It is also applied in the analysis of gait movements. In these areas, numerous challenges and issues arise that vary between individuals, including body fat levels, noise and interference from sampling, electrode placement, and hydration status [1]. EMG plays a key role in signal analysis for the identification of muscle synergies. These features are based on information regarding the level of muscle activation and the distribution of force among muscles. Muscle synergy refers to the coordinated activation patterns of muscle groups to perform a specific movement. This concept is applied in neuroscience and biomedical engineering to understand motor control and to inform the design of prosthetic devices [1]. Applications of amplitude-based features in muscle synergy analysis include the identification of motor control patterns, post-stroke rehabilitation, development of intelligent prostheses, robotics, sports, and ergonomics.
In this context, particular attention has been given to examining the onset and offset timing of forearm muscle contractions using EMG signals. Key factors of interest include the magnitude of each individual’s contractions, the duration of contractions, and the reaction time of each individual in response to contraction onset and offset commands [3].
2. Method
In this study, the participants consisted of six individuals (three females and three males) with a mean age of 26.5 ± 8.5 years, all of whom had no medical restrictions regarding their physical or muscular condition. The mean Body Mass Index (BMI) was 23.43 kg/m² for the female group and 27.77 kg/m² for the male group. All participants voluntarily took part in the study with full awareness of the sampling procedures.
The electrodes used in this experiment were silver/silver chloride (Ag/AgCl), and their placement was determined according to the recommendations provided by the SENIAM website. Two recording electrodes, spaced 2 cm apart, were attached to the forearm muscles, while the reference electrode was placed on the wrist bone. Data acquisition was performed using single-channel sEMG from the targeted muscles throughout all stages of contraction [5] (Fig. 1).
This figure is shown in the PDF version of the article.
To perform pre-amplification, amplification, band-pass filtering, and noise/artifact removal, SABTEL integrated amplifiers were used. This chipset was connected to the body via three pins, while the other three pins were linked to the Arduino board using three breadboard wires. Communication between the chipset and the computer was established at a rate of 115,200 bits per second. For analog-to-digital conversion, input signals from pin A0, within a frequency range of 10 to 500 Hz, were measured and transmitted to the computer via the USB port (Fig. 2).
An Arduino board was employed in this study, featuring a 10-bit analog-to-digital converter with a sampling rate of 1,000 samples per second. By connecting the Arduino to the computer and using the Arduino software, the received signals were digitized. The data were then saved in a standard matrix format Comma-Separated Values (CSV) using the Serial Oscilloscope 1 software. Additionally, to minimize noise, mains power was disconnected during data acquisition.
After recording, the matrix files were imported into MATLAB R2024a. The signals were processed using a fourth-order Butterworth band-pass filter with a passband of 20–450 Hz, along with a baseline drift removal filter. The Butterworth filter is a type of signal processing filter designed to provide a maximally flat frequency response within the passband. Being frequency-based, it effectively removes noise at specific frequencies. Moreover, the Butterworth filter can be adjusted in different orders and strengths, allowing customization of the filter to meet the specific requirements of the study.
This figure is shown in the PDF version of the article.
The electrodes feature round, circular pads coated with silver/silver chloride (Ag/AgCl) gel to ensure better contact with the skin. They are connected to the device via alligator clip terminals. Prior to electrode placement, skin preparation is essential to improve signal quality and reduce noise [6].
The data acquisition process begins with skin preparation. First, the area of the body designated for testing is shaved to remove hair. The skin surface is then thoroughly cleaned with alcohol to eliminate oils and any contaminants. Following these steps, the electrodes are placed on the skin, including one reference electrode and two recording electrodes. The data recording protocol requires each participant to perform five hand contractions at 20–100% of their maximal effort. The reference electrode is placed on the wrist bone, while the two recording electrodes are positioned on the forearm muscles.
Overall, the research workflow begins with the selection of the test subject and continues through to the classification of the extracted data. First, the device is attached to the participant’s body using electrodes, and after data acquisition, the recorded signals are processed and amplified in MATLAB using appropriate filters
This figure is shown in the PDF version of the article.
The signals are then converted from analog to digital form and stored. The next stage involves organizing and segmenting (windowing) the digital data, after which the relevant features are extracted and prepared for the classification process [7].
To optimize the data, a fourth-order Butterworth filter with a frequency band of 20–450 Hz was applied. The primary purpose of using this filter is signal refinement and baseline noise reduction. This filter is recommended for the removal of high-frequency noise, which may originate from adjacent muscle activity, respiration of the test subject, and mains power interference. The filtering process was performed according to Eq. (1).
The amplitude of respiratory noise, considered a low-frequency artifact, lies in the range of 0.1–0.5 Hz. Power-line interference occurs within the 50–60 Hz range, while high-frequency noise components are observed between 20 and 500 Hz [8].
To preserve the signal information, both high-pass and low-pass filters are employed. First, pre-filtering of the signal is performed, followed by the removal of power-line interference, and finally, high-frequency components are eliminated using a low-pass filter [8].
n ω2 0
H(S) = ∏k=1 s2+ω0s+ω2. (1)
Using this filter, the portions of the signal that lie above the baseline are leveled, such that segments exhibiting higher baseline offsets relative to other parts of the signal are adjusted. Subsequently, the filtered signals were segmented into 5-second windows with no overlap (zero overlap) at a sampling frequency of 1,000 Hz [8],
Following this stage, feature extraction was performed. A total of ten time- and frequency-domain features were extracted from the data, including mean, median, variance, Root Mean Square (RMS), Zero Crossing (ZC), Integrated Electromyography (IEMG), mean movement velocity, Mean Frequency (MNF), Median Frequency (MDF), and total power [5], [6], [9].
Mean: to compute the mean, according to the Eq. (2), all values are summed and then divided by the total number of samples (n) [5].
x1+x2+x3+⋯+xn
Average = n . (2)
Median: the median is a statistical measure that represents the central value of a dataset. It is the value that divides the sorted dataset into two equal halves, such that half of the observations are less than or equal to it and the other half are greater than or equal to it, as defined by the Eq. (3) [5].
Median = (n+1) . (3)
Variance: variance is an extractable feature from a signal and serves as a measure of signal power. It is defined as the mean of the squared deviations from the mean, as described by the Eq. (4) [8].
1 n 2
Var = n−1 ∑i=1 xi . (4)
Root mean square: RMS represents the effective value of a varying quantity, indicating the amount of energy that would be produced if the quantity were constant. It is calculated by taking the mean of the squared values and then computing the square root, as defined by the Eq. (5) [9].
RMS √2 iX∑n i=1 1. (5)
Zero crossing: a ZC occurs when a signal changes its value from positive to negative or from negative to positive. It is calculated according to the Eq. (6). ZCs indicate changes in the signal’s direction and are highly relevant in the analysis of audio, vibration, EMG, and other signals [5].
ZC = [sgn(x[n]) ≠ sgn([n − 1])] ∑N n= −1 1 . (6)
Integrated Electromyography: IEMG represents the total electrical activity of a muscle over a given time period and is obtained by summing the absolute values of the EMG signal. The calculation of IEMG is defined as Eq. (7) [5].
IEMG = ∑N i=1 |iX|. (7)
Mean movement velocity: mean movement velocity is a measure used to describe the average rate of change in an EMG signal. It is calculated based on the instantaneous differences between consecutive samples, as defined by the Eq. (8) [10].
V0 = xi ∣ ∑N i=− 11 . (8)
Mean frequency: MNF is the weighted average of the frequencies present in the power spectrum of an EMG signal, representing the center of gravity of the frequency spectrum. It is commonly used to assess muscle fatigue and is calculated according to the Eq. (9) [10].
∑N i=1 fi.P(fi)
MF = ∑N ( ) . (9)
i=1 p fi
Median frequency: MDF is the frequency that divides the power spectrum of an EMG signal into two regions with equal power. In other words, half of the total signal power lies below the MDF and half lies above it, as calculated using the Eq. (10) [9].
maxf 1 medf
p(f) ∑f=0 2 = ∑f=0 p(f) . (10)
Total power: total power of a signal represents the overall energy of the signal in the frequency domain. It is calculated by summing the power across all frequencies in the signal’s power spectrum, as defined by the Eq. (11). This feature reflects the overall intensity of the muscle’s electrical activity in the EMG signal [11].
total power = ∑N i=1 p(fi). (11)
To classify the aforementioned signals, two classifiers were employed: the Multilayer Perceptron (MLP) and the Gaussian Mixture Model (GMM). The MLP is a type of artificial neural network that includes one or more hidden layers between the input and output layers. By utilizing nonlinear activation functions and learning algorithms, this model is capable of identifying and learning complex patterns [11].
In EMG signal classification, the MLP receives the extracted features and predicts outputs such as the type of movement or the level of muscle fatigue. Due to its ability to perform nonlinear learning and adapt to complex datasets, the MLP is considered one of the most widely used classifiers in the field of bioelectrics
The GMM classifier is a statistical approach that models data as a combination of multiple Gaussian distributions. Using the Expectation-Maximization (EM) algorithm, the parameters of each Gaussian distribution are trained to achieve the best fit to the data. During classification, the probability of each sample belonging to each Gaussian component is calculated, and the sample is assigned to the class with the highest probability. GMM is particularly effective for complex and noisy datasets, such as EMG signals, and, due to its probabilistic nature, it can also model uncertainty and class overlap [4].
Another classifier used in this study is the Convolutional Neural Network (CNN). It should be noted, however, that a confusion matrix is a table that compares a model’s predicted outcomes with the true values to evaluate its performance. The matrix consists of two main classes—correct and incorrect—each of which contains two types of predictions: true or false. Model performance improves when the largest values appear along the main diagonal of the matrix (correct predictions), thereby increasing the accuracy of the model [4].
3. Results
As previously described, after data acquisition from the participants, the signals were processed using appropriate filters and subsequently classified using the selected classifiers.
According to the results presented in Table 1, the extracted data and signals were categorized into two classes: Class 1 corresponding to the resting state and Class 2 corresponding to muscle contractions (Fig. 4).
In the resting class, some noisy data were observed. Out of a total of 300 resting samples, only 3 samples contained noise. Additionally, the frequency of resting-state signals was reported to be higher compared to that of the contraction signals.
Table 1. Data classification.
This table is shown in the PDF version of the article.
Examples of the rest and contraction classes are shown in Fig. 4A. As can be seen, the contraction class (Class 2) exhibits more pronounced distortions, making it clearly distinguishable.
The confusion matrix indicates that, out of 290 resting-state samples from one participant, 262 samples were correctly classified while 28 samples were misclassified. Similarly, out of 345 contraction-class samples, 321 were correctly classified and 14 were misclassified.
Fig. 4B, plotted based on the MDF and RMS features (according to Eq. (5) and Eq. (10)), shows that most windows in Class 2 have higher amplitudes than those in Class 1. However, overall, Class 2 exhibits a lower frequency range compared to Class 1, with the frequency band for Class 2 between 100–200 Hz and Class 1
This figure is shown in the PDF version of the article.
4. Conclusion
Based on the results of this study, the use of filters combined with the MLP classifier did not yield satisfactory performance. In contrast, the CNN classifier demonstrated high accuracy, followed by the GMM classifier, which also provided relatively reliable classification results .
According to studies conducted in 2020 the results obtained using the CNN classifier are consistent with the findings of this study. These outcomes highlight the effectiveness of deep learning–based methods in signal processing. Another important factor that may explain the convergence of these two studies is the critical role of signal preprocessing and feature extraction in enhancing classification performance [12].
While the aforementioned studies focused on muscle contraction detection, other research has examined hand movements and spinal cord injuries. Additionally, it has been observed across various studies that diverse classifiers are employed.
In a study conducted in 2025, the CNN classifier demonstrated very high accuracy in differentiating hand movements. However, errors occurred in detecting the onset and offset points of contractions for certain classes, particularly when the contraction amplitude was low and close to the resting state [13]. Particularly in the 20% effort contraction class, classification errors and a reduced accuracy were observed due to the close proximity of the signal amplitude at onset to the resting state [5], [14].
One of the main limitations of this study is the small sample size, which may affect the generalizability of the results. Additionally, variations in age, gender, and physical condition of the participants could reduce the applicability of the findings to other populations [15].
Other influential factors, such as hydration level, body fat, and the psychological state of participants (including stress or fatigue), which may affect EMG signals, were not controlled in this study [12].
The study was limited to a single experimental session, and the effects of long-term factors, such as muscle fatigue or physiological changes over time, were not investigated.
Furthermore, electrode placement on the skin requires high precision, and the potential for human error during this process may affect data quality; this issue was not fully addressed in the study.
Based on the conducted research, future work could focus on optimizing filters and removing specific artifacts, particularly through the development of targeted algorithms to eliminate noise caused by respiration, adjacent muscle activity, and electromagnetic interference. Additionally, recording signals under dynamic conditions, such as multi-joint movements (e.g., lifting objects or walking) instead of isolated contractions, and the development of real-time control systems, represent promising directions for further investigation. Future studies can also leverage the results and patterns identified in this research [12], [13], [15].
Author Contributaion
Conceptualization, M.A.; Methodology, M.A. and S.M.; Software, A.A.; Validation, M.A., and Z.J.; formal analysis, S.M.; investigation, A.A, and Z.J.; resources, M.A.; data maintenance, Z.J.; writing-creating the initial design, M.A ;Writing—review & editing, B.R.A.; Visualization, A.A.; monitoring, S.M.; project management, M.A. All authors have read and agreed to the published version of the manuscript.
Funding
No funding was received for conducting this study.
Conflicts of Interest
The authors declare no conflict of interest.
References
- [1] Čuj, J., Gajdoš, M., Nechváta, P., Grus, C., Macej, M., & Kendrová, L. D. (2025). Changes in muscle activity of selected muscles during walking in high-heeled shoes on a treadmill. Physical activity review, 13(1), 14-
- [25] https://doi.org/10.16926/par.2025.13.02
- [2] Farina, D., Merletti, R., & Enoka, R. M. (2004). The extraction of neural strategies from the surface EMG. Journal of applied physiology, 96(4), 1486–1495. https://doi.org/10.1152/japplphysiol.01070.2003
- [3] Fló, E., Fraiman, D., & Sitt, J. D. (2025). Assessing brain-muscle networks during motor imagery to detect covert command-following. BMC medicine, 23(1), 1-22. https://doi.org/10.1186/s12916-025-03846-0%0A%0A
- [4] Bakirciouglu, K., & Özkurt, N. (2020). Classification of EMG signals using convolution neural network. International journal of applied mathematics electronics and computers, 8(4), 115–119. https://doi.org/10.18100/ijamec.795227
- [5] Hammach, R., Belkacem, S., Messaoudi, N., & Bekka, R. E. (2025). Deep learning classification of simulated surface EMG signals across maximum voluntary contraction levels. International journal bioautomation, 29(1), 33-50. https://doi.org/10.7546/ijba.2025.29.1.000988%0A
- [6] Holmes, T. C., Penaloza Aponte, J. D., Mickle, A. R., Nosacka, R. L., Dale, E. A., & Streeter, K. A. (2025). A simple, low-cost implant for reliable diaphragm EMG recordings in awake, behaving rats. Eneuro, 12(2), 1-
- [16] https://doi.org/10.1523/ENEURO.0444-24.2025
- [7] Khatun, Z., Kristinsdóttir, S., Thóra Thórisdóttir, A., Björk Halldórsdóttir, L., Tortorella, F., Gargiulo, P., & Helgason, T. (2025). Assessing neuromuscular system via patellar tendon reflex analysis using EMG in healthy individuals. Frontiers in neurology, 15, 1-12. https://doi.org/10.3389/fneur.2024.1522121
- [8] Lan, B., & Niu, K. (2025). Muscle activation-deformation correlation in dynamic arm movements. J: Multidisciplinary scientific journal, 8(1), 1-18. https://doi.org/10.3390/j8010005
- [9] Lanzani, V., Brambilla, C., & Scano, A. (2025). A methodological scoping review on EMG processing and synergy-based results in muscle synergy studies in Parkinson’s disease. Frontiers in bioengineering and biotechnology, 12, 1-31. https://doi.org/10.3389/fbioe.2024.1445447
- [10] Liu, S. H., Sharma, A. K., Wu, B. Y., Zhu, X., Chang, C. J., & Wang, J. J. (2025). Estimating gait parameters from sEMG signals using machine learning techniques under different power capacity of muscle. Scientific reports, 15(1), 1-15. https://doi.org/10.1038/s41598-025-95973-0%0A%0A
- [11] Harrington, J. W., Knarr, B. A., Dutt, V., & Kingston, D. C. (2025). Differences in lower limb co-contraction calculations vary clinical interpretation of aquatic treadmill walking in typically developing and children with cerebral palsy. Frontiers in neurology, 16, 1506326. https://doi.org/10.3389/fneur.2025.1506326
- [12] Benavides Álvarez, C., Rodr’iguez-Mart’inez, E., Avilés Cruz, C., Zúñiga López, A., Ferreyra Ram’irez, A., & Aguilar Sánchez, M. (2025). Improvement in the classification of EMG signals through a convolutional neural network. Neural computing and applications, 37, 1–15. https://doi.org/10.1007/s00521-025-11456-3%0A%0A
- [13] Masood, F., Sharma, M., Mand, D., Nesathurai, S., Simmons, H. A., Brunner, K., … ., & Abdullah, H. A. (2022). A novel application of deep learning (convolutional neural network) for traumatic spinal cord injury classification using automatically learned features of EMG signal. Sensors, 22(21), 1-13. https://doi.org/10.3390/s22218455
- [14] Ortega Auriol, P., Besier, T., & Mcmorland, A. J. C. (2025). Effect of surface electromyography normalisation methods over gait muscle synergies. Journal of electromyography and kinesiology, 80, 102968. https://doi.org/10.1016/j.jelekin.2024.102968
- [15] Yan, X. H., Losciale, J. M., Charlton, J. M., Mitchell, C., Hunt, M. A., & Whittaker, J. L. (2025). Explosive neuromuscular performance of the quadriceps muscles following anterior cruciate ligament reconstruction: Cross-sectional study protocol. JOSPT Methods, 1(1), 8-16. https://www.jospt.org/doi/10.2519/josptmethods.2024.0102