Virtual Simulation of a Myoelectric Prosthesis

3 downloads 0 Views 1MB Size Report
Virtual Simulation of a Myoelectric Prosthesis ... Abstract- This project consists of a virtual simulation that ..... GANONG, William (2006) Fisiología Médica. 20ª ed.
Virtual Simulation of a Myoelectric Prosthesis Wilmer J. Lobato Malaver [email protected] Msc. Sergio Salas Arriarán (advisor) [email protected] Universidad Peruana de Ciencias Aplicadas (UPC) - Facultad de Ingeniería Escuela profesional de Ingeniería Electrónica Lima - Perú

Abstract- This project consists of a virtual simulation that reproduces four (4) movements in a Myoelectric Prosthesis. The project is divided into four (4) parts: Analog S ignal Conditioning, S ignal Digitization, Digital S ignal Processing and S imulation. The goal of the Analog S ignal Conditioning is to prepare the analog signal from the muscles involved in movement (EMG signal) so that it can be digitized for further analysis. The Digitization of the EMG signal part has the task to convert the analog signal into a digital EMG signal, which will be sent to the computer for processing. The Digital S ignal Processing is the most important part of the project and consists of two main parts: The Feature Extraction and Pattern Classifier. The first one extracts the necessary and sufficient parameters of the EMG signal. The second one uses these parameters to distinguish the type of movement made by the patient. The last part of the project is the simulation, where are played in real time the contractions made by the patient using the graphical interface of a human arm. Keywords- Action potential, EM G Signal, Fourier Transform, AR M odel, LPC Coefficients, Periodogram, Power Spectral Density and Artificial Neural Network.

I. INT RODUCT ION

O

ne of the most requested products of Bioengineering are the prostheses. They replace vital parts of human body that allow us to perform various activities. That is why Bioengineering developed innovative techniques to create prostheses. Among the most used techniques is the study of the signals from the electromyography (EMG signals). Electromyography is a process which records the electrical activity in muscle using a cathode ray oscilloscope. Muscle contractions are controlled by the central nervous system, the brain controls voluntary movements and spinal cord, the involuntary movements. Brain signals travel very quickly in a spiral along the nerves to the motor unit, which is composed of a group of muscle fibers that work together and are controlled by the somatic motor neuron. When the somatic motor neuron executes an action potential, the muscle fibers contract. However, each muscle fiber is innervated by a single neuron. When muscle fibers contract

and movement is effected by this mechanism can perform basic activities as walking.

Figure 1: M otor Unit Structure

When a person loses a limb for any reason, is unable to perform his normal life, and appears a deep sense of powerlessness that impairs their self-esteem. That is why since lot of time the prostheses were built to replace the missing limb and that, somehow, will help people make their daily work. Graup and Cline were first who began with the recognition of patterns in EMG signals using temporal analysis in 1975. Later, Doershuck used the correlation techniques in 1983. In 1995, Kang used the cepstral coefficients for pattern recognition to obtain 85% rate of success. In 1999, the Department of Neuro-Engineering of NASA developed a pattern recognition using Artificial Neural Networks and Hidden Markov Models. Later in 2002, Ferguson and Dunlop used the FFT, STFT, Wavelet, Neural Networks and statistical parameters. Studies and optimization of pattern recognition algorithms continue to evolve in order to give the patient a prosthesis that works according to the real-time requirements.

II. OBJECT IVES 

Analyze and understand the characteristic shapes of EMG signal who relate to the process of muscle contraction.



Make a digital processing which takes the necessary and sufficient parameters of the EMG signal.

1





Designing a Neural Network using the parameters obtained, train the network to recognize the type of movement made by the patient with high rates of success.

V. PROJECT DEVELOPMENT As mentioned above, the project consists of four parts, as shown in the following block diagram:

Make a simulation that can be used in real time by the patient.

III. JUST IFICAT ION The human brain has the ability to couple the artificial instruments used in the human body. For example, using wearing glasses helps to correct myopia because the human brain can couple this artificial instrument. In the case of hearing something very similar happens, the hearing aids and cochlear implants are coupled by the brain to give us a hearing almost real. Using Myoelectric Prosthesis, the patient is expected to make his daily work almost perfectly normal like he could make it before the amputation.

IV. A PPLICAT IONS The aim of this project is to provide people who have lost some of their upper limbs, a form of replacement, though not a perfect one. In addition, analysis of the EMG signal can be very useful in the field of muscle rehabilitation patients. Another application can be used in areas where the human cannot stay, or is too dangerous for a person to enter. Furthermore, other application in the industry is controlling arms and general industrial machinery (food industry, construction, etc). Finally, other application is using Myoelectric control for creating games, so the user’s arm can be used for controlling the virtual reality.

Figure 3: Block Diagram of the Proyect

A.

Analog Signal Conditioning

The range of amplitudes of the EMG signal is from 100pV to 2mV, although it considerably depends on which type of muscle is selected and what kind of electrodes was used. Since the signal is very small, it is necessary to amplify it for further processing. It also contains unwanted information which must be separated by filters. On the oscilloscope was found that the EMG signal has a useful bandwidth of 3.5KHz. However, the frequency ranges of 0 to 20Hz correspond to the repolarization of the muscles involved with movement. For this reason, we design a Butterworth third order high pass filter with cutoff frequency of 20Hz to eliminate the effect of these components. It was also considered relevant to use a Low Pass Butterworth filter of third order to limit the information up to about 500Hz as only want to detect contractions, as well as avoiding possible aliasing. In addition, we designed a narrow band notch filter to eliminate 60Hz component present in the EMG signal due to electrical noise from power line. The frequency response of cascaded active filters is shown below:

Figure 2: Project Applications

Figure 4: Frequency Response of Analog Filters

Finally, when the EMG signal is ready for digitizing, we add a DC level to maintain the dynamic range of the signal between the ADC input ranges . 2

B. Digitization

C. Digital Signal Processing

We used the Pulse Code Modulation (PCM), which consists of Anti Aliasing Filter that was designed in the previous stage (Low Pass Filter), a sampler and a quantization process. However, in this case the signal encoding was not used. The EMG signal was digitized with the internal ADC from PIC48F4550 with a clock rate of 48MHz. The resolution used was 10 bits (1024 levels of quantization). Below is the flow diagram for the process of digitization.

This is the most important part of the project because we will use the techniques such as Digital Signal Processing, Artificial Intelligence and Control. In the following block diagram presented in Figure 7 is shown the process. In the previous stage, RS232 protocol was used for sending data which are stored inside Matlab archives. The EMG digital samples are in the dynamic range from 0 to 1023 so it is necessary to apply normalization from -1 to 1 to have the same reference that the Analog Signal EMG.

Figure 7: Flow Diagram of Digital Processing.

1. Digital Filtering Because the electrical noise was not completely removed despite the narrow band notch filter designed in the first stage, we use a digital filter to eliminate existing components at 60Hz and all harmonics. We use for this propose Cascade Notch Filters, as well as Comb Filters.

Figure 5: Flow Diagram of the EM G signal Digitization.

The PIC waits for a starting character to enable data transmission. The real sampling frequency is 4.7Ksps. The RS232 protocol is used for sending data to the computer. The transmission rate was configured to 115200 baud. Software was developed to capture into a buffer of 10000 bytes. When the buffer gets full the software will stop the capture. In Figure 6 the hardware blocks designed for the project are shown.

Notch Filter: An ideal Notch Filter removes a small range of frequencies without disturbing the rest of the band. To create a zero in the frequency ±w0 is placed a pair of complex conjugate zeros on the unit circle: (1) ¿FIR or IIR Notch Filter?: A filter can be of two types: FIR and IIR. The FIR filter has the advantage that it is always stable. The IIR filter can be uns table. However, the IIR filter requires a lower order to do the same as a FIR filter which significantly reduces the computational cost. In an IIR filter is placed a pair of complex conjugate poles to reduce bandwidth and introduce resonance in the vicinity of the zeros: (2) The output of an IIR filter depends on actual and past inputs and past outputs:

Figure 6: Hardware used in the Project. 3

(3) The IIR Filter Structure is shown in Figure 8:

Figure 10: FIR Comb Filter Frequency Response.

Figure 8: IIR Filter Structure. Figure 11: IIR Comb Filter Frequency Response.

The System Function for this filter (IIR type):

(4)

For this reason, we use an FIR Comb Filter because its Frequency Response is what we want. The output of the FIR Comb Filter is shown below: (7)

The Frequency Response for this filter: The System Function for this filter: (5)

(8) (6)

The Frequency Response for this filter:

In Figure 9 is shown the IIR Notch Filter Frequency Response:

(9)

2. Feature Extraction For the feature extraction of EMG signal, we explore techniques such as Fast Fourier Transform, Power Spectral Density (Periodogram) and Wavelet Packet Transform.

Figure 9: IIR Notch Filter Frequency Response.

Fast Fourier Transform: First of all, we define the DFT (Discrete Fourier Transform) as a sequence of N complex numbers according to the following formula:

We can use more than one Notch Filter in cascade t o eliminate existing components at 60Hz and some harmonics. (10)

Comb Filter: A Comb Filter is a Notch Filter in which the zeros are repeated periodically throughout the frequency band. Thus it is possible to eliminate an unwanted frequency and all harmonics.

The Fast Fourier Transform (FFT) is an efficient algorithm that computes the DFT using Weighting Factors:

¿FIR or IIR Comb Filter?: The Frequency Response of a FIR Comb Filter is completely different from an IIR Comb Filter. In Figure 10 and 11 is shown the difference.

(11) Where:

(12) 4

We decompose the Equation 11 for a 2 point DFT. This technique is called Radix-2 FFT Algorithm:

band is divided in two using Quadrature Mirror Filters (QMF).

(13) .

Where the value of the Weighting factors : (14) Finally, the resulting equations:

Figure 13: Wavelet Decomposition.

(15)

In this way, it is possible to analyze a wanted band. This technique is commonly used by the multi resolution analysis in the time and frequency domain.

The Butterfly Diagram is shown in the following figure:

Figure 12: Butterfly Diagram. Figure 14: Band Division using QM F.

Power Spectral Density (PSD): The Power Spectral Density shows how power is distributed along the signal spectrum.

(16) This equation is applied to signals of infinite duration which is not our case. However, when a signal is a stochastic process (stationary) the PSD can be estimated. In our case, we can estimate the PSD because the EMG Signal is QuasiStationary (stationary in short time intervals). To estimate the PSD, we can use the Periodogram. The Periodogram is an estimate of the PSD using a finite number of samples from the signal source. This expression will be used to study the EMG Signal in the frequency domain. The next equation shows how to calculate the Periodogram:

3. Dimensionality Reduction Of having too many patterns of EMG signal, it could be applied a dimensionality reduction of these because the pattern classifier work will be too cumbersome in their training phase if data input has too many samples . For this propose we will use the Autoregressive Model AR (LPC Coefficients). Autoregressive Model: This model is used to describe the hidden laws that are supposed to govern the generation of some data of interest. This model can be: AR, MA, ARMA. We will use the AR Model which takes x[n] as input and produce v[n] as its outputs. This model may be: AR Process Analyzer and AR Process Synthesizer. AR Process Analyzer: In the following expression is shown the difference equation of the AR Process Analyzer:

(17)

(18)

Wavelet Packet Transform (WPT): The WPT is also called Wavelet Packet Decomposition. It is a Wavelet transform where the signal is passed through two filters to decompose its bands. The process can be repeated and each stage this

The Direct Form realization of the AR Process Analyzer is shown in Figure 15:

5

A linear predictor is used to predict s[n] based on the M past samples. This linear predictor is a filter as shown in Figure 18:

Figure 15: AR Process Analyzer.

The System Function for the AR Process Analyzer: Figure 18: The prediction-error filter.

(19) AR Process Synthesizer: In the following expression is shown the difference equation of an AR Process Synthesizer:

The Levinson-Durbin Algorithm: This algorithm finds the a i vector (LPC Coefficients). However, it is necessary to know the autocorrelation of the signal s[n] and solve the normal equation for Levinson-Durbin:

(20) The Direct Form realization of the AR Process Synthesizer is shown in Figure 16:

(22) The Levinson-Durbin Algorithm is explained below in Figure 19:

Figure 16: AR Process Synthesizer.

The System Function for the AR Process Synthesizer:

(21) The Linear Prediction: The linear prediction is a system identifier where the parameters of the AR Model are estimated. In Figure 17 is shown the Linear Prediction as System Identifier.

Figure 19: The Levinson-Durbin Algorithm.

4. Patter Classifier The pattern classifier is the one that performs the task of recognizing the type of movement made by the patient using the extracted patterns. For this task, can be used Artificial Neural Networks, Fuzzy Logic, Bayesian classifier and hybrid models such as Neuro-Fuzzy Systems.

Figure 17: Linear Prediction as System Identifier.

In this project we use a Backpropagation-Feedforward Neural Network. In Equation 22 is shown the general 6

function to compute the output of an Artificial Neural Network.

The cost function (J) is determined by the mean square error. Thus, by adjusting the weights is to minimize this error by using the partial derivatives (chain rule).

(23) (26) This function is also called Activation Function and it is assigned to each layer that makes up the neural network. In Figure 20 is shown the main Activation Functions such as linear, sigmoid and hyperbolic tangent.

D.

Simulation

The simulation of virtual human arm will be carried out using the Virtual Reality Toolbox of Matlab. The 3D arm simulation will be programmed with this software. After the neural network was trained, their weights will be used to play in real time the movement (Extension, Flexion and Relaxation) using a virtual human arm. Below is shown in Figure 22. Figure 20: The main Activation Functions.

In Figure 21 is shown the model of Feedforward Artificial Neural Network using the Backpropagation method for training.

Figure 22: 3D Human Virtual Arm.

VI. RESULT S

Figure 21: The model of Feedforward Artificial Neural Network.

The input layer are the extracted parameters (LPC coefficients), the hidden layer will have a yet unknown amount of neurons. Finally, the output layer will have 3 neurons (Extension, Flexion and Relaxation). For training is necessary to adjust the weights and error. The actual error is the desired output minus actual output.

At the moment the project is focused on Digital Signal Processing. Currently, the signal is being studied to determine their patterns. After taking out all of the above, we will use the statistic to compare the rate of success of the methods used. The digital samples of the EMG signal are stored in a buffer from Matlab software. We had captured thirty (30) records per movement. In Figure 23 is shown one record per movement.

(24) To adjust the weights it is used an adjustment factor which depends of the partial derivative of cost function (J).

(25) Figure 23: EM G Signals. 7

After that, we use the Fast Fourier Transform to express the EMG Signal in the frequency domain. Below is shown this process in Figure 24.

Network. We have applied two Quadrant Mirror Filters to decompose the EMG Signal. Therefore, the record length has been divided by 4. In Figure 27 is shown the EMG Signals reduced by WPT.

Figure 24: Frequency Response. Figure 27: EM G Signals reduced by WPT.

However, the noise has high frequency components. For this reason it is necessary to apply a filter to remove these components at 60Hz and all harmonics. Below is shown the frequency response of Comb Filter used for this task:

To extract the parameters that will be introduced in Neural Network we use the LPC coefficients. Using this coefficients we can obtain the comparative graph between the EMG Signal Spectrum and the envelope provided by the LPC coefficients that have information about the peaks of the EMG Signal Spectrum.

Figure 25: Frequency Response of Comb Filter.

Below we use the comparison to check if comb filter has done its job. In Figure 26 is shown the comparison between the original and the filtered signal.

Figure 28: EM G Signal Spectrum and envelope using LPC.

Finally, in Figure 29 is shown the EMG signal Periodogram which is an estimate of the Power Spectral Density (PSD) using a finite number of samples.

Figure 26: Comparison between Original and Filtered Signal.

The record length is 3750 samples. We notice that band most important is in low frequencies. For this reason , we use the Wavelet Decomposition (WPT) to reduce the record length to produce less parameters to train the Neural

Figure 29: EM G Signal Periodogram.

8

For training were used 51 input parameters (LPC Coefficients). In the hidden layer we used 5 neurons and in the output layer were 3 (Extension, Flexion and Relaxation). The training process is shown in Figure 30. Training met the goal in 11 epochs with error 6.41415 e-6.

VIII. REFERENCE [1]

BETANCOURT, Gustavo (2004) Reconocimiento de patrones de movimiento a partir de señales electromiográficas, pp. 53-58. En: Revista Scientia et Technica, Año X, No. 26.

[2]

FARFÁN, Fernando y otros (2005) Evaluación de Patrones Temporales y Espectrales para el Control Mioeléctrico. XV Congreso Argentino de Bioingeniería.

[3]

CHU, Wai (2003) Speech Coding Algorithms: Foundation and evolution of standardized coders. New Jersey: John Wiley & Sons .

[4]

FERNÁNDEZ, Nancy (2008) Manual de laboratorio de fisiología. 4º.ed. México D.F: McGraw Hill.

[5]

GANONG, William (2006) Fisiología Médica. 20ª ed. México D.F: El Manual Moderno.

[6]

GARCÍA, Vladimir y otros (2004) Diseño de Prótesis Mioeléctrica. Instituto Politécnico Nacional (Esime): México.

[7]

ROMO, Harold y otros (2007) Análisis de Señales EMG Superficiales y su Aplicación en Control de Prótesis de Mano. Universidad del Cauca: Colombia.

[8]

SYLVERTHORN, Dee (2008) Fisiología Humana. Un enfoque integrado. 4ª ed. Buenos Aires: Editorial Médica Panamericana.

Figure 30: Training Process of Neural Network.

VII. CONCLUSION 

In biomedical projects should be avoided the use of voltage sources connected to the power line for electrical noise existing which complicates the digital processing of the EMG signal and the extraction of its parameters. It is recommended to use batteries in such projects.



The time of each tranche of signal to be analyzed must be sufficiently small to ensure adequate processing and large enough not to produce large amounts of tracks and signal delays increase as the simulation thus may in real time.



It is necessary to use digital filters to eliminate the components of 60Hz and all harmonics as unwanted frequencies that are difficult to process .



It should increase the sampling frequency which is not high enough. However, if it exceeds the Nyquist criterion.



Using Quadrature Mirror Filters (QMF) helps to eliminate aliasing in the reconstruction signal process.



We need a preliminary study of Myology to determine the muscles involved with each type of movement.

9