Embedded system for upper-limb exoskeleton based on electromyography control

A major problem in an exoskeleton based on electromyography (EMG) control with pattern recognition-based is the need for more time to train and to calibrate the system in order able to adapt for different subjects and variable. Unfortunately, the implementation of the joint prediction on an embedded system for the exoskeleton based on the EMG control with non-pattern recognition-based is very rare. Therefore, this study presents an implementation of elbow-joint angle prediction on an embedded system to control an upper limb exoskeleton based on the EMG signal. The architecture of the system consisted of a bio-amplifier, an embedded ARMSTM32F429 microcontroller, and an exoskeleton unit driven by a servo motor. The elbow joint angle was predicted based on the EMG signal that is generated from biceps. The predicted angle was obtained by extracting the EMG signal using a zero-crossing feature and filtering the EMG feature using a Butterworth low pass filter. This study found that the range of root mean square error and correlation coefficients are 8°-16° and 0.94-0.99, respectively which suggest that the predicted angle is close to the desired angle and there is a high relationship between the predicted angle and the desired angle.


Introduction
Electromyography (EMG) signal is widely used in the development of devices based on EMG control such as exoskeletons, prosthetics, and teleoperation. An exoskeleton can be used as an assistive or rehabilitative device to help humans to have a better life [1][2][3][4]. The devices based on EMG control are classified into two categories: pattern recognition and non-pattern recognition based [1]. In the first category, the control signal is discriminated based on the patterns that had been trained to the classifier. In the second category, the control signal is directly based on amplitude of the signal by human intention. In the non-pattern recognition method, commonly, the signal is pre-processed using time-domain feature extraction and post-processed using a digital filter [5]. Previous studies were more concerned in developing joint angle prediction by exploring the features extraction, and modifying the classifier [6][7][8][9]. Currently, some studies preferred using a standard computer to control an exoskeleton based on the EMG signal. Unfortunately, researchers rarely implemented a joint-angle prediction algorithm, based on pattern recognition and non-pattern recognition method, in the embedded system.
Zhang used a neural machine for an artificial leg using a field-programmable gate array (FPGA) for faster classifier and a microcontroller unit (MCU) for analog interface [10,11]. The performance of the classifier is faster than the implementation in the standard computer with a high-level programming language, but the power consumption needs to be minimized and built into small packages. Kim developed a finger-rehabilitation robot, a non-pattern recognition based, using two digital signal processors TMS320F2812 for high-speed control system [12]. In his study, the finger-rehabilitation robot moved according to the patient's fingers when the EMG signal exceeded a pre-defined threshold voltage. In future research, he suggested testing the developed finger robot to rehabilitate a stroke patient's fingers and patient's paralyzed fingers. Lenzi developed a power-assisted upper limb exoskeleton using a non-pattern recognition based on the EMG with a proportional control [8]. This proportional algorithm is processed using integrated EMG (IEMG) as feature extraction, and then the feature was filtered using a bandpass filter (BPF) with a specified cut-off frequency. In his study, he used a standard computer to implement the method. Although the system has been reported as a robust and straightforward method, the accuracy of the prediction has not been evaluated yet. Generally, the prediction algorithm was implemented using a software application such as MATLAB and other visual programming applications using a standard personal computer. It was rare to find in the literature that discussed the implementation of the elbow-joint angle prediction on an embedded system. Therefore, it is necessary to implement the joint angle prediction algorithm in the embedded system to reduce the size of the system, to minimize the power consumption and to achieve a real-time system. This study presents a real-time myoelectric control with a non-pattern recognition method for an upper limb exoskeleton using a low-cost embedded microcontroller ARMSTM32F429. This microcontroller has low power consumption and a high-speed clock processor. The contribution of this study is that the algorithm implemented in the microcontroller system can adapt to some variable such as new subject and speed of movement without a learning process. In this proposed method, to adapt with a new variable, the system only needs an adjustment on the threshold value of the feature and gain in the bio-amplifier module. Finally, the performance of the prediction was evaluated using root mean square error (RMSE) and Pearson's correlation coefficient (r).

Material and Method 2.1. System Architecture
The system architecture for the exoskeleton based on the electromyography control is shown in Figure 1. The system consists of four modules: a bio-amplifier, an MCU, a servo motor driver and controller, and an exoskeleton unit with one degree of freedom (DOF). Bio-amplifier module: The bio-amplifier consists of an AD620 pre-amplifier, bandpass filter (BPF), 50 Hz notch filter, main amplifier, and summing amplifier. We used a potentiometer sensor to read the real position of the elbow joint. MCU module: The MCU was used to acquire the data from the EMG and the potentiometer sensor. It was also used to implement the algorithm of digital signal processing (DSP). Servo motor driver module: This module was used to control whether the servomotor rotates in a clockwise (CW) or counterclockwise (CCW) direction or not. Exoskeleton: the exoskeleton consists of three aluminum beams. The exoskeleton has two joints, the elbow, and shoulder. The servo motor was placed in the elbow joint position for one DOF motion. Figure 2 (a) shows a picture of a manufactured EMG amplifier and ARM STM32 microcontroller system. The amplifier board can receive four EMG signals and one analog input in the range of 0-3V. The outputs of the bio-amplifier were interfaced to A/D (analog to digital converter) of a Discovery board ARMSTM32F429.

Experimental Protocol
Four healthy male subjects were involved in this study. Before performing the experiment, subjects were given an inform consent to be read and signed. This experimental protocol had been approved by the Ethics Committee of Health Polytechnic of Surabaya, Ministry of Health Indonesia. In the data collecting process, the subjects were in a stand-up position and held an exoskeleton frame. The EMG signal was collected from biceps with a bipolar configuration using two disposable electrodes (Ag/AgCl, size: 57x48 mm, Ambu, Blue Sensor R, Malaysia) and one electrode as common ground (Figure 2 (b)). The electrodes placement was in accordance with SENIAM (Surface Electromyography for the Non-Invasive Assessment of Muscle) rules [13]. Biceps and triceps are responsible for the flexion and extension movement respectively as described in the literature [14]. However, in the sagittal plane motion, Lenzi proved that the EMG signal generated from triceps showed insignificant activities [8]. Therefore, in this work, the movement of the exoskeleton was only controlled by biceps.

Zero-crossing Feature
Zero crossing counts a number of the time of the signals that crosses pre-defined threshold amplitude. The zero-crossing is formulated as shown in (1) [15]: where xi indicates the i-th EMG signals, N indicates the number of samples in each segment, and the threshold indicates the level of amplitude. The EMG signals were extracted for each of a number of the sample points to get a feature [16] as shown in Figure 3.

Infinite Impulse Response
Infinite impulse response (IIR) is a digital filter implemented using a programming language with a particular algorithm. The IIR is a recursive filter [17]. In this study, the IIR filter was designed as the second-order low-pass Butterworth filter (LPF). Previous researchers used a digital filter for EMG signal processing [18][19][20]. The transfer function of the digital filter is expressed in (2). The linear function is shown in (3) [17].
where bk and ak are the (M +1) numerator and N denominator coefficient, respectively.

System Implementation
The prediction algorithm of the elbow joint angle was implemented in the embedded system ARM STM32F429 microcontroller with an internal clock speed of 180 MHz. The prediction algorithm consists of the zero-crossing feature and low pass Butterworth filter. The algorithm of the zero-crossing feature was implemented as shown in Algorithm 1 which is according to (1). Some parameters such as a number of sample point N and the ZC feature threshold need to be initialized with a specific value. The zero-crossing algorithm received input data from the EMG signals EMGk and resulted in an output named EMGZC. The output of the feature extraction was used as an input of the Butterworth low-pass filter.
Algorithm 2: The algorithm of the low-pass Butterworth filter Algorithm 2 is the implementation of the infinite impulse response filter in the low pass Butterworth filter by (3). The coefficients of the infinite impulse response filter were calculated using a MATLAB program (Student Version, MathWorks Inc., Massachusetts, USA). Algorithm 2 describes the second-order of a Butterworth low pass filter. This algorithm received input from the result of the feature extraction EMGZC and resulted in output as EMGZC_LPF. The output of the Butterworth low-pass filter represents a predicted angle of the elbow joint. The algorithm of the zero-crossing feature and the low pass Butterworth filter were coded and compiled in the C programming language, using the CooCox-CoIDE (Version 1.77, Embest Technology Co., Ltd., Wuhan University of Technology, China).

Timing Control Management
The MCU peripheral was controlled using Timer 5 and Timer 2 as shown in Figure 4 (a). Timer 2 was used to manage the sampling rate of the analog to digital converter (ADC). Timer 3 was used to generate a pulse width modulation (PWM). Timer 1 and Timer 4 were not used in this study. The PWM register was updated every millisecond using Timer 5 interrupts. The results of the prediction algorithm (EMGZC-LPF) were used to update the PWM register so that the duty cycle (DC) of the PWM fit the position of the elbow joint. Communication among the peripheral used direct memory access (DMA) to get real-time data processing. USART was used to send the ADC results to the computer for an offline data analysis. Figure 4 (b) describes the processing time for the elbow joint angle prediction. The processing time of the prediction algorithm consists of time to buffer a number of samples point according to windows length tw, time to process the feature extraction tFE and time to process the low pass Butterworth filter tLPF. In this paper, a number of samples and the order of the Butterworth digital filter were varied to get the optimum performance. The EMG signals have a frequency range of 20-500 Hz [21]. In this study, the EMG was recorded using ADC, with a 2,000 Hz sampling rate, which is according to the Nyquist requirement [17]. Another study used a sampling frequency of 2048 Hz to collect the EMG signal [22]. The EMG signals were extracted with varying window lengths, from 100 to 200 samples (50 msec to 100 msec for a 2,000 Hz sampling rate). Li selected a 100 samples window to implement a real-time control in upper limb exoskeleton [7]. Edward used a window length of 248 msec to estimate the EMG amplitude [22]. Oskoei explored a window length between 50 to 500 msec to get better performance of the classifier [23]. Triwiyanto et al. studied that the performance of the prediction was affected by window length [24]. The order of the Butterworth filter was varied from two to eight orders to find an optimum order of the filter.

Servo Motor Control
The EMG signal was extracted using zero-crossing feature extraction, and then it was smoothened using the low pass Butterworth filter. The output of the low pass Butterworth filter was called EMGZC_LPF. The servo motor was controlled by pulse-width modulation (PWM) with a particular duty cycle (DC), as shown in Figure 5. The duty cycle range of the PWM was based on the EMGZC_LPF value. The DC was calibrated so that the exoskeleton's range of the motion is from 0 o to 150 o .  8.4). The predicted angle was obtained after the feature extraction and low-pass filter process. The performance of the elbow joint angle prediction was evaluated using a Pearson's correlation coefficient (CC), and root mean square error (RMSE). The CC and RMSE were calculated using (4) and (5), respectively [6,25]: where xn is the measured angle, yn is the predicted angle, and N is the number of the samples point. The CC and RMSE were often used by previous researchers [7,9,26,27] to evaluate the performance of the prediction. The CC and RMSE values were calculated using Lazarus programming. The proposed method was tested with three periods of motion (12 sec, 8 sec and 6 sec) to see the consistency of the method. In this study, the p-values were used to examine whether there were any significant differences between the periods of the motion or not. The biceps were used to predict the elbow joint angle. In this study, the range of the movement of the elbow joint angle was from 0 o -150 o .

Results and Discussion
The elbow joint angle prediction was implemented in the embedded system using an ARMSTM32F429 microcontroller. The prediction algorithm could control the exoskeleton smoothly according to the human elbow joint. The proposed method can perform in real-time with the processing time of 100.398 msec (the number of the sample points are 200 with the second-order of the Butterworth low-pass filter). The prediction algorithm of the elbow joint angle works well for the three periods of motion (p-values > 0.05). In this experiment, the processing time for feature extraction is 64 µs. Lin reported the processing time was 5 msec using an embedded Freescale microcontroller (MPC5566) [28]. In this proposed method, the time of the embedded system to process the prediction which consists of the feature extraction and the digital filter of the second order is 100.39 msec. Tang reported that the time to process the prediction algorithm consists of the feature extraction and classifier using a standard computer was 250 msec [26]. Figure 6 (a) shows the processing time for single feature extraction. The processing time of the feature extraction was tested for several numbers of the sample points (N = 100, N = 150, and N = 200). The processing time of the low pass Butterworth filter was also measured in several orders (2 nd , 4 th and 8 th order), as shown in Figure 6

Evaluation of the Prediction Algorithm
The EMG signals respond to the change of the elbow joint angle, as shown in Figure 7 (a), with varying and random amplitudes (0 to 3 mV peak to peak) [21]. In this study, the performance of the proposed method was evaluated using the three different periods of motion. The period of the movement was synchronized using the Metronome (Microsoft Windows application). The periods used in this work were 12s, 8s, and 6s. The mean correlation coefficient for the three of different periods (12s, 8s, and 6s) shows a high correlation, which is 0.968±0.012, 0.979± 0.006 and 0.985±0.003 respectively, as shown in Figure 8(a). The accuracy (RMSE) of the prediction algorithm is shown in Figure 8 As shown in Table 1, the p-values of the CC for the motion periods of 12s, 8s, and 6s are 0.250, 0.762 and 0.669, respectively which the p-values are higher than the alpha value (0.05). The p-values of the RMSE for the periods of the motion 12s, 8s, and 6s are 0.7635, 0.301 and 0.847, respectively in which the p-values show higher values than the alpha (0.05) suggest that there are no significant differences between the periods of the motion. Figure 9 shows the effect of the order of the low pass Butterworth filter to the RMSE value. In this experiment, the low pass Butterworth filter was varied from the first to sixth-order to obtain the lowest RMSE. The response of the RMSE to the filter order is not a linear function.
The comparison between the predicted and measured angle for different filter order is shown in Figure 10. When the filter order is too low, it affects the output of the expected angle with a ripple noise (Figure 10 (a)). When the filter order is too high, the predicted angle will shift to the right (Figure 10 (c)). It shows that the order of the filter affects the performance of the prediction because of the lag time of the filter. Since a higher-order of the filter causes more delay time to process the signal. In this experiment, we found that the lowest RMSE is in the 3 rd order filter. The zero-crossing feature is also very essential in this proposed method.
A threshold voltage of the zero-crossing feature, as written in (1), is very important to determine an optimum predicted angle. As shown in Figure 11, the lowest RMSE value is 6.14 o when the threshold value is 0.09 mV. In this study, the exoskeleton based on electromyography control is able to adapt for different subject and variable by adjusting the feature threshold and gain in the bio-amplifier. Lenzi reported similar results in the development of the exoskeleton based on myoelectric control, which the finding shows that it was easy to implement and did not need a calibration [8]. This is contrary when the system uses a pattern recognition method which requires a training step so that the system can adapt to the prediction algorithm for different subjects, as mentioned by previous researchers [7,26,29].

Conclusion
In this study, a real-time prediction on the elbow joint angles based on myoelectric control is implemented in an embedded system using an ARMSTM32F429 microcontroller to control the exoskeleton. In accordance with the experiment, a biceps can be used to control the exoskeleton smoothly according to the elbow joint angle. The prediction algorithm consists of the zero-crossing feature extraction and the second-order consists of the low pass Butterworth filter which plays as the smoothening function. The novelty of the proposed method here is a simple algorithm to predict the elbow joint angle using the zero-crossing feature extraction and the low pass Butterworth filter. This algorithm is categorized as a non-pattern recognition method. Therefore, we do not need a learning stage to train the system since the EMG signals are extensively recognized as a non-stationary signal and random which the characteristics depend on the subjects. Thus, the proposed method can be adapted simply by adjusting the threshold voltage in the zero-crossing feature and the amplifier gain.
In the next work, an auto-tuning of the threshold voltage in the zero-crossing algorithm will be developed so that the system can adapt automatically when the subject is changed. This work can also be implemented for other studies in similar areas such as for prosthetic devices and exoskeleton-based myoelectric control for rehabilitation purpose. In this study, a real-time prediction on the elbow joint angles based on myoelectric control is implemented in an embedded system using an ARMSTM32F429 microcontroller to control the exoskeleton. In accordance with the experiment, a biceps alone can be used to control the exoskeleton smoothly according to the elbow joint angle. The prediction algorithm consists of the zero-crossing feature extraction and the second-order consists of the low pass Butterworth filter which plays as the smoothening function.