computers Article Implementation of an Intelligent EMG Signal Classifier Using Open-Source Hardware Nelson Cárdenas-Bolaño, Aura Polo * and Carlos Robles-Algarín Facultad de Ingeniería, Universidad del Magdalena, Santa Marta 470004, Colombia; nelsoncardenas28@gmail.com (N.C.-B.); croblesa@unimagdalena.edu.co (C.R.-A.) * Correspondence: apolol@unimagdalena.edu.co; Tel.: +57-5-4217940 Abstract: This paper presents the implementation of an intelligent real-time single-channel electromyography (EMG) signal classifier based on open-source hardware. The article shows the experimental design, analysis, and implementation of a solution to identify four muscle movements from the forearm (extension, pronation, supination, and flexion), for future applications in transradial active prostheses. An EMG signal acquisition instrument was developed, with a 20–450 Hz bandwidth and 2 kHz sampling rate. The signals were stored in a Database, as a multidimensional array, using a desktop application. Numerical and graphic analysis approaches for discriminative capacity were proposed for feature analysis and four feature sets were used to feed the classifier. Artificial Neural Networks (ANN) were implemented for time-domain EMG pattern recognition (PR). The system obtained a classification accuracy of 98.44% and response times per signal of 8.522 ms. Results suggest these methods allow us to understand, intuitively, the behavior of user information. Keywords: myoelectric prosthesis; electromyography (EMG); artificial neural networks (ANN); pattern recognition 1. Introduction Citation: Cárdenas-Bolaño, N.; Polo, A.; Robles-Algarín, C. Implementation of an Intelligent EMG Signal Classifier Using Open-Source Hardware. Computers 2023, 12, 263. https://doi.org/ 10.3390/computers12120263 Academic Editor: Hersh Sagreiya Sagreiya Received: 14 July 2023 Revised: 22 August 2023 Accepted: 25 August 2023 Published: 18 December 2023 Copyright: © 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/). Individuals with disabilities constitute one of the populations that are most affected in terms of accessing services such as education, employment, and healthcare [1]. Governments and organizations around the world are promoting policies and strategies to improve the quality of life for this population. In 2014, the World Health Organization (WHO) established action plans to support people with disabilities by strengthening rehabilitation, assistive technology, assistance and support services, and community-based rehabilitation [2]. In the matter of motor disabilities, research and development regarding assistive technology, such as active prostheses, can play an important role in reaching these aims. Surface EMG signal processing is crucial in building active prostheses that give users a more realistic experience [3]. EMG research is being used in different applications, such as in sports medicine for fatigue monitoring [4–6], education [7,8], human-machine interfaces (HMI) [9], and clinical applications like diagnosis of neuromuscular disorders, among others [10,11]. In the field of prosthetics, pioneering investigations, such as those implemented in references [12–14], explored the use of EMG signals and served as a support for many later works, among which the most notable are the Myo Armband [15], an EMG band of eight channels [16], prostheses with electro-mechanical designs based on EMG signals, and the EMG band designed by Microsoft with a wireless system based on Zigbee with six EMG channels [17]. For the classification of EMG signals, a process of the capture and subsequent extraction of features is performed, which can be represented in the domains of time, frequency, time-frequency or space [9]. Much of the recent research focuses on the development of EMG prostheses based on multi-channel acquisition or high-density measurements [9,18–20]. However, these approaches came with specific challenges: having more Computers 2023, 12, 263. https://doi.org/10.3390/computers12120263 https://www.mdpi.com/journal/computers Computers 2023, 12, 263 2 of 18 channels will result in larger datasets [21]. Additionally, they will generate more complex configurations, incur higher manufacturing costs, lead to increased energy consumption, reduced efficiency, and pose greater difficulties for users to adapt [22,23]. Due to this, the process of signal feature extraction can potentially generate numerous representations. Consequently, this could lead to a decline in the performance of the recognition system [24]. To cater to these requirements, employing analytical tools for evaluating the extracted information is the appropriate approach. Such tools assist researchers in selecting various features and channels, while also assessing the performance of the algorithms [25]. Therefore, it is necessary to know a methodological approach that allows a better understanding of features’ behavior. For this, the analysis of the features can be performed using several approaches [26]. One of these is the filter approach, which allows the creation of information quality coefficients according to their separation, correlation or consistency. In the field of EMG signals, some of these have been the Mahalanobis distance [27,28], Bhattacharyya distance [27,29], Davies–Bouldin index [28], Fisher–Markov Selector, and Minimum Redundancy Maximum Relevance [25]. The second approach is known as Wrapper, and it involves applying an evaluation criterion, a search strategy (exponential, sequential or random), and a stop criterion to discover an optimal subset of features. In the study of biomedical signals, this approach has been utilized alongside techniques like Particle Swarm Optimization [24,30], Sequential Forward Searching [28,29], and Bacterial Memetic Algorithm [31], among other methods. In line with the previously mentioned requirements and methods, this paper combines the simplicity approach with information analysis strategies to develop a real-time intelligent classifier for single-channel EMG signals, employing open-source hardware. In the context of EMG pattern recognition, time-domain signals were employed alongside a feed-forward neural network. Testing was conducted using forearm muscle signals corresponding to the movements of extension, pronation, supination, and flexion. Machine Learning (ML) techniques have several advantages in various applications, making them ideal for automating complex processes and large-scale data processing. These methods improve accuracy and efficiency in decision-making and are ideal for classification and prediction tasks [32], as they learn from data and adapt over time. Among the ML methods widely used in the literature are supervised learning, unsupervised learning, reinforcement learning, decision trees, and artificial neural networks (ANN) [33]. Therefore, in this research we implement ANN because of their usefulness for modeling linear and nonlinear systems, as confirmed by the results obtained in the consulted literature [11,13,20,34–36]. Additionally, neural networks have also demonstrated their utility in processing time series for health-related applications. The authors of reference [37] implemented an ANN for the early prediction of COVID-19 outcomes. The preliminary findings revealed that the ANN accurately predicts intensive care unit hospitalization using only five laboratory indices. Similarly, the researchers in reference [38] utilized deep learning and ANNs to predict the health of football players, obtaining simulation results that serve as the foundation for data-driven monitoring and training. Finally, signals were used in time-domain due to the low computational cost that facilitates implementation in low-performance platforms [10,13,19,39]. In this research, the implementation of the classifier on the Arduino Uno board using neural networks stands out as a significant contribution, with real-time processing supported by execution time calculations. Additionally, the developed user interface is highlighted, enabling the easy training of the ANN. This paper is structured as follows: Section 2 outlines the design of the EMG signal acquisition and conditioning device, the database creation process, the proposed analysis strategies, the design of the pattern detection system, and the hardware restrictions for real-time response. The results are detailed in Section 3. Section 4 focuses on the discussion of the experiment. Section 5 describes the conclusions of the investigation. Computers 2023, 12, x FOR PEER REVIEW Computers 2023, 12, x FOR PEER REVIEW Computers 2023, 12, 263 3 of 18 3 of 18 real-time response. The results are detailed in Section 3. Section 4 focuses on the discus3 of 18 real-time response. The results detailed in 3. Section 4 investigation. focuses on the discussion of the experiment. Sectionare 5 describes theSection conclusions of the sion of the experiment. Section 5 describes the conclusions of the investigation. 2. Materials and Methods 2.2.Materials and Methods Materials Methods Figure 1and shows the block diagram of the prototype implemented for the EMG signal Figure 1 shows the block diagram of the prototype implemented foracquisition, the signal Figure 1 shows the block of the prototype implemented for EMG the EMG sigclassifier, which is composed ofdiagram the general blocks responsible for the digiticlassifier, which is composed of the general blocks responsible for the acquisition, digitinal classifier, which is composed of the general blocks responsible for the acquisition, zation, and transmission of variables. zation, and transmission of variables. digitization, and transmission of variables. EMG conditioning EMG conditioning EMG digitalization and transmission EMG digitalization and transmission Desktop app Desktop app Database Database Figure 1. General configuration of the acquisition system. Figure General configuration the acquisitionsystem. system. Figure 1.1. General configuration ofof the acquisition 2.1. Signal Acquisition 2.1. Signal Acquisition 2.1. Signal Acquisition A prototype for the the acquisition acquisition of of EMG EMG signals signals was was designed, designed, which which is is composed composed of of A prototype for Apre-amplification, prototype for the acquisition of EMG signals was designed, whichstages is composed of2). the filtering, amplification, and DC offset summing (Figure the pre-amplification, filtering, amplification, and DC offset summing stages (Figure 2). the pre-amplification, filtering, amplification, and to DC offset summing stages (Figurehave 2). The input is is aa differential signal that is is connected connected terminals and 2. 2. The The input differential signal that to terminals 11 and The electrodes electrodes have The input is a differential signal that is connected to terminals 1 and 2. The electrodes have been placed placed across across two two different differentmuscle musclegroups. groups.Although AlthoughSENIAM SENIAM(Surface (SurfaceElectroMyoElectroMybeen been placedfor across two different Assessment muscle groups. Although SENIAM (Surface ElectroMyoGraphy the Non-Invasive of Muscles) recommendations are not strictly strictly Graphy for the Non-Invasive Assessment of Muscles) recommendations are not oGraphy for[40], the some Non-Invasive Assessment of Muscles) recommendations are not strictly followed investigations indicate that electrode placement is possible followed [40], some investigations indicate that electrode placement is possible using using more followed [40], some investigations indicate that placement is possible using moreone than one innervation zone per channel [9].electrode a single channel can contain the than innervation zone per channel [9]. Thus, aThus, single channel can contain the group more than one innervation zone per channel [9]. Thus, a single channel can contain the group muscle information sufficient for recognition pattern recognition without themodel need atoparticular model a muscle information sufficient for pattern without the need to group muscle information sufficient forwere pattern recognition without thethe need to model a particular muscle [9,41,42]. filters designed considering frequency specmuscle [9,41,42]. The filtersThe were designed considering that the that frequency spectrum of particular muscle [9,41,42]. The filters were designed considering that the frequency spectrum of EMGhas signal has the mostinpower in the of 20 to[4,43–45]. 500 Hz [4,43–45]. EMG signal the most power the range of range 20 to 500 Hz trum of EMG signal has the most power in the range of 20 to 500 Hz [4,43–45]. 1 2 1 2 Pre-amplification Pre-amplification Gain = 10 Gain = 10 IC=INA128 IC=INA128 Notch Filter Notch 60Filter Hz 60 Hz Q=6.05 Q=6.05 IC=UAF42 IC=UAF42 Sub-ckt PP4 Sub-ckt PP4 High-pass Filter High-pass Filter 20Hz 20Hz IC=UAF42 IC=UAF42 Sub-ckt PP3 Sub-ckt PP3 Low-pass Filter Low-pass Filter 450Hz 450Hz IC=UAF42 IC=UAF42 Sub-ckt PP3 Sub-ckt PP3 Amplifier Amplifier Gain = 50 Gain = 50 IC=LF353N IC=LF353N DC Adder DC Adder 2.5V 2.5V IC=LF353N IC=LF353N Figure Figure 2. 2. Block Block diagram diagram of of the the electromyograph electromyograph implemented. implemented. Figure 2. Block diagram of the electromyograph implemented. Samples were taken from the right forearm of two test subjects, using a non-invasive Samples were taken from the right forearm of two test subjects, using a non-invasive technique from electrodes in differential configuration (1 and 2) and aa non-invasive reference elecSamples were2 fromin theaa right forearm of two test subjects, technique from 2 taken electrodes differential configuration (1 and 2)using and a reference electrode (Figure 3) [5,9,46]. Electrode positions were strategically chosen based on the muscles technique from 3) 2 electrodes in a differential (1 andchosen 2) andbased a reference trode (Figure [5,9,46]. Electrode positionsconfiguration were strategically on theelecmusrelevant to the study and within areas feasible for an individual with transradial trode (Figure 3)to[5,9,46]. Electrode positions were strategically chosen with basedtransradial on theamputamuscles relevant the study and within areas feasible for an individual amtion [47]. The M foam monitoring electrodes 2228 were used. cles relevant to 3the and within areas feasible for2228 an individual putation [47]. Thestudy 3 M foam monitoring electrodes were used.with transradial amputation [47]. The 3 M foam monitoring electrodes 2228 were used. Computers 2023, 12, 263 Computers 2023, 12, x FOR PEER REVIEW 4 of 18 4 of 18 Figure 3. Position of electrodes located on the right arm of the test subjects. Figure 3. Position of electrodes located on the right arm of the test subjects. Oncethe thesignal signalwas wasacquired, acquired,the thesamples sampleswere weredigitized digitizedusing usingan anArduino ArduinoUno Uno Once board (Single.board microcontroller, Arduino LL, Torino, PIE, Italy) with a sampling rate board (Single.board microcontroller, Arduino LL, Torino, PIE, Italy) with a sampling of 2 kHz and quantization of 10-bit. Serial communication was used between the Arduino rate of 2 kHz and quantization of 10-bit. Serial communication was used between the and the and computer. Based on the on literature, it is observed that the length can have Arduino the computer. Based the literature, it is observed thatsignal the signal length can values between 50 and the sampling frequency can be 500 and 2000 have values between 50 400 and ms 400and ms and the sampling frequency canbetween be between 500 and Hz [9,28,45,48]. 2000 Hz [9,28,45,48]. 2.1.1. 2.1.1.Pre-Amplification Pre-Amplification The level ofof 1010 mV and high levels of noise from different TheEMG EMGsignal signalhas hasa amaximum maximum level mV and high levels of noise from differsources. To reduce thisthis noise andand increase thethe amplitude ofof the ent sources. To reduce noise increase amplitude thesignal, signal,the theINA128P INA128P (Instrumentation Dallas, TX, USA, EE.UU.) used, which (Instrumentationamplifier, amplifier,Texas TexasInstruments, Instruments, Dallas, TX, EE.UU.) waswas used, which has has a Common Mode Rejection Ratio (CMRR) of 120 dB. Equation (1) was used to a a Common Mode Rejection Ratio (CMRR) of 120 dB. Equation (1) was used to set aset gain gain of 10.8 (Rg = 5.1 kΩ). of 10.8 (Rg = 5.1 kΩ). 50 kΩ G = 1+ (1) 50 𝑘Ω 𝐺 = 1 Rg (1) 𝑅𝑔 2.1.2. Filters ToFilters keep only the spectrum components with more information, several studies high2.1.2. light the remove noise from the electrical network using a band-rejection filter,highand To need keep to only the spectrum components with more information, several studies that of thetopower of an EMG signal lies between the range Hz [4,39–41]. lightmost the need remove noise from the electrical network usingofa20–500 band-rejection filter, Therefore, it was decided to suppress signals below 20 Hz, above 450 Hz, and noise from and that most of the power of an EMG signal lies between the range of 20–500 Hz [4,39– the grid (60 Hz). The designs were performed with circuit 41].power Therefore, it was decided to suppress signals below 20the Hz,UAF42 above integrated 450 Hz, and noise and Filter42 software [49]. from the power grid (60 Hz). The designs were performed with the UAF42 integrated For the first stage, a 60 Hz notch filter was implemented using a UAF42 configured circuit and Filter42 software [49]. with the PP4 sub-circuit [49], using the components described in Table 1. For the first stage, a 60 Hz notch filter was implemented using a UAF42 configured with the PP4 sub-circuit [49], using the components described in Table 1. Table 1. Characteristics of the 60 Hz Notch filter. TableComponent 1. Characteristics of the 60 Hz Notch filter. Value Component Value f0 60 Hz fz 60.05 Hz Component Value Component Value Qf0 6.05Hz Gain 1.026Hz 60 fz 60.05 RF1 2.65 MΩ Rz1 2 kΩ Q 6.05 Gain 1.026 RF2 2.65 MΩ Rz2 2 kΩ R F1 2.65 MΩ R z1 2 kΩ RQ 4.99 kΩ Rz3 12.1 kΩ RF2 2.65 MΩ Rz2 2 kΩ RQ 4.99 kΩ Rz3 12.1 kΩ For the second stage, a 20 Hz high pass filter with a Butterworth response was implemented, which makes it possible to attenuate motion artifacts [4]. The filter was impleFor the asecond a 20 Hzwith highthe pass with a Butterworth implemented from UAF42stage, configured PP3filter sub-circuit [49]. Table 2 response shows thewas values of mented, which makes it possible to attenuate motion artifacts [4]. The filter was implethe components used. mented from a UAF42 configured with the PP3 sub-circuit [49]. Table 2 shows the values of the components used. Computers2023, 2023,12, 12,xxFOR FORPEER PEERREVIEW REVIEW Computers Computers 2023, 12, 263 18 55 ofof 18 5 of 18 Table2.2.Characteristics Characteristicsofofthe the20 20Hz Hzhigh highpass passfilter filterwith withButterworth Butterworthresponse. response. Table Table 2. Characteristics of the 20 Hz high pass filter with Butterworth response. Component Component Component f0f0 f0 QQ Q RF1F1 R RF1 R RF2 F2F2 Value Value Value 20.10 Hz 20.10 Hz 20.10 Hz 0.707 0.707 0.707 4.21MΩ MΩ 4.21 4.21 MΩ 4.21 MΩ 4.21 4.21 MΩ MΩ Component Component Component RRQQ R G RRQ G RG Gain Gain Gain 2A RR2A 2A Value Value Value 4.7 kΩ 4.7 kΩ 4.7 kΩ 50 kΩ 50 kΩ 50 kΩ 0.9894 0.9894 0.9894 5.49 kΩ 5.49 5.49 kΩ In thethird third stage,aa450 450 Hzlow low passfilter filter withaaButterworth Butterworth responsewas was impleIn In the the third stage, stage, a 450 Hz Hz low pass pass filter with with a Butterworth response response was impleimplemented [9,22,42]. The components used for the PP3 sub-circuit of the UAF42 can beseen seen mented [9,22,42]. The components used for the PP3 sub-circuit of the UAF42 can be mented [9,22,42]. The components used for the PP3 sub-circuit of the UAF42 can be seen in in Table 3. in Table Table 3. 3. Table3.3.Characteristics Characteristics ofthe the 450Hz Hzlow lowpass passfilter filterwith withButterworth Butterworthresponse. response. Table Table 3. Characteristics of of the 450 450 Hz low pass filter with Butterworth response. Component Component Component f0f0 f0 Q Q Q R RF1 F1F1 RRF2F2 R Value Value Value 445.8Hz Hz 445.8 445.8 Hz 0.707 0.707 0.707 357kΩ kΩ 357 357 357kΩ kΩ 357 357 kΩ Component Component Component RRQQ RQ RGG R RG Gain Gain Gain Value Value Value 47kΩ kΩ 47 47 kΩ 51 kΩ 51 51 kΩ kΩ 1 1 2.1.3.Amplification Amplification Amplification 2.1.3. Inthis thisstage, stage,the theLF353 LF353integrated integratedcircuit circuitconfigured configuredas asan aninverting invertingamplifier amplifierwas was In used. A linear potentiometer was implemented to have a variable gain between 0 and 200. A linear linear potentiometer potentiometer was was implemented implemented to to have have aa variable variable gain gain between between00and and200. 200. used. A gainof of50 50was wasused usedfor forthe theexperiments experiments(Figure (Figure4). 4). AAgain Figure4.4.Amplifier Amplifierbased basedon onthe theLF353. LF353. Figure Figure 4. Amplifier based on the LF353. 2.1.4.DC DCOffset OffsetSumming Summing 2.1.4. DC Offset Summing 2.1.4. For the digitization of the signal, the Arduino board uses an analog–digital converter Forthe thedigitization digitizationof ofthe thesignal, signal,the theArduino Arduinoboard boarduses usesan ananalog–digital analog–digitalconverter converter For from 0 to 5 V, therefore, it is necessary to add 2.5 V to the signal. Figure 5 shows the from 0 5 V, therefore, it is necessary to add 2.5 V to the signal. Figure 5 shows the circuit from 0 to 5 V, therefore, it is necessary to add 2.5 V to the signal. Figure 5 shows the circuit circuit implemented with the LF353N. In addition, adiode Zener diode was implemented for implemented withthe the LF353N. Inaddition, addition, Zenerdiode was implemented forstabilizastabilizaimplemented with LF353N. In aaZener was implemented for stabilization of the reference tionof ofthe thereference reference voltage.voltage. tion voltage. Figure5.5.Summing Summingamplifier amplifierbased basedon onthe theLF353. LF353. Figure Summing amplifier Computers 2023, 12, x FOR PEER REVIEW Computers 2023, 12, 263 Computers 2023, 12, FORPEER PEERREVIEW REVIEW Computers 2023, 12, xxFOR Computers 2023, 12, x FOR PEER REVIEW 6 of 18 of18 18 666 of of 18 6 of 18 2.2. Experimental Experimental Procedure Procedure 2.2. 2.2.Experimental ExperimentalProcedure Procedure 2.2. 2.2. Experimental Procedure The experiments were performed performed with with the the participation participation of of 22 non-amputated non-amputated subjects, subjects, The Theexperiments experimentswere wereperformed performedwith withthe theparticipation participationof of22non-amputated non-amputatedsubjects, subjects, The experiments were The experiments were performed with the participation of 2 non-amputated subjects, who previously signed an informed consent. The movements of extension, pronation, suwho previously signed an informed consent. The movements of extension, pronation, who previously signed an informed consent. The movements of extension, pronation, suwho previously previously signed an informed informed consent.6). The movements movements of of extension, extension, pronation, pronation, susuwho signed an consent. The pination, and flexion were recorded (Figure supination, and flexion were recorded (Figure 6). pination,and andflexion flexionwere wererecorded recorded(Figure (Figure6). 6). pination, pination, and flexion were recorded (Figure 6). (a) (a) (a) (a) (b) (b) (b) (b) (c) (c) (c) (c) (d) (d) (d) (d) Figure 6. Hand movements to acquire the EMG signals. (a) extension; (b) pronation; (c) supination; Figure6.6.Hand Handmovements movementsto toacquire acquirethe theEMG EMGsignals. signals.(a) (a)extension; extension;(b) (b)pronation; pronation;(c) (c)supination; supination; Figure Figure 6. acquire the (a) extension; (b) pronation; (c) supination; (d) flexion. Figure 6. Hand Hand movements movements to the EMG EMG signals. (d)flexion. flexion. (d) (d) flexion. flexion. (d) The session begins with a skin preparation procedure, involving cleansing with alcoThesession sessionbegins begins with askin skin preparation procedure, involving cleansing with alcosession begins with preparation procedure, involving cleansing with alcoThe with aaaskin preparation procedure, involving cleansing with alcohol The session begins with skin preparation procedure, involving cleansing with alcohol toThe remove moisture from the skin. A desktop application that communicates with the hol to remove moisture from the skin. A desktop application that communicates with the hol to remove remove moisture from the skin. A desktop application that communicates withthe the to remove moisture from thethe skin. AA desktop application that communicates with hol to moisture from skin. desktop application that communicates with the acquisition system was developed with MATLAB R2023a. The application is responsible acquisition system was developed with MATLAB R2023a. The application is responsible acquisition system was developed with MATLABR2023a. R2023a. The application isresponsible responsible acquisition system developed with MATLAB The application is acquisition system was developed with MATLAB R2023a. The application is responsible for managing datawas collection during a measurement session with a subject. The session for managing data collection during a measurement session with a subject. The session session for managing data collection during a measurement session with a subject. The for data collection measurement session with aa subject. The for managing data collection during measurement session with subject. among The session session wasmanaging performed by taking 160 during trials ofaasteady-state signals evenly distributed the 4 was performed by taking 160 trials of steady-state signals evenly distributed among the444 was performed by taking 160 trials of steady-state signals evenly distributed among the was performed by taking 160 trials evenly distributed among was performed bytrials taking 160 trials of of steady-state steady-state signals evenly distributed among the the 4 study classes (40 per movement class). Eachsignals movement is requested randomly and study classes (40 trials per movement class). Each movement is requested randomly and study classes (40 trials per movement class). Each movement is requested randomly and study classes (40 trials per movement class). Each movement is requested randomly and study (40 trials per movement Each movement is requested randomly and storedclasses in the database, resulting in an class). information structure that is represented in Figure storedinin inthe thedatabase, database,resulting resultingin in an information structure that isrepresented represented inFigure Figure stored an information structure that is in stored an information structure that isis represented inin Figure 7. stored inthe thedatabase, database,resulting resultinginin an information structure that represented Figure 7. 7. 7. 7. Signal length (256) Signallength length(256) (256) Signal Signal length (256) Samples by Samplesby by Samples Samples by movement Flexion movement movement Flexion movement Flexion Flexion Supination Supination Supination Supination Pronation Pronation Pronation Pronation Extension Extension Extension Extension Figure7. 7. Scheme of of database database information. information. Figure Figure7.7.Scheme Schemeof ofdatabase databaseinformation. information. Figure Scheme Figure 7. Scheme of database information. Thedata dataacquisition acquisitionwas wasperformed performedaccording accordingtoto the session presented in Figure 8, The the session presented in Figure 8, in The data data acquisition acquisition was was performed performed according according to to the the session presented in Figure Figure The session presented in 8,8, The data acquisition was performed according to the session presented in Figure 8, in which a rest period of ~1.5 interleaved with a runofof~6~6s.s.Each Eachrun runfollows followsthe thesteps steps which a rest period of ~1.5 s isssis interleaved with a run in which a rest period of ~1.5 is interleaved with a run of ~6 s. Each run follows the steps in which which aFigure rest period period of ~1.5 ~1.5 ss is is interleaved interleaved with with aa run run of of ~6 ~6 s. s. Each Each run run follows follows the the steps steps in rest of shown inaFigure 9. shown shownin inFigure Figure9.9.9. shown in shown in Figure 9. Rest Rest Rest Rest Run1 Run1 Run1 Run1 Rest Rest Rest Rest Run 2 Run22 Run Run 2 Rest Rest Rest Rest Run 160 Run160 160 Run Run 160 1.5 s 1.5ss 1.5 1.5 s 6s 6s 66 ss 1.5 s 1.5ss 1.5 1.5 s 6s 6s 66 ss 1.5 s 1.5ss 1.5 1.5 s 6s 6s 66 ss Figure 8. Outline of the sampling session. Figure8.8.8.Outline Outlineof ofthe thesampling samplingsession. session. Figure Outline of the sampling session. Figure Figure 8. Outline of the sampling session. Speech Speech Speech Speech Cue Cue Cue Cue Subject Subject Subject Feedback Subject Feedback Feedback Feedback 1.2 s 1.2ss 1.2 1.2 s 2,8 s 2,8ss 2,8 2.8 s Figure 9. Scheme of a run. Figure9.9.Scheme Schemeof of arun. run. Figure Figure 9. Scheme Scheme of of aaarun. run. Figure 9. Recording Speech Speech Speech Recording Speech Cue Recording Recording Cue Cue Cue 1s 1s 11 ss 1s 1s 11 ss Computers 2023, 12, 263 7 of 18 Speech Cue: a random instruction is presented to the test subject with the 4 possible movements (pronation, supination, flexion, and extension) through an audible signal of ~1.2 s. Subject Feedback: after the audible signal has been reproduced, the subject performs the movement, maintains it, and instructs the operator to begin the process of recording the trial. This process takes approximately ~2.8 s. Recording: the signal is recorded with a total duration of 128 milliseconds. After the acquisition of all the trials, a randomization process was performed in order to eliminate the effects of the capture order in the session. 2.3. Feature Extraction and Analysis The feature extraction of EMG signals was performed with a time-domain analysis. Features with low computational complexity, and widely used in the state of the art, were preferred [9]. Eleven features were selected: Integrated EMG (IEMG), Mean absolute value (MAV), Modified Mean Absolute Value 1 (MMAV1), Modified Mean Absolute Value 2 (MMAV2), Simple Square Integral (SSI), Variance of EMG (VAR), Root Mean Square (RMS), Waveform Length (WL) [13], Zero Crossing (ZC), Slope Signal Change (SSC), and Willison Amplitude (WAMP). The equations of each algorithm are described in reference [35]. These algorithms assume that the signal is centered at 0 and varies between positive and negative values. To evaluate the features, two methods are proposed, one graphic and one numerical, which are specified in the following sections. 2.3.1. Numerical Analysis of Discriminative Capacity An approach is presented to establish the quality of the representation provided by each feature, based on the minimum distance classification method [50], for which a class separability coefficient was proposed. Let {xi (h,k) , (i = 1, . . ., nk )} be a set of nk elements of one dimension, generated by the h feature from the xi signal, which belongs to the k class, where k = 1, . . ., K for each of the K classes and where h = 1, . . ., H for each of the H features. Based on this data, the class separability coefficient S(h) for an h feature is: S(h) = K 1 ∑ (h) (h) m 0 k =1 (h) m k − m0 , (h = 1, . . . , H ) (2) where mk (h) is the mean of the k class for an h feature to evaluate and m0 (h) is the mean of the classes for an h feature to evaluate: (h) mk (h) m0 = = nk 1 nk i =1 1 K ∑ mk ∑ xi K (h,k) (h) , (h = 1, . . . , H ) (3) , (h = 1, . . . , H ) (4) k =1 2.3.2. Graphic Analysis of Discriminative Capacity Anscombe’s Quartet [51] and Datasaurus [52], among other data sets, have shown that graphs are a fundamental element in understanding a problem. In order to have an intuitive understanding of the differentiation capacity of each feature extraction algorithm, the data resulting from the algorithms were plotted. For each feature, a chart is made, where the x-axis represents the movement, and the y-axis represents the value obtained from the feature extracted. The movements and their associated colors are presented in Figure 10. Computers2023, 2023,12, 12,263 x FOR PEER REVIEW Computers 88 of 18 of 18 Computers 2023, 12, x FOR PEER REVIEW 8 of 18 Figure 10. 10. Movements and their their associated associated colors colors for for graphical graphical analysis. analysis. Figure The to to represent thethe statistical performance of the The violin violinplot plotmethod methodwas wasused used represent statistical performance offeatures. the feaIf thereIfisthere no overlap, with these charts is possible intuit the algorithm effectiveness to tures. is no overlap, with theseit charts it is to possible to intuit the algorithm effecFigure 10. Movements and their associated for graphical analysis. provide representation on thecolors pattern recognition of one or more classes. tivenessuseful to provide useful representation on the pattern recognition of one or more classes. The violin plot method was used Configuration to represent the statistical performance of the fea2.4. EMG Pattern Recognition System 2.4. EMG Pattern Recognition System tures. If there is no overlap, with theseConfiguration charts it is possible to intuit the algorithm effecThis isisresponsible for for the the configuration theofElectromyographic PatternPattern Recogtiveness provide useful representation onconfiguration the patternof recognition one or more classes. Thistostage stage responsible the ofElectromyographic nition System. From the analysis of the features, four sets were proposed to make the Recognition System. From the analysis of the features, four sets were proposed to make classification. 2.4.classification. EMG Pattern Recognition System Configuration the Full == IEMG, MAV, MMAV2, RMS, and Thisset stage is responsible for the configuration ofVAR, the Electromyographic Pattern Full set IEMG, MAV, MMAV1, MMAV1, MMAV2, SSI, SSI, VAR, RMS,WL, WL,ZC, ZC,SSC SSC andWAMP. WAMP. Recognition System. From the analysis of the features, four sets were proposed to make Hudgins setset = =MAV, ZC, SSC and WL. Hudgins MAV, ZC, SSC and WL. the classification. Full set = IEMG, MAV, MMAV1, MMAV2, SSI, VAR, RMS, WL, ZC, SSC and WAMP. Subset1 = IEMG, SSI, RMS, WL, SSC and WAMP. Hudgins set =SSI, MAV, ZC, WL, SSC and Subset1 = IEMG, RMS, SSCWL. and WAMP. Subset2 = SSI,WL, RMS and Subset1 = IEMG, SSI, RMS, SSC andWL. WAMP. Subset2 = SSI, RMS and WL. Subset2 = SSI, RMS and WL. 2.4.1. Offline Training 2.4.1. Offline Training A three-layer feed-forward ANN, with a sigmoid activation function for their hidden three-layer feed-forward ANN, with a sigmoid activation function for their hid2.4.1.AOffline Training and output layers, was employed for machine learning classification, as depicted in Figure den and output layers, was employed machine learning classification, as depicted in A three-layer feed-forward ANN, withfor a sigmoid activation function for their hidden 11 [34]. The input layer’s size is the number of features on which the model is being trained Figure 11 [34]. The layer’s size is the number of features on which the model is and output layers, wasinput employed for machine learning classification, as depicted in Figure (11 input neurons for the Full set, 4 for of the Hudgins set, 6the formodel Subset1, and 3 for Subset2. 11 [34]. The input is the number features is being being trained (11layer’s inputsize neurons for the Full set, 4on forwhich the Hudgins set, 6 fortrained Subset1, and hidden layer consists oflayer 6 neurons, output layer has neurons, 1 correspond(11 neurons for the Full set, 4 for the and Hudgins set, 6 for Subset1, 3 forlayer Subset2. 3The forinput Subset2. The hidden consists ofthe 6 neurons, and the 4and output has 4 neuing to each movement to be classified. The model’s predicted class was determined by The hidden layer consiststoofeach 6 neurons, and theto output layer has 4 The neurons, 1 correspondrons, 1 corresponding movement be classified. model’s predicted class identifying the corresponding neuron with the highest activation. The system is auging determined to each movement to be classified. The model’s predicted classthe washighest determined by was by identifying the corresponding neuron with activation. The identifying the corresponding neuron with the highest activation. The system is augmented by the Majority Voting (MV) decision technique to avoid errors in the transient system is augmented by the Majority Voting (MV) decision technique to avoid errors in the mented by the Majority Voting The (MV)ANN decision technique to avoidusing errors MATLAB in the transient state of the signal trained offline R2023a and transient state of the[10,18,20]. signal [10,18,20]. Thewas ANN was trained offline using MATLAB R2023a state of the signal [10,18,20]. The ANN was trained offline using MATLAB R2023a and subsequently implemented on the Arduino Uno board (Single board microcontroller, Arand subsequently implemented on the Arduino Uno board (Single board microcontroller, subsequently implemented on the Arduino Uno board (Single board microcontroller, Arduino LL, Torino, PIE, Italy) [53]. Arduino LL, Torino, PIE, Italy) [53]. duino LL, Torino, PIE, Italy) [53]. Figure 11. Three-layer feed-forward ANN with n input neurons, 6 hidden neurons, and 4 output neurons for movement classification. Computers 2023, 12, 263 9 of 18 For training the classifier, the information in the database was organized in three segments: Training (60%), Validation (20%), and Test sets (20%) [54] (Table 4). Data were normalized to have a variance equal to 1 and a mean equal to 0. The averages of the features and standard deviations were estimated using only the training data. Table 4. Confusion matrix for test set data. Movement Training CrossValidation Test Totals 1. Extension 2. Pronation 3. Supination 4. Flexion Totals 24 24 24 24 96 8 8 8 8 32 8 8 8 8 32 40 40 40 40 160 In the selection of an appropriate structure for a network, an iterative trial and error process is often required. The possible suitable networks are described by parameters such as number of layers, number of neurons per layer, regularization value, number of iterations, input data, activation function, and more. Given this complexity, and the fact that the same structure can produce high error rates, this led us to propose a selection strategy based on programmed batch training. In this method, the training can be performed several times for the same structure and the performance outcomes can then be graphically represented for subsequent selection. The optimal number of neurons in the hidden layer was chosen based on the best results obtained on the validation set while also aiming to minimize hardware resource utilization. The fmincg training algorithm included an automatic adjustment of the learning rate and stopping criteria. Moreover, we fine-tuned the regularization parameter, lambda, to enhance the model’s generalization capabilities. This structure is validated through the computation of accuracy performance and FValue [55]. These metrics are widely adopted in the evaluation of classification systems [11,36]. 2.4.2. Implementation for Real-Time Processing An adjacent windowing technique was used. It is emphasized that the identification and generation of a response by the classification system must be less than the time required for the acquisition of a new signal. The following statements are defined as a necessary and sufficient condition for the proposed solution to be executed in real time [56]: 1. 2. The system must perform the acquisition of a signal while discriminating another immediately preceding it. Considering that the digitalization of 256 samples takes 29.18 ms (empirical value measured by means of an oscilloscope) and that the classification window is 128 ms, the system must classify a signal in a time less than 99.6 ms. To validate the operation, 8 random signals (2 for each class) were analyzed with the Arduino board. A comparison between the average execution time for all stages with the maximum time available was performed. It should be noted that the evaluations performed verify the execution time with EMG signals from the dataset obtained in this work (See Supplementary Material). 2.5. Desktop App and Prototype The desktop app was designed to perform the deployment of a complete experiment for each user, from the creation of the database to the hardware implementation. The application is divided into 4 functions that can be accessed from the main interface (Figure 12). 2.5. Desktop App and Prototype Computers 2023, 12, 263 The desktop app was designed to perform the deployment of a complete experiment for each user, from the creation of the database to the hardware implementation. The 10 ofap18 plication is divided into 4 functions that can be accessed from the main interface (Figure 12). Figure12. 12.(a) (a)Main Maininterface interfaceof ofthe theapplication; application;(b) (b)Interface Interfacefor forthe theanalysis analysisof offeatures; features;(c) (c)Interface Interface Figure for the creation of the database; (d) Interface for the training of the neural network. for the creation of the database; (d) Interface for the training of the neural network. CreateDatabase: Database:configures configuresthe theEMG EMGsignal signalcapture captureexperiment experimentfor foraauser. user.Generates Generates Create the database file in mat format. the database file in mat format. InformationAnalysis: Analysis: this section allows the application of the Numerical and Information this section allows the application of the Numerical and Graphic Analysis Discriminative Capacity proposed in Sections and 2.3.2. It will represent Graphic of Analysis of Discriminative Capacity proposed in2.3.1 Sections 2.3.1 and 2.3.2. It will the scores inthe descending order to inform thetoresearcher about the quality of each characteristic. represent scores in descending order inform the researcher about the quality of each ANN training: contains options to configure the artificial neural network to be trained characteristic. offlineANN (Section 2.4.1). A project options file is obtained with the trained neural networks and their training: contains to configure the artificial neural network to be performance. trained offline (Section 2.4.1). A project file is obtained with the trained neural networks Implementation: starting from the ANN project file, this stage writes a code and Real-time their performance. for Arduino thatImplementation: can then be copied and pasted into theproject sketch file, ino this file to loadwrites the project Real-time starting from the ANN stage a code with all the information thatbethe network process the signals online. for Arduino that can then copied and needs pastedtointo the sketch ino file to load the project 12, some that of the implemented forthethe application withInallFigure the information theinterfaces network needs to process signals online. are shown. FigureIn12a shows the main interface of the desktop application. Figure shows the Figure 12, some of the interfaces implemented for the application 12b are shown. Figstage responsible for the analysis of features. In Figure 12c, the interface for creating the ure 12a shows the main interface of the desktop application. Figure 12b shows the stage database is observed. Figure 12d shows the interface developed for ANN training. responsible for the analysis of features. In Figure 12c, the interface for creating the dataFinally, Figure 13 shows the prototype implemented for the EMG signal classifier. base is observed. Figure 12d shows the interface developed for ANN training. Finally, Figure 13 shows the prototype implemented for the EMG signal classifier. Computers 2023, 12, x FOR PEER REVIEW 11 of 18 Computers 2023,2023, 12, x FOR PEER REVIEW Computers 12, 263 11 of 11 18 of 18 Figure 13. Prototype implemented. Figure 13. Prototype implemented. Figure Prototype 3. 13. Results andimplemented. Discussion 3. Results and Discussion 3.1. Data 3. Results andAcquisition Discussion 3.1. Data Acquisition Before performing the integration of all the elements of the prototype, the circuits 3.1. Data Acquisition Before performing the integration of all thetested elements of the theNI prototype, the circuits designed for the acquisition of the signals were using Educational LaboraBefore performing the integration of all were the elements of the prototype, the circuits designed for the acquisition of the signals tested using the NI Educational Laboratory tory Virtual Instrumentation Suite (NI ELVIS, National Instruments, Austin, TX, EE.UU.) designed for the acquisition Suite of the(NI signals were testedInstruments, using the NI Educational LaboraVirtual ELVIS, National TX, USA, EE.UU.) and theInstrumentation NI myDAQ device (Data acquisition device, NationalAustin, Instruments, Austin, TX, tory and Virtual Instrumentation Suite (NI ELVIS, National Instruments, Austin, TX, EE.UU.) the NI myDAQ device (Data acquisition device, National Instruments, Austin, TX, EE.UU.). and EE.UU.). the NI myDAQ device (Data acquisition device, National Instruments, Austin, TX, Using a 1 Vpp test sinusoidal signal, the following results were obtained: low cutoff EE.UU.). Using a 1 Vpp test sinusoidal signal, the following results were obtained: low cutoff frequency of 21.4 Hz, high cutoff frequency of 469 Hz, and attenuation of −23.61 dB at the Using a 1 Vpp21.4 testHz, sinusoidal signal, the following results were obtained: cutoff frequency high cutoff frequency of 469 Hz, and attenuation of −low 23.61 dB at the frequencyof of 60 Hz. These results show good performance obtained with the high-pass, frequency of 21.4 Hz, high cutoffresults frequency ofgood 469 Hz, and attenuation of −23.61 dB high-pass, at the frequency of 60 Hz. These show performance obtained with the low-pass and Notch filters. frequency of 60 Hz. These results show good performance obtained with the high-pass, low-pass Notch filters. The and frequency spectrum obtained for extension and flexion movements is shown in low-pass The and frequency Notch filters. spectrum for extension and flexion movements is shown in Figure 14. As expected, these obtained signals showed low amplitude levels at frequencies below The frequency spectrum obtained for extension and flexion movements is shown in Figure As 450 expected, these signals showed low amplitude levels at frequencies below 20 Hz, 14. above Hz, and close to 60 Hz. Figure 14. As expected, 20 Hz, above 450 Hz,these and signals close toshowed 60 Hz. low amplitude levels at frequencies below 20 Hz, above 450 Hz, and close to 60 Hz. (a) (b) (b) corresponding totothe (a) Figure Figure14. 14. Frequency Frequency spectrum spectrum obtained obtained for for four four signals signals corresponding the four fourpositions positions of ofthe the database. (a) Spectrum up to 1000 Hz; (b) Spectrum up to 100 Hz. database. (a) Spectrum up to 1000 Hz; (b) Spectrum up to 100 Hz. Figure 14. Frequency spectrum obtained for four signals corresponding to the four positions of the database. (a) Spectrum up to 1000 Hz; (b) Spectrum up to 100 Hz. Computers 2023, 12, x FOR PEER REVIEW Computers 2023, 12, x FOR PEER REVIEW Computers 2023, 12, 263 12 of 18 12 of 18 12 of 18 3.2. 3.2.Numerical Numericaland andGraphic GraphicAnalysis AnalysisofofDiscriminative DiscriminativeCapacity Capacity 3.2. Numerical and Graphic Analysis of Discriminative Capacity obtained for all the features Figure 15 shows the results of the numerical analysis Figure 15 shows the results of the numerical analysis obtained for all the features Figure 15 shows thestudy results of the numerical analysis obtained MMAV1, for all the features addressed addressedin inthe thepresent present studyfor foreach eachsubject. subject.With Withthe theIEMG, IEMG,MAV, MAV, MMAV1,MMAV2, MMAV2, addressed in the present study for each subject. This Withisthe IEMG, MAV, MMAV1, MMAV2, and RMS methods, good results were obtained. the same case for and RMS methods, good results were obtained. This is the same case forthe theSSI SSIand andRMS RMS and RMS methods, good results were obtained. This is the same case for the SSI and methods. methods. RMS methods. (a) (a) (b) (b) Figure 15. Results of the numerical analysis of discriminative capacity. (a) subject 1; (b) subject 2. Figure Figure15. 15. Results Results of of the the numerical numericalanalysis analysisof ofdiscriminative discriminativecapacity. capacity.(a) (a)subject subject1;1;(b) (b)subject subject2.2. In In addition, Figure 16 shows violin plot representation of each feature extracted Inaddition, addition,Figure Figure16 16shows showsaaaviolin violinplot plotrepresentation representationof ofeach eachfeature featureextracted extracted from the the EMG EMG signals signals of of the the test test subjects, subjects,with withrespect respectto tothe thetype typeof ofmovement movementexecuted. executed. from from the EMG signals of the test subjects, with respect to the type of movement executed. The results results obtained with with four of the features are displayed. displayed. It can be be observed that that the The The resultsobtained obtained withfour four of the features are displayed.ItItcan can beobserved observed thatthe the IEMG, MAV, MAV, features have very similar distributions. The IEMG, IEMG, MAV,MMAV1, MMAV1,MMAV2, MMAV2,and andRMS RMS features have very similar distributions.The The same happens happens with the the SSI and and same same happenswith with theSSI SSI andVAR VARfeatures. features. Figure 16. 16.Graphical Graphicalrepresentation representation information distribution EMG signals of four Figure ofof thethe information distribution for for the the EMG signals of four feaFigure 16. Graphical representation of the information distribution for the EMG signals of four feafeatures: (a) IEMG; RMS; (c) SSI; VAR. tures: (a) IEMG; (b) (b) RMS; (c) SSI; (d) (d) VAR. tures: (a) IEMG; (b) RMS; (c) SSI; (d) VAR. The numerical numerical analysisshowed showed a better performance, terms in termsthe of the separability The The numericalanalysis analysis showedaabetter betterperformance, performance,in in termsof of theseparability separabilitycococoefficient, for energy-based features (IEMG,MAV, MAV,MMAV1, MMAV1,MMAV2, MMAV2,SSI, SSI,VAR, VAR,RMS, RMS, and efficient, for energy-based features (IEMG, efficient, for energy-based features (IEMG, MAV, MMAV1, MMAV2, SSI, VAR, RMS,and and WL), and and lower lower performance performance for for frequency-based frequency-basedfeatures features(WAMP, (WAMP, SSC, and and ZC), which which WL), WL), andthe lower performance forPhinyomark frequency-based features (WAMP,SSC, SSC, andZC), ZC), which matches results reported by [28]. matches the results reported by [28]. matches results byPhinyomark Phinyomark [28].16), it is worth highlighting the cases of Withthe respect to reported the graphic graphic method (Figure (Figure With respect to the method 16), it isisworth highlighting the of With respect to the graphic method (Figure 16), worth thecases cases of pronation and and supination, supination, since since all all the the features features have have anitoverlap overlap forhighlighting these movements. movements. This pronation an for these This pronationshows and supination, sincethe allsystem the features an overlap for these movements. This situation the difficulties difficulties has in inhave discriminating these signals. Flexion and and situation shows the the system has discriminating these signals. Flexion situation shows the difficulties the system has in discriminating these signals. Flexion and extension are the simplest movements to classify. Flexion can be easily differentiated from extension extensionare arethe thesimplest simplestmovements movementsto toclassify. classify.Flexion Flexioncan canbe beeasily easilydifferentiated differentiatedfrom from Computers 2023, 12, 263 13 of 18 the IEMG, SSI, and WL features, while the extension can be detected from the IEMG, WL, WAMP, SSC, and ZC features. The worst performances were presented in the SSC and ZC features, in which the flexion, pronation, and supination have a significant overlap. These observations are consistent with the measure of discriminative capacity used in this work, indicating that SSC and ZC are the features that have the lowest quality. The above suggests that the numerical method is consistent with an intuitive interpretation of the dataset information. 3.3. Classification System Tables 5–12 show the results obtained with subjects 1 and 2 for the four sets proposed in this work (Full Set, Hudgins Set, Subset1, and Subset2). Table 5. Confusion matrix for test set data (subject 1—full set). Predicted Full Set Actual Extension Pronation Supination Flexion Extension 8 0 0 0 Pronation 0 8 0 0 Supination 0 0 8 0 Flexion 0 0 0 8 Table 6. Confusion matrix for test set data (subject 1—Hudgins set). Predicted Hudgins Set Actual Extension Pronation Supination Flexion Extension 8 0 0 0 Pronation 0 8 0 0 Supination 0 0 8 0 Flexion 0 0 0 8 Table 7. Confusion matrix for test set data (subject 1—subset1). Predicted Subset1 Actual Extension Pronation Supination Flexion Extension 8 0 0 0 Pronation 0 8 0 0 Supination 0 0 8 0 Flexion 0 0 0 8 Table 8. Confusion matrix for test set data (subject 1—subset2). Predicted Subset2 Actual Extension Pronation Supination Flexion Extension 8 0 0 0 Pronation 0 8 0 0 Supination 0 0 8 0 Flexion 0 0 0 8 Table 9. Confusion matrix for test set data (subject 2—full set). Predicted Full Set Actual Extension Pronation Supination Flexion Extension 8 0 0 0 Pronation 0 8 2 0 Supination 0 0 6 0 Flexion 0 0 0 8 Computers 2023, 12, 263 14 of 18 Table 10. Confusion matrix for test set data (subject 2—Hudgins set). Predicted Hudgins Set Extension Pronation Supination Flexion Actual Extension 8 0 0 0 Pronation 0 8 2 1 Supination 0 0 6 0 Flexion 0 0 0 7 Table 11. Confusion matrix for test set data (subject 2—subset1). Predicted Subset1 Extension Pronation Supination Flexion Actual Extension 8 0 0 0 Pronation 0 8 2 1 Supination 0 0 6 0 Flexion 0 0 0 7 Table 12. Confusion matrix for test set data (subject 2—subset2). Predicted Subset2 Actual Extension Pronation Supination Flexion Extension 8 0 0 0 Pronation 0 8 1 0 Supination 0 0 7 0 Flexion 0 0 0 8 The results obtained with the performance measures for the two test subjects are shown in Tables 13–15. The confusion matrix shows that the classification system has high accuracy, although there are some difficulties with subject 2 in the detection of pronations and supinations (see Tables 9–12), which is confirmed by the values obtained for the accuracy and the F-values (Tables 13 and 14). These errors may be due to the supination signals of the test subjects having very low values for IEMG, SSI, and RMS, which are quite close to the extension and supination movements. It is worth highlighting that the best results in terms of the test data came from Subset2, which has the fewest features (see Tables 12 and 14). An accuracy of 98.44% was obtained (100% for subject 1 and 96.88% for subject 2 using Subset2), which meets the accuracy percentage greater than 90% necessary for the system to be used by a user [23]. The accuracy results are comparable with those obtained in previous research, both with single channel and multichannel [9,10,23], but these results cannot be generalized to amputated subjects [57]. Table 13. Performance measures applied to the test set (subject 1). Set Accuracy F-Extension F-Pronation F-Supination F-Flexion Full set Hudgins Set Subset1 Subset2 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 Table 14. Performance measures applied to the test set (subject 2). Set Accuracy F-Extension F-Pronation F-Supination F-Flexion Full set Hudgins Set Subset1 Subset2 0.9375 0.9063 0.9063 0.9688 1.0000 1.0000 1.0000 1.0000 0.8889 0.8421 0.8421 0.9412 0.8571 0.8571 0.8571 0.9333 1.0000 0.9333 0.9333 1.0000 Computers 2023, 12, 263 15 of 18 Table 15. Performance measures applied to the test set (subject 1 and subject 2). Subject 1 Set Training Subject 2 Cross-Validation Test Training Cross-Validation Test 1.0000 1.0000 1.0000 1.0000 0.9375 0.9063 0.9063 0.9688 Accuracy Full Set Hudgins Set Subset1 Subset2 1.0000 0.9896 0.9896 0.9896 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 0.9896 0.9896 0.9896 0.9896 3.4. Execution Time Execution times were obtained for eight EMG signals. All these signals were randomly chosen from the database, two for each class analyzed (Extension, Pronation, Supination, and Flexion) with an average time of 8.522 ms (Table 16). Table 16. Execution times of the EMG signal processor implemented in the Arduino uno board (2 signals were recorded for each class used in the study for a total of 8 signals). Signal Array Loading (ms) Feature Extraction (ms) ANN (ms) Majority Voting (ms) Total (ms) 1 2 3 4 5 6 7 8 Mean 0.372 0.372 0.372 0.372 0.372 0.372 0.372 0.372 0.372 4.460 4.464 4.460 4.476 4.460 4.460 4.428 4.448 4.457 3.652 3.664 3.696 3.680 3.668 3.676 3.668 3.712 3.677 0.016 0.016 0.015 0.016 0.017 0.016 0.016 0.015 0.016 8.500 8.516 8.543 8.544 8.517 8.524 8.484 8.547 8.522 With the processor incorporated in the Arduino Uno board, all calculations were performed with an average execution time of 8.522 ms. In this way, it was demonstrated that the system can run in real time, since an execution time much lower than the 99.6 ms limit value discussed in Section 2.4.2 was obtained. The processing capacity of a low-cost tool for the execution of a neural network and for the processing of EMG signals in real time was demonstrated. The processor was programmed to automatically copy the synaptic weights and general structure of the neural network from MATLAB R2023a. 4. Limitations and Future Works Though this study employed a 60%/20%/20% split, it is important to note that, in situations with limited data, using k-fold cross-validation is recommended for optimal evaluation with less biased or less optimistic estimates. Future research will aim to improve validation estimates using this approach. Furthermore, there is the possibility of experimenting with alternative hardware options to implement a system that is even more efficient and flexible. It is also advisable to work on datasets with a greater number of trials per subject and that have records of amputee subjects. 5. Conclusions The techniques described in this work have the potential to develop simple devices for the acquisition, conditioning, and recognition of EMG patterns in order to facilitate future implementations of prostheses. Numerical methods are a valuable tool for quickly assessing the quality of the information generated by feature extraction algorithms. Both the graphical and numerical methods proposed in this research align with previous studies and exhibit a consistent level of agreement between them. Reducing redundancy is a Computers 2023, 12, 263 16 of 18 constructive approach to enhancing generalization performance. The Arduino Uno board, being a relatively inexpensive product, has showcased adequate hardware capabilities for the development of efficient real-time systems. This work is conceived as a proof of concept, with its subsequent stage involving the creation of a more resilient database containing signals from both healthy and amputated subjects. Supplementary Materials: The following supporting information can be downloaded at: https: //github.com/nelsoncardenas/emg_dataset. Author Contributions: Formal analysis, A.P. and N.C.-B.; Investigation, A.P. and N.C.-B.; Methodology, A.P., N.C.-B. and C.R.-A.; Software, N.C.-B.; Validation, A.P. and C.R.-A.; Visualization, N.C.-B.; Writing—review and editing, A.P. and C.R.-A. All authors have read and agreed to the published version of the manuscript. Funding: This research was funded by the Fondo General de Regalías of Colombia, as part of the project titled “Desarrollo de un sistema inteligente multiparamétrico para el reconocimiento de patrones asociados a disfunciones neurocognitivas en jóvenes en conflicto con la ley en el departamento del Atlántico”, under code BPIN 20200000100006. Collaborating institutions in this project include the Institución Universitaria de Barranquilla (IUB), the Universidad del Magdalena, and the Universidad Autónoma del Caribe. Informed Consent Statement: Informed consent was obtained from all subjects involved in the study. Data Availability Statement: The data presented in this study are available in Supplementary Material. Conflicts of Interest: The authors declare no conflict of interest. References 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. Disability and Health. Available online: https://www.who.int/news-room/fact-sheets/detail/disability-and-health (accessed on 23 May 2023). WHO Global Disability Action Plan, 2014–2021. Available online: https://www.who.int/publications/i/item/who-globaldisability-action-plan-2014-2021 (accessed on 24 May 2023). Cordella, F.; Ciancio, A.L.; Sacchetti, R.; Davalli, A.; Cutti, A.G.; Guglielmelli, E.; Zollo, L. Literature review on needs of upper limb prosthesis users. Front. Neurosci. 2016, 10, 209. [CrossRef] De la Peña, S.; Polo, A.; Robles-Algarín, C. Implementation of a Portable Electromyographic Prototype for the Detection of Muscle Fatigue. Electronics 2019, 8, 619. [CrossRef] Jiménez, C.R.; Bennett, P.; García, A.O.; Cuesta Vargas, A.I. Fatigue Detection during Sit-To-Stand Test Based on Surface Electromyography and Acceleration: A Case Study. Sensors 2019, 19, 4202. [CrossRef] [PubMed] Moreno-Barriga, O.S.; Romero-Morales, C.; Becerro-de-Bengoa-Vallejo, R.; Losa-Iglesias, M.E.; Gómez-Salgado, J.; CaballeroLópez, J.; Vidal-Valverde, L.C.; López-López, D. Effects of Foot Structure Type on Core Stability in University Athletes. Life 2023, 13, 1487. [CrossRef] Polo, A.; Narvaez, P.; Robles Algarín, C. Implementation of a Cost-Effective Didactic Prototype for the Acquisition of Biomedical Signals. Electronics 2018, 7, 77. [CrossRef] Staderini, E.M.; Mugnaini, S.; Kambampati, H.; Magrini, A.; Gentili, S. Improved Multichannel Electromyograph Using Off-theShelf Components for Education and Research. Sensors 2022, 22, 3616. [CrossRef] Hakonen, M.; Piitulainen, H.; Visala, A. Current state of digital signal processing in myoelectric interfaces and related applications. Biomed. Signal Process. Control 2015, 18, 334–359. [CrossRef] Naik, G.R.; Selvan, S.E.; Nguyen, H.T. Single-channel EMG classification with ensemble-empirical-mode-decomposition-based ICA for diagnosing neuromuscular disorders. IEEE Trans. Neural Syst. Rehabil. Eng. 2015, 24, 734–743. [CrossRef] Gokgoz, E.; Subasi, A. Comparison of decision tree algorithms for EMG signal classification using DWT. Biomed. Signal Process. Control 2015, 18, 138–144. [CrossRef] Battye, C.K.; Nightingale, A.; Whillis, J. The use of myo-electric currents in the operation of prostheses. J. Bone Jt. Surg. 1955, 37, 506–510. [CrossRef] Hudgins, B.; Parker, P. A New Strategy for Multifunction Myoelectric Control. IEEE Trans. Biomed. Eng. 1993, 40, 82–94. [CrossRef] [PubMed] Childress, D.S. Myoelectric control of Powered Prostheses. IEEE Eng. Med. Biol. Mag. 1982, 1, 23–25. [CrossRef] Hassan, H.F.; Abou-Loukh, S.J.; Kasim Ibraheem, I. Teleoperated robotic arm movement using electromyography signal with wearable Myo armband. J. King Saud Univ. Eng. Sci. 2020, 32, 378–387. [CrossRef] Bebionic. Available online: https://www.ottobockus.com/prosthetics/upper-limb-prosthetics/solution-overview/bebionichand/ (accessed on 30 May 2023). Computers 2023, 12, 263 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 17 of 18 Saponas, T.S.; Tan, D.S.; Morris, D.; Turner, J.; Landay, J.A. Making muscle-computer interfaces more practical. In Proceedings of the SIGCHI Conference on Human Factors in Computing Systems, Atlanta, GA, USA, 10–15 April 2010. [CrossRef] Huang, H.; Li, T.; Bruschini, C.; Enz, C.; Koch, V.M.; Justiz, J.; Antfolk, C. EMG pattern recognition using decomposition techniques for constructing multiclass classifiers. In Proceedings of the 6th IEEE International Conference on Biomedical Robotics and Biomechatronics (BioRob), Singapore, 26–29 June 2016. [CrossRef] Samuel, O.W.; Zhou, H.; Li, X.; Wang, H.; Zhang, H.; Sangaiah, A.K.; Li, G. Pattern recognition of electromyography signals based on novel time domain features for amputees’ limb motion classification. Comput. Electr. Eng. 2018, 67, 646–655. [CrossRef] Wei, W.; Wong, Y.; Du, Y.; Hu, Y.; Kankanhalli, M.; Geng, W. A multi-stream convolutional neural network for sEMG-based gesture recognition in muscle-computer interface. Pattern Recognit. Lett. 2019, 119, 131–138. [CrossRef] Phinyomark, A.; Scheme, E. EMG Pattern Recognition in the Era of Big Data and Deep Learning. Big Data Cogn. Comput. 2018, 2, 21. [CrossRef] Mane, S.M.; Kambli, R.A.; Kazi, F.S.; Singh, N.M. Hand motion recognition from single channel surface EMG using wavelet & artificial neural network. Procedia Comput. Sci. 2015, 49, 58–65. [CrossRef] Tavakoli, M.; Benussi, C.; Lourenco, J.L. Single channel surface EMG control of advanced prosthetic hands: A simple, low cost and efficient approach. Expert Syst. Appl. 2017, 79, 322–332. [CrossRef] Too, J.; Abdullah, A.; Mohd Saad, N.; Tee, W. EMG Feature Selection and Classification Using a Pbest-Guide Binary Particle Swarm Optimization. Computation 2019, 7, 12. [CrossRef] Liu, J.; Li, X.; Li, G.; Zhou, P. EMG feature assessment for myoelectric pattern recognition and channel selection: A study with incomplete spinal cord injury. Med. Eng. Phys. 2014, 36, 975–980. [CrossRef] De Silva, A.M.; Leong, P.H.W. Grammar-Based Feature Generation for Time-Series Prediction, 2015a ed.; Springer-Verlag: Berlin/Heidelberg, Germany, 2015; pp. 13–24. Al-Angari, H.M.; Kanitz, G.; Tarantino, S.; Cipriani, C. Distance and mutual information methods for EMG feature and channel subset selection for classification of hand movements. Biomed. Signal Process. Control 2016, 27, 24–31. [CrossRef] Phinyomark, A.; Scheme, E. A feature extraction issue for myoelectric control based on wearable EMG sensors. In Proceedings of the 2018 IEEE Sensors Applications Symposium (SAS), Seoul, Republic of Korea, 12–14 March 2018. [CrossRef] Adewuyi, A.A.; Hargrove, L.J.; Kuiken, T.A. Evaluating EMG Feature and Classifier Selection for Application to Partial-Hand Prosthesis Control. Front. Neurorobotics 2016, 10, 15. [CrossRef] [PubMed] Udhaya Kumar, S.; Hannah Inbarani, H. PSO-based feature selection and neighborhood rough set-based classification for BCI multiclass motor imagery task. Neural Comput. Appl. 2016, 28, 3239–3258. [CrossRef] Zhou, D.; Fang, Y.; Ju, Z.; Liu, H. Multi-length Windowed Feature Selection for Surface EMG Based Hand Motion Recognition. In Proceedings of the International Conference on Intelligent Robotics and Applications, Newcastle, Australia, 9–11 August 2018. [CrossRef] Rahimi, I.; Gandomi, A.H.; Asteris, P.G.; Chen, F. Analysis and Prediction of COVID-19 Using SIR, SEIQR, and Machine Learning Models: Australia, Italy, and UK Cases. Information 2021, 12, 109. [CrossRef] Anbalagan, T.; Nath, M.K.; Vijayalakshmi, D.; Anbalagan, A. Analysis of various techniques for ECG signal in healthcare, past, present, and future. Biomed. Eng. Adv. 2023, 6, 100089. [CrossRef] Hagan, M.T.; Demuth, H.B.; Hudson, M.; De Jesús, O. Neural Network Design, 2nd ed.; Oklahoma State University: Stillwater, OK, USA, 2014; pp. 38–48. Chowdhury, R.; Reaz, M.; Ali, M.; Bakar, A.; Chellappan, K.; Chang, T. Surface Electromyography Signal Processing and Classification Techniques. Sensors 2013, 13, 12431–12466. [CrossRef] Gandolla, M.; Ferrante, S.; Ferrigno, G.; Baldassini, D.; Molteni, F.; Guanziroli, E.; Cotti Cottini, M.; Seneci, C.; Pedrocchi, A. Artificial neural network EMG classifier for functional hand grasp movements prediction. J. Int. Med. Res. 2017, 45, 1831–1847. [CrossRef] Asteris, P.G.; Kokoris, S.; Gavriilaki, E.; Tsoukalas, M.Z.; Houpas, P.; Paneta, M.; Koutzas, A.; Argyropoulos, T.; Alkayem, N.F.; Armaghani, D.J.; et al. Early prediction of COVID-19 outcome using artificial intelligence techniques and only five laboratory indices. Clin. Immunol. 2023, 246, 109218. [CrossRef] Alghamdi, W.Y. A novel deep learning method for predicting athletes’ health using wearable sensors and recurrent neural networks. Decis. Anal. J. 2023, 7, 100213. [CrossRef] Parajuli, N.; Sreenivasan, N.; Bifulco, P.; Cesarelli, M.; Savino, S.; Niola, V.; Esposito, D.; Hamilton, T.J.; Naik, G.R.; Gunawardana, U.; et al. Real-Time EMG Based Pattern Recognition Control for Hand Prostheses: A Review on Existing Methods, Challenges and Future Implementation. Sensors 2019, 19, 4596. [CrossRef] Seniam. Available online: http://www.seniam.org/ (accessed on 30 May 2023). Shenoy, P.; Miller, K.J.; Crawford, B.; Rao, R.P.N. Online Electromyographic Control of a Robotic Prosthesis. IEEE Trans. Biomed. Eng. 2008, 55, 1128–1135. [CrossRef] [PubMed] Simao, M.; Mendes, N.; Gibaru, O.; Neto, P. A Review on Electromyography Decoding and Pattern Recognition for HumanMachine Interaction. IEEE Access 2019, 7, 39564–39582. [CrossRef] Lajante, M.M.P.; Droulers, O.; Amarantini, D. How reliable are “state-of-the-art” facial EMG processing methods? Guidelines for improving the assessment of emotional valence in advertising research. J. Advert. Res. 2017, 57, 28–37. [CrossRef] Computers 2023, 12, 263 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 18 of 18 Ehrmann, G.; Blachowicz, T.; Homburg, S.V.; Ehrmann, A. Measuring Biosignals with Single Circuit Boards. Bioengineering 2022, 9, 84. [CrossRef] [PubMed] Miften, F.S.; Diykh, M.; Abdulla, S.; Siuly, S.; Green, J.H.; Deo, R.C. A new framework for classification of multi-category hand grasps using EMG signals. Artif. Intell. Med. 2021, 112, 102005. [CrossRef] Fang, Y.; Hettiarachchi, N.; Zhou, D.; Liu, H. Multi-modal sensing techniques for interfacing hand prostheses: A Review. IEEE Sens. J. 2015, 15, 6065–6076. [CrossRef] Farina, D.; Jiang, N.; Rehbaum, H.; Holobar, A.; Graimann, B.; Dietl, H.; Aszmann, O.C. The extraction of neural information from the surface EMG for the control of upper-limb prostheses: Emerging avenues and challenges. IEEE Trans. Neural Syst. Rehabil. Eng. 2014, 22, 797–809. [CrossRef] Kaur, A.; Kumar, A. SEMG based classification using wavelet function for around shoulder muscles. J. Eng. Sci. Technol. Rev. 2017, 10, 109–114. [CrossRef] Filter Design Program for the UAF42. Available online: https://www.ti.com/lit/pdf/sbfa002 (accessed on 29 May 2023). Wang, R. Introduction to Orthogonal Transforms with Applications in Data Processing and Analysis, 1st ed.; Cambridge University Press: Cambridge, UK, 2012; pp. 450–470. Parish, C.M.; Edmondson, P.D. Data visualization heuristics for the physical sciences. Mater. Des. 2019, 179, 107868. [CrossRef] Matejka, J.; Fitzmaurice, G. Same Stats, Different Graphs: Generating Datasets with Varied Appearance and Identical Statistics through Simulated Annealing. In Proceedings of the 2017 CHI Conference on Human Factors in Computing Systems, Denver, CO, USA, 6–11 May 2017. [CrossRef] Setiawan, J.; Ariyanto, M.; Nugroho, S.; Munadi, M.; Ismail, R. A Soft Exoskeleton Glove Incorporating Motor-Tendon Actuator for Hand Movements Assistance. IREACO 2020, 13, 1–11. [CrossRef] James, G.; Witten, D.; Hastie, T.; Tibshirani, R. An Introduction to Statistical Learning, 1st ed.; Springer: Berlin/Heidelberg, Germany, 2013; pp. 127–168. Labatut, V.; Cherifi, H. Accuracy measures for the comparison of classifiers. In Proceedings of the 5th International Conference on Information Technology, Amman, Jordan, 11 May 2011. Kuo, S.M.; Lee, B.H.; Tian, W. Real-Time Digital Signal Processing: Fundamentals, Implementations and Applications, 3rd ed.; Wiley: Hoboken, NJ, USA, 2013; pp. 1–42. Kumar, D.K.; Jelfs, B.; Sui, X.; Arjunan, S.P. Prosthetic hand control: A multidisciplinary review to identify strengths, shortcomings, and the future. Biomed. Signal Process. Control 2019, 53, 101588. [CrossRef] Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.