The Design of EMG Measurement System for Arm Strength Training Machine

,


Introduction
An arm strength training machine (ASTM) based on an embedded microcontroller system that utilizes a PMSM motor drive to simulate the stack of iron weights has better performance than that of the conventional exercise apparatus presented in [1].Several studies indicate that chronic stroke patients who gained maximal functional benefits from the biofeedback intervention initially had greater active range of motion at all major upper extremity joints [2][3][4].Another study to investigate neuromuscular electrical stimulation initiated by a surface electromyographic biofeedback threshold on knee extension active range of motion (AROM), function, and torque in patients with postoperative arthroscopic knee surgery has been addressed in [5].It concludes that the usage of surface EMG-triggered neuromuscular electrical stimulation can improve the extension AROM.Consequently, the proper utilization of electromyographic biofeedback can lead to substantial improvements among selected chronic stroke patients and can be of considerable functional benefits to others [6,7].Therefore, the usage of EMG not only can help the physical therapy but also can achieve more effective rehabilitation [8,9].Conventional exercise apparatus typically couple a stack of iron weights through a series of pulleys and levels to hand grips [10].The stack of iron weights are usually mounted on guide rods for vertical reciprocal movement from a rest position upwardly against gravity force to an upper position.Lifting weights is accomplished by the user who actuates a bar or another device operably connected to the weights.To vary the force opposing the user, the user is required to change the position of mechanical locking pin and physically add or remove weights from the stack.This results in time consumption and inconvenience when user changes the exercise force level between lifts.These are drawbacks for such an exercise apparatus [11,12].To solve this problem, a closed-loop motor control system that can generate a user opposition force and more particularly simulate a weight stack is presented in [13].Therefore, in order to obtain more effective rehabilitation when manipulating the arm strength training machine (ASTM), an EMG system incorporated with the original functions is designed and implemented in this paper.The EMG measurement mechanism consists of the EMG electrodes: the EMG amplification circuits and the band-pass filter [14,15].In order to obtain a "clean" signal that is without DC offset and high frequency noise, the output signal from the instrumentation amplifier is filtered by a band-pass filter which is formed by a high-pass filter cascaded with a low-pass filter.The clean signal is then rectified to DC value by using the rectifier circuit.The rectified signal is fed into the microcontroller.Accordingly, the signal can be used to display the contraction of muscle group when the user manipulates the ASTM [16].A PMSM (Permanent Magnet Synchronous Motor) drive controlling system based on the microcontroller is also developed in this paper to generate a torque to oppose the user force [17,18].The hardware circuits of the PMSM drive, such as AC/DC rectifier, DC link, DC/AC inverter, EMG sensors, physiological amplifier, high-pass filter, lowpass filter, Hall-effect position sensors, and speed encoder, are well designed, simulated, and implemented.The software programs are written in C language and programmed based on the MPLAB integrated development environment (IDE) tool by Microchip technology Inc.The PMSM motor drive is used to simulate the weight stack that is usually employed to the conventional exercise machines.Thus, the principle of EMG measurement system is firstly derived and described in Section 2. Later, the system hardware and software are designed and realized in subsequent Section 3. Section 4 will present the experimental results of ASTM and EMG measurement system for system verification.Finally, an arm strength training machine with electromyographic EMG measurement system is realized and demonstrated in the Conclusions.The Experimental Results show the feasibility and fidelity of the complete designed system.

The EMG Measurement System of ASTM
The system hardware of an arm strength machine with EMG measurement system based on PMSM motor drive is shown in Figure 1.It consists of a dsPIC30F4011 microcontroller, EMG measurement system, protection circuit, optical coupling isolation, inverter, current sensor, encoder, and communication interface.The PMSM motor drive is used to simulate the weight stack that is usually employed to the conventional exercise machines.The microcontroller dsPIC30F4011 manufactured by Microchip technology Inc. is the core controller of the ASTM.It is a 16-bit CPU with the capability of digital signal processing.Moreover, it supports many powerful modules such as built-in PWM module, addressable encoder interface module, and input capture module.This makes the design easily complete and thus it shortens the development schedule.The independent power source is employed to supply the gate of MOSFETs.The photocoupler TLP250 is used for electrical isolation between the microcontroller system and the high DC voltage bus voltage as well as the independent power source [19,20].
The motor currents are sensed through the current detection circuit.The magnet pole and rotor position are detected by the Hall-effect sensor and the encoder.In such a way, the speed and rotor position can be calculated and precisely controlled, subsequently.The ACS 712-20 current sensor IC which has the resolution of 100 mV per ampere is adopted for stator phase current detection.Since the microcontroller supports a 10-bit analog and digital converter (ADC), the full scale of 5 V is corresponding to the 1024 bits.In other words, one bit of the ADC represents the 48.83 mA.
The biosignal amplification system shown in Figure 2 is used to amplify the electrophysiological signal which is generated from the physiological response inside the body, usually in microvolts level.These signals after amplification are processed for image processing and medical diagnosis.The EMG electrophysiological measurement is one of most popular applications of the biosignal amplification.The electrophysiological signals of muscle contraction and relaxation sensed by EMG sensors are then amplified by the physiological amplifier.From the acquisition of these after processing EMG signals, it can predict the strength of the muscle contraction and the situation of muscle motor so as to facilitate the rehabilitation or the exercise of patients.
The EMG measurement mechanism consists of the EMG electrodes, the EMG physiological amplifier, high-pass filter, low-pass filter, and a full-wave rectifier, as shown in Figure 2. Two electrodes of EMG sensor are attached to the surface skin of an arm.A third electrode is attached to the common point for voltage reference.The potential difference is generated when the muscle group contracts and then fed into the instrumentation amplifier for amplification [14].Since the input resistance of an instrumentation amplifier is very high, it is suitable to pick up the EMG signal with high input resistance.In order to obtain a "clean" signal that is not DC offset and high frequency noise, the output signal from the instrumentation amplifier is filtered by a band-pass filter which is formed by a high-pass filter cascaded with a low-pass filter with the lower 3 dB frequency about 100 Hz and upper 3 dB frequency about 500 Hz.The clean signal is then rectified to DC value by using the rectifier circuit.The rectified signal is fed into the microcontroller.After proper processing, it is transmitted to the human interface via communication interface to display the contraction of muscle group when the user manipulates the ASTM.The input physiological signal to the EMG sensor is usually in microvolt.In order to pick up this minute signal, an instrumentation amplifier with high input resistance of INA 2126 that is manufactured by Burr-Brown Corporation is used in this paper.Figure 3 shows the inside of INA 2126 instrumentation amplifier.It is a precision instrumentation amplifier for accurate, low noise differential signal acquisition.The transfer function between output and difference input can be expressed by where  1 =  2 = 10 kΩ and  3 =  4 = 40 kΩ.The resistor   is the most properly selected to adjust the voltage gain since the other components need more than two resistances for voltage gain adjustment.  is equal to 842 Ω for the voltage gain of 100 in this design.Since the spectrum of EMG biosignal is usually between 50 Hz and 500 Hz.The cutoff frequency is designed to be 100 Hz in this paper.The second order high-pass filter The second order high-pass filter.
designed in this paper is shown in Figure 4.The transfer function of high-pass filter can be expressed by where The lower cutoff frequency is The midband voltage gain is Regarding the high-pass filter design, also  = 0.16,  = 1,  1 = 0.1 F,  1 = 39.3 kΩ,  3 = 2.8 kΩ, and  4 = 25 kΩ; the voltage gain is about 10 and the cutoff frequency is around 100 Hz.The output signal from the high-pass filter is then fed to the second order low-pass filter as shown in Figure 5.
Figure 5: The second order low-pass filter.
The transfer function of the second order low-pass filter can be expressed as where  = 1 +  +  − (1 +  4 / 3 ),  2 =  1 , and  2 =  1 .The upper 3 dB frequency is and the midband voltage gain is Considering the low-pass filter design, also  = 1,  = 1,  1 = 0.1  F,  1 = 3.18 kΩ,  3 = 6.3 kΩ, and  4 = 3.18 kΩ; the voltage gain is of 1.5 and the cutoff frequency is around 500 Hz.The voltage gain between the analog output signal of EMG measurement system, V 3 , and the differential input signal of EMG sensor, (V +  − V −  ), can be expressed as where  V is the overall voltage gain of the instrumentation amplifier, high-pass filter, and the low-pass filter.In this case,  V is equal to 15000.The equivalent circuit of a PMSM motor is shown in Figure 6.The stator phase voltage equations (  ,   ,   ) related to the stator phase currents (  ,   ,   ) and back electromotive force (  ,   ,   ) for a PMSM motor can be expressed by the following: where   ,   , and   , represent the phase resistance for each phase,   ,   , and   represent the self-inductance for The equivalent circuit of a PMSM motor.
each phase,   ,   , and   represent the mutual inductance between either of the two phases, and   ,   , and   represent the back EMF for each phase.If a three-phase balanced system is considered, the stator voltage in the following equation can be rearranged to In steady state, the air gap power is expressed in terms of the electromagnetic torque and speed as Hence the electromagnetic torque can be represented as Rearrange ( 12), the electromagnetic torque can be expressed by The load model can be expressed in terms of the motor speed,   , a moment of inertia, , in kg-m 2 /sec 2 with a viscous friction , in N-m/rad/sec.The electromagnetic torque,   , in N-m then drives the load torque,   , in N-m as represented in (13) [20].
The actual force displayed in the human interface panel is obtained from the motor torque.The relationship between developed torque and the total current is in (12).Since the current is captured by current sensors and converted to 10-bit digital signals, the ACS 712-20 current sensor which generates 100 mv for 1 A current flowing is used in this system.If 5 volts' reference voltage is employed for ADC converter, the actual force can be expressed by where  actual force is the digital value of actual force displayed in the human interface panel,  total is the total motor current,   is the torque constant of the PMSM motor and equal to 10.724 kgf-cm, and   is the conversion factor, with 48.83 mA per bit in this case and subject to change if different current sensor is used.

The System Software Development
The system software program is developed under MPLAB IDE software platform and written in C language.Most of the functions of electric bicycle are programmed in the microcontroller firmware which includes the circuit protection mechanism, the ADC converter for EMG system, PWM generation, motor currents calculation, rotor position and speed calculation, and rotor pole position.The system software structure for microcontroller firmware is shown in Figure 7.The initializations for I/O configuration, Timer 1, Timer 2, ADC, and PWM settings are firstly processed in the main program.Most of the ASTM functions are programmed in the microcontroller firmware which includes the circuit protection mechanism, the analog to digital converter for EMG system, PWM generation, motor currents calculation, rotor position and speed calculation, rotor pole position and the transmission and receiving of communication interface as shown in Figure 7.The flowchart of the main program for microcontroller firmware is shown in Figure 8.Since the resolution of encoder is 2500 pulses per revolution.The value of the counter in the microcontroller will be 5000 counts.The motor speed is obtained from the difference between current counter value and the last counter value in which both are acquired from the Timer 2 in capture interrupt service routine as shown in Figure 9.The EMG analog signal input to the microcontroller is first converted to the digital signal via the ADC module embedded in the microcontroller.Accordingly, the human interface can display the same converted EMG signal as well.The human interface design related to the peripheral device can be found in the paper [13].The Capture Counter in Figure 9 represents the distance when motor runs.Consequently, the displacement of a user performing the arm exercise can be obtained.The relationship between the actual speed shown in the human interface display and the motor speed can be expressed as

Mathematical Problems in Engineering
where  actual speed is the speed displayed in human interface with the unit of cm/sec and  is the radius of motor shaft with the unit of cm.The communication between the ASTM and human interface is established by UART interface which is fulfilled with the RS232 serial communication standard.The EIA-232 drives/receives of MAX 232 which includes a capacitive voltage generator provides EIA-232 voltages from a 5 V supply.Hence, it can be used for proper voltage levels conversion so that the communication of microcontroller can meet the RS232 standard.The system software for human interface including serial communication program is developed on PC and written in C language.The firmware of ASTM is programming basically on the MPLAB development tool by Microchip technology Inc. as shown in Figure 7.The desired force command and desired speed command are transmitted to the ASTM via the UART communication interface.The programming flowchart is shown in Figure 10.Both the actual force and the actual speed, as well as the EMG signal, are received by the UART controller through the UART communication interface.The data of actual force, actual speed, and the EMG signal are scaled to the corresponding coordinate and saved in EXCEL data format.The EMG signal is sampled every 1 ms.As discussed in Section 2, the signals from EMG sensors firstly go through the EMG amplification system and then feed to the microcontroller via the ADC converter.The real time EMG signals are then converted to the digital values and stored in the ADC buffer.In order to distinguish the real electric signal of the muscle activity from other noise interferences, a threshold voltage about 1 volt is adopted in EMG measurement system.In other words, the digital value is zero if the analog output EMG measurement system is less than 1 volt.This means that the sampled EMG muscle signal is less than 1 volt and is considered as the noise interference.In order to clearly observe the phenomenon of muscle activity while the user manipulates the ASTM, the 100 sampled EMG signals are averaged and denoted as EMG avg .The EMG avg together with real time current, speed are sent to PC human interface for panel display via the RS-233 communication interface.The detailed flowchart for the EMG process is shown in Figure 11.In this paper, the main aim of using the EMG sensors in the ASTM is to observe the muscle activity through the waveform of human interface display panel while user exercises the ASTM.Consequently, the user can increase more interest to do the exercise and more motivation for rehabilitation if physical therapy is required.Furthermore, the physician and physical therapist can understand the therapy progress as well as the practical conditioning of the patient's rehabilitation by observing the phenomenon of muscle activity from the human interface display.
Therefore the envelope of the EMG waveform in the human interface display can represent the strength of muscle activity.The larger the envelope (amplitude) of the waveform  is, the more strength the user exerts.The relationship between the analog output of EMG measurement system and the amplitude of the envelope for the EMG signal can be expressed by where  EMG is the digital output of EMG signal shown in human interface display,  3 is the analog output of EMG measurement system,  th is the threshold voltage,  bias is the digital output bias, and  is the conversion ratio between the digital output of EMG signal and the analog output signal of EMG measurement system.The conversion ratio can be adjusted according to the user's needs.The amplitude of EMG digital output increases as the  becomes larger and decreases vice versa.Since a 10-bit analog to digital converter is employed in the system, both  EMG and  bias have 10-bit data length.The digital output  bias is adjusted due to the offset of EMG measurement system.

The Experimental Results
The prototype of arm strength training machine with EMG measurement system is tested under different load conditions in which they are fulfilled with the dynamometer.The manipulation of ASTM with EMG measurement system is operated via the designed human interface, as shown in Figure 12.Both of the desired force command of 5 kg-cm and desired speed of 10 cm/sec are displayed in the upper window of Figure 12.In order to simulate the practical situation of lifting weights, the actual torque of motor and actual speed  The torque of motor (kg-cm) The experiment is repeated by the same cycle.Observing the waveform of Figure 13, it can be seen that the motor develops about 5 kg-cm of torque to counter the force exerted by user.This verifies the system design feasibility.The data displayed in Figures 12 and 13 are firstly saved in the memory and then sketched by using the Microsoft EXCEL software.The EMG measurement system is basically composed of high-pass filter and low-pass filter.Two different frequencies of input signal are applied to high-pass filter for frequency response testing, one is 50 Hz in which it is in stop band and the other is 100 Hz in pass band.The high-pass filter has a voltage gain of 20 dB.The upper and lower traces of Figure 14 represent the waveforms of input and output signals, respectively.It can be seen that the output signal is attenuated to 6.6 dB at 50 Hz.The input signal of frequency at 100 Hz is applied to the high-pass filter as shown in Figure 15.Observing Figure 15, the amplitude of output signal is equal to 0.707 of that of the input signal.In other words, there is a 3 dB difference between the amplitude of input and output signals.The Bode plot of magnitude response for the highpass filter is shown in Figure 16.The same testing method for high-pass filter can be applied to low-pass filter.The designed low-pass filter has voltage gain of 1.5.Figure 17       waveforms of output and input signals at the frequency of 500 Hz.The different frequency of 1 kHz for input signals is also tested.The results are shown in Figure 18.The Bode plot of magnitude response of low-pass filter is shown in Figure 19.From the observation of Bode plot in Figure 19, it can be seen that the magnitude of the output signal for the frequencies above the 500 Hz is reduced; on the contrary, below the 500 Hz it stays flat.The cutoff frequency of 500 Hz is the same as that designed in this paper.
In this preliminary test, the experimental results amplitude of EMG envelope which is obtained from the  EMG in (16) are depicted in the bottom graph of Figure 12 for  bias = 450,  = 43, and  th = 1 V.The experimental test for this waveform is processing when the user manipulates the ASTM with EMG electrodes attached in the bicep brachii  the physician and physical therapist can understand the therapy progress as well as the practical conditioning of the patient's rehabilitation by observing the phenomenon of muscle activity from the human interface display.The practical system configuration of designed ASTM with EMG sensor is shown in Figure 22.

Conclusions
The establishment of EMG measurement system in ASTM can make the exercise and rehabilitation therapy become more friendly and effective.This paper designs an EMG physiological amplifier system to monitor the muscle activity of the user when manipulating the ASTM.From the experimental results, the system hardware including the microcontroller, protection circuit, optical coupling isolation, three-phase inverter, current sensor, EMG sensors, encoder, and communication interface is well designed.Though only the desired force of 5 kg and desired speed of 10 cm/sec is tested in the experiment, the force up to 15 kg and down to the 0.5 kg have been well-tested in practice for verification of system integrity.The voltage gain of the instrumentation amplifier is designed to be 100.Because the extremely small signal is not easy to generate in the lab, the designed instrumentation amplifier is tested by using circuit simulation.

Mathematical Problems in Engineering
However, the EMG physiological signal of biceps brachii inputted to the instrumentation amplifier is amplified to appropriate voltage level as the experimental result presented.The relationship between the analog output of EMG measurement system and the amplitude of the envelope for the EMG signal displayed in human interface can be expressed by (16).However, these parameters in (16) are achieved from the preliminary tests of the experimental prototype system under the completion of few lab members.In order to obtain more exact and precise parameters, statistical method will be considered and employed to experimental tests, such as the placement of EMG electrodes and different sex and ages of testing samples, in future work.For testing of highpass filter and low-pass filter, though only two different frequencies are applied to each filter in the experimental results, several frequencies located in stop band and pass band are also tested to complete the Bode plot.Further, the fundamentals of EMG measurement system have been derived, designed, and described in detail.The experimental results have verified the feasibility of each design procedure.Moreover, both of the microcontroller firmware and the user interface are programed and described in detail.Finally, an arm strength training machine with electromyographic sensors for biofeedback is realized and demonstrated in this paper.The experimental results show the feasibility and fidelity of the complete designed system.

Figure 1 :
Figure 1: The system structure of ASTM with EMG.

Figure 2 :
Figure 2: The function block diagram of EMG measurement system.

Figure 7 :
Figure 7: The system software structure of ASTM with EMG measurement system.

Figure 8 :
Figure 8: The flowchart of main program.

Figure 10 :
Figure 10: The programming flowchart for communication between human interface and ASTM.
(current, speed, and EMG) to human interface V th < EMG ADC ?EMG temp = EMG temp + EMG ADC EMG ADC = 0 EMG AVG = EMG temp /100 Save the data of EMG AVG Clear EMG temp Is EMG temp

Figure 11 :
Figure 11: The flowchart of EMG process.

Figure 12 :
Figure 12: The desired force of 5 kg-cm and desired speed of 10 cm/sec.

Figure 13 :
Figure 13: The developed motor torque for employing 5 kg-cm force.
shows the Mathematical Problems in Engineering Ch1 100 mV Ch2 500 mV M 10.0 ms A

Figure 14 :
Figure 14: The input frequency of 50 Hz applied to the high-pass filter.

Figure 15 :Figure 16 :
Figure 15: The input frequency of 100 Hz applied to the high-pass filter.

Figure 17 :
Figure 17: The input frequency of 500 Hz applied to the low-pass filter.

Figure 18 :
Figure 18: The input frequency of 1 kHz applied to the low-pass filter.

Figure 22 :
Figure 22: The practical system of ASTM with EMG measurement system.