# The Design of EMG Measurement System for Arm Strength Training Machine

Authors: Tze-Yee Ho; Yuan-Joan Chen; Wei-Chang Hung; Kuan-Wei Ho; Mu-Song Chen
Journal: Mathematical Problems in Engineering
 (2015)

---

## Abstract

The setup of interactive communication between arm strength training machine and the people will make exercise and rehabilitation therapy become more friendly. The employment of electromyographic not only can help physical therapy but also can achieve more effective rehabilitation. Both of the system hardware and software of the arm strength training machine with EMG system are well designed and described. The fundamental design of electromyographic measurement system based on a microcontroller is analyzed and discussed. The software programming is developed in MPLAB integrated development environment from the Microchip Technology Inc. and the friendly user interface is created as well. Finally, an arm strength training machine with electromyographic control system is realized and demonstrated. The experimental results show the feasibility and fidelity of the complete designed system.


---

## Body

## 1. 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–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, low-pass 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.


## 2. 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 Figure1. 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].Figure 1
The system structure of ASTM with EMG.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 Figure2 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.Figure 2
The function block diagram of EMG measurement system.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. Figure3 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(1)vo1vi+-vi-=R4(1R1+1R3+2Ra),where R1=R2=10 kΩ and R3=R4=40 kΩ. The resistor Ra is the most properly selected to adjust the voltage gain since the other components need more than two resistances for voltage gain adjustment. Ra is equal to 842 Ω for the voltage gain of 100 in this design.Figure 3
INA2126 instrumentation amplifier.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 designed in this paper is shown in Figure4. The transfer function of high-pass filter can be expressed by(2)vo2(jω)vi2(jω)=-mnω2R12C12(1+R4/R3)1+jAωR1C1-mnω2R12C12,where A=1+n+mn-mn(1+R4/R3), C2=nC1, and R2=mR1. The lower cutoff frequency is (3)fL,3dB=12πR1C1mn.The midband voltage gain is (4)vo2vi2=1+R4R3.Regarding the high-pass filter design, also m=0.16, n=1, C1=0.1 μF, R1=39.3 kΩ, R3=2.8 kΩ, and R4=25 kΩ; the voltage gain is about 10 and the cutoff frequency is around 100 Hz.Figure 4
The second order high-pass filter.The output signal from the high-pass filter is then fed to the second order low-pass filter as shown in Figure5. The transfer function of the second order low-pass filter can be expressed as (5)vo3(jω)vi3(jω)=(1+R4/R3)1+jBωR1C1-mnω2R12C12,where B=1+m+mn-mn(1+R4/R3), C2=nC1, and R2=mR1. The upper 3 dB frequency is (6)fH,3dB=12πR1C1mn,and the midband voltage gain is (7)vo3vi3=1+R4R3.Considering the low-pass filter design, also m=1, n=1, C1=0.1 μF,   R1=3.18 kΩ, R3=6.3 kΩ, and R4=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, vo3, and the differential input signal of EMG sensor, (vi+-vi-), can be expressed as (8)vo3=Avvi+-vi-,where Av is the overall voltage gain of the instrumentation amplifier, high-pass filter, and the low-pass filter. In this case, Av is equal to 15000.Figure 5
The second order low-pass filter.The equivalent circuit of a PMSM motor is shown in Figure6. The stator phase voltage equations (Van, Vbn, Vcn) related to the stator phase currents (ia, ib, ic) and back electromotive force (ea, eb, ec) for a PMSM motor can be expressed by the following:(9)Van=Raia+Laadiadt+Labdibdt+Lacdicdt+ea,Vbn=Rbib+Lbadiadt+Lbbdibdt+Lbcdicdt+eb,Vcn=Rcic+Lcadiadt+Lcbdibdt+Lccdicdt+ec,where Ra, Rb, and Rc, represent the phase resistance for each phase, Laa, Lbb, and Lcc represent the self-inductance for each phase, Lab, Lbc, and Lca represent the mutual inductance between either of the two phases, and ea, eb, and ec represent the back EMF for each phase.Figure 6
The equivalent circuit of a PMSM motor.If a three-phase balanced system is considered, the stator voltage in the following equation can be rearranged to(10)VanVbnVcn=Rs000Rs000Rsiaibic+ddtLs000Ls000Lsiaibic+eaebec.In steady state, the air gap power is expressed in terms of the electromagnetic torque and speed as(11)eaia+ebib+ecic=Teωm.Hence the electromagnetic torque can be represented as(12)Te=eaia+ebib+ecicωm.Rearrange (12), the electromagnetic torque can be expressed by(13)Jdωmdt+Bωm+TL=Te.The load model can be expressed in terms of the motor speed,ωm, a moment of inertia, J, in kg-m2/sec2 with a viscous friction B, in N-m/rad/sec. The electromagnetic torque, Te, in N-m then drives the load torque, TL, 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 (14)Tactualforce=Itotal×Kt×Kr,where Tactualforce is the digital value of actual force displayed in the human interface panel, Itotal is the total motor current, Kt is the torque constant of the PMSM motor and equal to 10.724 kgf-cm, and Kr is the conversion factor, with 48.83 mA per bit in this case and subject to change if different current sensor is used.


## 3. 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 Figure7. The initializations for I/O configuration, Timer 1, Timer 2, ADC, and PWM settings are firstly processed in the main program.Figure 7
The system software structure of ASTM with EMG measurement system.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 Figure7. 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(15)ωactualspeed=2πr×ωm60,where ωactualspeed is the speed displayed in human interface with the unit of cm/sec and r is the radius of motor shaft with the unit of cm.Figure 8
The flowchart of main program.Figure 9
The ISR of capture interrupt.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 Figure7. 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.Figure 10
The programming flowchart for communication between human interface and ASTM.The EMG signal is sampled every 1 ms. As discussed in Section2, 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 EMGavg. The EMGavg 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.Figure 11
The flowchart of EMG process.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(16)NEMG=Vo3-VthK+Nbias,where NEMG is the digital output of EMG signal shown in human interface display, Vo3 is the analog output of EMG measurement system, Vth is the threshold voltage, Nbias is the digital output bias, and K 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 K becomes larger and decreases vice versa. Since a 10-bit analog to digital converter is employed in the system, both NEMG and Nbias have 10-bit data length. The digital output Nbias is adjusted due to the offset of EMG measurement system.


## 4. 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 Figure12. 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 when the user exercises are measured and displayed in real time as shown in the middle window of Figure 12 as well. The experiment is cyclically completed by pulling the handle bar of ASTM for 10 seconds and then releasing for next 5 seconds. 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.Figure 12
The desired force of 5 kg-cm and desired speed of 10 cm/sec.Figure 13
The developed motor torque for employing 5 kg-cm force.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 Figure14 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 high-pass 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 shows the 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.Figure 14
The input frequency of 50 Hz applied to the high-pass filter.Figure 15
The input frequency of 100 Hz applied to the high-pass filter.Figure 16
The magnitude response of Bode plot for high-pass filter.Figure 17
The input frequency of 500 Hz applied to the low-pass filter.Figure 18
The input frequency of 1 kHz applied to the low-pass filter.Figure 19
Bode plot of magnitude response for low-pass filter.In this preliminary test, the experimental results amplitude of EMG envelope which is obtained from theNEMG in (16) are depicted in the bottom graph of Figure 12 for Nbias=450, K=43, and Vth=1 V. The experimental test for this waveform is processing when the user manipulates the ASTM with EMG electrodes attached in the bicep brachii under the conditions of desired force = 5 kg and desired speed = 10 cm/sec. The user cyclically pulls and releases the handle bar of the ASTM. The motion of bicep muscle is then captured by EMG sensors and displayed in the human interface display. The corresponding real time EMG waveform of oscilloscope for Vo3 is shown in Figure 20. Due to the difficulty of synchronization between human interface and the oscilloscope, the four envelopes of EMG signal in oscilloscope are corresponding to the last four envelopes of waveform in the graph of human interface display. The zoom in EMG waveform within 100 ms is shown in Figure 21. The peak amplitude of EMG signal is about 4 volts as seen from Figure 20. It is about 580 for corresponding digital output according to (16). The experimental results demonstrate and verify the feasibility and integrity for both EMG measurement system and human interface display. Since EMG signal represents the biophysical information of the muscle activity. The average voltage of EMG sensor can be considered as the contraction of the muscle group of bicep. The peak amplitude of EMG signal is then the phenomenon of severe motion of muscle activity. Consequently, all phenomena of motion for muscle activity can be demonstrated in the human interface display designed in this paper. Therefore, 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.Figure 20
The EMG signal when manipulating ASTM.Figure 21
The zoom in EMG signal when manipulating ASTM.Figure 22
The practical system of ASTM with EMG measurement system.


## 5. 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. 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 high-pass 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.



---

*Source: 356028-2015-08-27.xml*