An EMG Patch for the Real-Time Monitoring of Muscle-Fatigue Conditions During Exercise

In recent years, wearable monitoring devices have been very popular in the health care field and are being used to avoid sport injuries during exercise. They are usually worn on the wrist, the same as sport watches, or on the chest, like an electrocardiogram patch. Common functions of these wearable devices are that they use real time to display the state of health of the body, and they are all small sized. The electromyogram (EMG) signal is usually used to show muscle activity. Thus, the EMG signal could be used to determine the muscle-fatigue conditions. In this study, the goal is to develop an EMG patch which could be worn on the lower leg, the gastrocnemius muscle, to detect real-time muscle fatigue while exercising. A micro controller unit (MCU) in the EMG patch is part of an ARM Cortex-M4 processor, which is used to measure the median frequency (MF) of an EMG signal in real time. When the muscle starts showing tiredness, the median frequency will shift to a low frequency. In order to delete the noise of the isotonic EMG signal, the EMG patch has to run the empirical mode decomposition algorithm. A two-electrode circuit was designed to measure the EMG signal. The maximum power consumption of the EMG patch was about 39.5 mAh. In order to verify that the real-time MF values measured by the EMG patch were close to the off-line MF values measured by the computer system, we used the root-mean-square value to estimate the difference in the real-time MF values and the off-line MF values. There were 20 participants that rode an exercise bicycle at different speeds. Their EMG signals were recorded with an EMG patch and a physiological measurement system at the same time. Every participant rode the exercise bicycle twice. The averaged root-mean-square values were 2.86 ± 0.86 Hz and 2.56 ± 0.47 Hz for the first and second time, respectively. Moreover, we also developed an application program implemented on a smart phone to display the participants’ muscle-fatigue conditions and information while exercising. Therefore, the EMG patch designed in this study could monitor the muscle-fatigue conditions to avoid sport injuries while exercising.


Introduction
In recent years, people like to use a wearable device to monitor their bodies' condition during exercise. The wearable devices include an exercise watch, or a band to measure heart rate and bicycles, a cyclist can use this APP to monitor his own information and the information of his team mates in real time.
This paper is organized as follows. Section 2 describes the designed EMG patch, the EMD method, and the MF definition. The way to detect the number of muscle contractions from the sEMG signal is also described in this section. Section 3 presents the APP, and Section 4 presents the results of the data taken from the twenty participants. These results are discussed in Section 5, and the conclusion is in Section 6. Figure 1 shows the block diagram of an EMG patch which includes an analog circuit, an MCU, a BLE module, a power circuit, and an alarm system. We used a wireless technique to charge the battery. The alarm system has two LEDs to display the power and the status of the BLE module, and a device that vibrates to notify the user of over tiredness. In this study, the EMG patch had an accelerometer. However, it did not work in this study. In order to verify the real-time performance of an EMG patch, a computer-based measurement system was designed to analyze the MF values of the sEMG signal, off line. Figure 2 shows the framework of the comparison between the real-time EMG patch and the off-line computer system. The sEMG signal was recorded simultaneously through the EMG patch and a physiological measurement system. The real-time MF values were transferred to the computer through the BLE module, and then recorded. These values were compared with the synchronous off-line MF values measured by the computer system. Moreover, the amplitude of the sEMG signal could be detected and used to calculate the number of muscle contractions. The number of muscle contractions represents how fast they pedaled. The real-time degree of muscle fatigue and pedaling rate would be shown in an application program (APP). EMG patch. When there is a team riding the bicycles, a cyclist can use this APP to monitor his own information and the information of his team mates in real time. This paper is organized as follows. Section 2 describes the designed EMG patch, the EMD method, and the MF definition. The way to detect the number of muscle contractions from the sEMG signal is also described in this section. Section 3 presents the APP, and Section 4 presents the results of the data taken from the twenty participants. These results are discussed in Section 5, and the conclusion is in Section 6. Figure 1 shows the block diagram of an EMG patch which includes an analog circuit, an MCU, a BLE module, a power circuit, and an alarm system. We used a wireless technique to charge the battery. The alarm system has two LEDs to display the power and the status of the BLE module, and a device that vibrates to notify the user of over tiredness. In this study, the EMG patch had an accelerometer. However, it did not work in this study. In order to verify the real-time performance of an EMG patch, a computer-based measurement system was designed to analyze the MF values of the sEMG signal, off line. Figure 2 shows the framework of the comparison between the real-time EMG patch and the off-line computer system. The sEMG signal was recorded simultaneously through the EMG patch and a physiological measurement system. The real-time MF values were transferred to the computer through the BLE module, and then recorded. These values were compared with the synchronous off-line MF values measured by the computer system. Moreover, the amplitude of the sEMG signal could be detected and used to calculate the number of muscle contractions. The number of muscle contractions represents how fast they pedaled. The real-time degree of muscle fatigue and pedaling rate would be shown in an application program (APP).   EMG patch. When there is a team riding the bicycles, a cyclist can use this APP to monitor his own information and the information of his team mates in real time. This paper is organized as follows. Section 2 describes the designed EMG patch, the EMD method, and the MF definition. The way to detect the number of muscle contractions from the sEMG signal is also described in this section. Section 3 presents the APP, and Section 4 presents the results of the data taken from the twenty participants. These results are discussed in Section 5, and the conclusion is in Section 6. Figure 1 shows the block diagram of an EMG patch which includes an analog circuit, an MCU, a BLE module, a power circuit, and an alarm system. We used a wireless technique to charge the battery. The alarm system has two LEDs to display the power and the status of the BLE module, and a device that vibrates to notify the user of over tiredness. In this study, the EMG patch had an accelerometer. However, it did not work in this study. In order to verify the real-time performance of an EMG patch, a computer-based measurement system was designed to analyze the MF values of the sEMG signal, off line. Figure 2 shows the framework of the comparison between the real-time EMG patch and the off-line computer system. The sEMG signal was recorded simultaneously through the EMG patch and a physiological measurement system. The real-time MF values were transferred to the computer through the BLE module, and then recorded. These values were compared with the synchronous off-line MF values measured by the computer system. Moreover, the amplitude of the sEMG signal could be detected and used to calculate the number of muscle contractions. The number of muscle contractions represents how fast they pedaled. The real-time degree of muscle fatigue and pedaling rate would be shown in an application program (APP).     Figure 3 shows the analog circuit for the EMG patch. The raw sEMG signal is a low-amplitude signal, therefore it needed to be amplified. An instrument amplifier (AD8236, Analog Devices (AD) Company, Norwood, MA, USA), with a gain of 10, was used to enhance the signal. Because a virtual-ground technique was used, only two electrodes were needed to be used on the input terminals of the instrument amplifier. Operational amplifiers (AD8609, AD Company, Norwood, MA, USA) were used to design the filters, the amplifier, the peak rectifier, and the baseline offset circuit. According to a previous study [17], a two-order Butterworth high-pass filter (cutoff frequency 33.9 Hz) was used to remove the direct current (DC) offset and the baseline wandering, and a two-order Butterworth low-pass filter (cutoff frequency 482.5 Hz), was used to reduce the high-frequency noise and to avoid aliasing of the sampling signal. The gain of the non-inverting amplifier was 100. Finally, the baseline of the sEMG signal was raised to 1 V by a baseline offset circuit.  Figure 3 shows the analog circuit for the EMG patch. The raw sEMG signal is a low-amplitude signal, therefore it needed to be amplified. An instrument amplifier (AD8236, Analog Devices (AD) Company, Norwood, MA, USA), with a gain of 10, was used to enhance the signal. Because a virtual-ground technique was used, only two electrodes were needed to be used on the input terminals of the instrument amplifier. Operational amplifiers (AD8609, AD Company, Norwood, MA, USA) were used to design the filters, the amplifier, the peak rectifier, and the baseline offset circuit. According to a previous study [17], a two-order Butterworth high-pass filter (cutoff frequency 33.9 Hz) was used to remove the direct current (DC) offset and the baseline wandering, and a two-order Butterworth low-pass filter (cutoff frequency 482.5 Hz), was used to reduce the high-frequency noise and to avoid aliasing of the sampling signal. The gain of the non-inverting amplifier was 100. Finally, the baseline of the sEMG signal was raised to 1 V by a baseline offset circuit. In the power circuit, the Texas Instruments (TI) wireless receiver chip (BQ51003YFPR TI company, Dallas, TX, USA) was used to charge the lithium battery. A voltage regular (TPS78233, TI company, Dallas, TX, USA) was used to provide a 3.3 voltage (V), and its input voltage was from the lithium battery. A negative voltage regular (TPS60400, TI company, Dallas, TX, USA) was used to provide a −3.3 V, and its input voltage was 3.3 V. The maximum power consumption of the EMG patch was 39.5 mAh.

Hardware of the EMG Patch
The BLE module was the NrfF51822 (Nordic Semiconductor, Trondheim, Oslo, Norway). The STM32L432KC (STMicroelectronics, Geneva, Switzerland) is a 32 bit MCU which has a 64 kB static random access memory (SRAM), and a 256 kB flash memory. It uses a clock of 32 MHz. The power consumption is 84 uA/MHz when running at full capacity. The sampling rate of the EMG patch was 1000 Hz. Moreover, an electronic vibrator was used in the EMG patch to alert the user when the degree of muscle fatigue exceeds the designed threshold. Figure 4 shows two views of the EMG patch; (a) from the top, (b) from the bottom. The size of the main board is 30 mm, and the size of the electrode's connector is 25 mm. In the power circuit, the Texas Instruments (TI) wireless receiver chip (BQ51003YFPR TI company, Dallas, TX, USA) was used to charge the lithium battery. A voltage regular (TPS78233, TI company, Dallas, TX, USA) was used to provide a 3.3 voltage (V), and its input voltage was from the lithium battery. A negative voltage regular (TPS60400, TI company, Dallas, TX, USA) was used to provide a −3.3 V, and its input voltage was 3.3 V. The maximum power consumption of the EMG patch was 39.5 mAh.
The BLE module was the NrfF51822 (Nordic Semiconductor, Trondheim, Oslo, Norway). The STM32L432KC (STMicroelectronics, Geneva, Switzerland) is a 32 bit MCU which has a 64 kB static random access memory (SRAM), and a 256 kB flash memory. It uses a clock of 32 MHz. The power consumption is 84 uA/MHz when running at full capacity. The sampling rate of the EMG patch was 1000 Hz. Moreover, an electronic vibrator was used in the EMG patch to alert the user when the degree of muscle fatigue exceeds the designed threshold. Figure 4 shows two views of the EMG patch; (a) from the top, (b) from the bottom. The size of the main board is 30 mm, and the size of the electrode's connector is 25 mm.

Empirical Mode Decomposition
EMD is applied to decompose an sEMG signal to detect muscle conditions. Details of the algorithm can be found in reference [17]. The pseudo code of the EMD algorithm is shown in Algorithm 1.

Algorithm 1: Pseudo code of the EMD algorithm
while m(t) is nontrivial do 3. Interpolate the local minima and maxima, ending up with lower and upper envelopes, emin(t) and emax(t).

Extract the different signal ( ) = ( ) − ( ), and denote d(t) as r(t)
end while In this study, the size of the sampling data segment was 4096 points for each processing session, and the overlap points were 2048 points. According to the study of Liu [17], we only used the IMF1 component to measure the MF values. In order to run the EMD algorithm in an MCU system, we did Step 1 to Step 5 ten times. A second order polynomial function was used to get the upper and lower envelopes of signal on Step 3. However, on the computer system, the iteration of the IMF1 would end when the mean of the sum of the IMF1 was zero, and the third order function was used to estimate the upper and lower envelopes of the signal. Figure 5 shows the results of the EMD algorithm in the EMG patch; (a) the raw EMG, (b) the IMF1 of the sEMG, (c) the upper (red) and lower (blue) envelopes of the sEMG. The upper and lower envelopes obtained by our method are very close to the truth envelopes.

Empirical Mode Decomposition
EMD is applied to decompose an sEMG signal to detect muscle conditions. Details of the algorithm can be found in reference [17]. The pseudo code of the EMD algorithm is shown in Algorithm 1.

Algorithm 1: Pseudo code of the EMD algorithm
Interpolate the local minima and maxima, ending up with lower and upper envelopes, e min (t) and e max (t).
4. Compute the average m(t) = 0.5(e min + e max ). 5. Extract the different signal d(t) = r(t) − m(t), and denote d(t) as r(t) end while In this study, the size of the sampling data segment was 4096 points for each processing session, and the overlap points were 2048 points. According to the study of Liu [17], we only used the IMF1 component to measure the MF values. In order to run the EMD algorithm in an MCU system, we did Step 1 to Step 5 ten times. A second order polynomial function was used to get the upper and lower envelopes of signal on Step 3. However, on the computer system, the iteration of the IMF1 would end when the mean of the sum of the IMF1 was zero, and the third order function was used to estimate the upper and lower envelopes of the signal. Figure 5 shows the results of the EMD algorithm in the EMG patch; (a) the raw EMG, (b) the IMF1 of the sEMG, (c) the upper (red) and lower (blue) envelopes of the sEMG. The upper and lower envelopes obtained by our method are very close to the truth envelopes.

Median Frequency
Fast Fourier transform (FFT) was applied to the IMF1. After that, the MF was defined as the frequency where the accumulated spectrum energy is half of the total spectrum energy, as shown in Equation (1). Where the is the ( ) power spectrum density (PSD) of the IMF 1: Then, we used the root-mean-square difference between the real-time and the off-line MF values, ERMS, to verify the performance of the EMG patch: where MFreal-time is the real-time MF value, MFoff-line is the off-line MF value, N is the samples of MF.

Detecting the Number of Muscle Contractions
When the muscle is performing dynamic contractions, the amplitudes of the EMG signal have significant changes. Thus, the envelope of the EMG amplitudes can be used to determine the number of muscle contractions which represents the pedaling rate, the revolution per minute (RPM), while riding the bicycle. First, the EMG signal is downsampling: Then, a two-order Butterworth low-pass filter with a cutoff frequency of 90 Hz was used to remove the sEMG signal:

Median Frequency
Fast Fourier transform (FFT) was applied to the IMF1. After that, the MF was defined as the frequency where the accumulated spectrum energy is half of the total spectrum energy, as shown in Equation (1). Where the is the p( f ) power spectrum density (PSD) of the IMF 1: Then, we used the root-mean-square difference between the real-time and the off-line MF values, E RMS , to verify the performance of the EMG patch: where MF real-time is the real-time MF value, MF off-line is the off-line MF value, N is the samples of MF.

Detecting the Number of Muscle Contractions
When the muscle is performing dynamic contractions, the amplitudes of the EMG signal have significant changes. Thus, the envelope of the EMG amplitudes can be used to determine the number of muscle contractions which represents the pedaling rate, the revolution per minute (RPM), while riding the bicycle. First, the EMG signal is downsampling:

of 15
Then, a two-order Butterworth low-pass filter with a cutoff frequency of 90 Hz was used to remove the sEMG signal: The absolute value of the different filtered signal was used to extract the envelope of the muscle activity: Then, the integration was done twice: A peak marker with a size of 21 points was used to detect the peak of the envelope. Figure 6 shows the envelope (blue) of the EMG (black) signal which has very clear peaks. Thus, the peak could be easily detected. After that, the amount of peak within two seconds represents the pedaling rate.

. (4)
The absolute value of the different filtered signal was used to extract the envelope of the muscle activity: Then, the integration was done twice: A peak marker with a size of 21 points was used to detect the peak of the envelope. Figure 6 shows the envelope (blue) of the EMG (black) signal which has very clear peaks. Thus, the peak could be easily detected. After that, the amount of peak within two seconds represents the pedaling rate.

Experiment Protocol
There were twenty healthy participants in this study consisting of 10 males and 10 females, aged from 20 years to 26 years. Before the collection of the data, all the participants were notified of the experiment protocols, and signed consent forms. An exercise bicycle, a Giant Taiwan, was used in the experiment. The EMG patch was worn on the gastrocnemius, as shown in Figure 7. We avoided using the belly position of the gastrocnemius muscle and shifted the electrodes to a higher position on this muscle. The Ag/AgCl electrodes (Kendall, SK, Canada) were used for the EMG recording, with a 10 mm diameter and self-adhesive supports. The positions of the electrodes for each subject were recorded, and the electrodes were placed on the same position in the subsequent experiments. Before wearing the EMG patch, alcohol was used to clean the surface to decrease any

Experiment Protocol
There were twenty healthy participants in this study consisting of 10 males and 10 females, aged from 20 years to 26 years. Before the collection of the data, all the participants were notified of the experiment protocols, and signed consent forms. An exercise bicycle, a Giant Taiwan, was used in the experiment. The EMG patch was worn on the gastrocnemius, as shown in Figure 7. We avoided using the belly position of the gastrocnemius muscle and shifted the electrodes to a higher position on this muscle. The Ag/AgCl electrodes (Kendall, SK, Canada) were used for the EMG recording, with a 10 mm diameter and self-adhesive supports. The positions of the electrodes for each subject were recorded, and the electrodes were placed on the same position in the subsequent experiments. Before wearing the EMG patch, alcohol was used to clean the surface to decrease any contact impedance. There were two riding speeds in this experiment, 60 RPM and 100 RPM. The 60 RPM represented light exercise, and the 100 RPM represented heavy exercise. The exercise bicycle could display the RPM on a smart phone. A 10 min session was required for each speed. In the pre-experiment, the participants rode at a specific speed and tried to keep that speed for at least 10 min. In order to show the reliability of the EMG patch, participants were requested to do the experiment twice, and they got three to four days to rest between the two experiments. A multi-channel physiological measurement system (KL-710, K&H MFG. CO. LTD., Taipei, Taiwan) was used to record the sEMG signal synchronously, the bandwidth was 30 Hz to 500 Hz, and the sampling rate was also 1000 Hz. contact impedance. There were two riding speeds in this experiment, 60 RPM and 100 RPM. The 60 RPM represented light exercise, and the 100 RPM represented heavy exercise. The exercise bicycle could display the RPM on a smart phone. A 10 min session was required for each speed. In the pre-experiment, the participants rode at a specific speed and tried to keep that speed for at least 10 min. In order to show the reliability of the EMG patch, participants were requested to do the experiment twice, and they got three to four days to rest between the two experiments. A multi-channel physiological measurement system (KL-710, K&H MFG. CO. LTD., Taipei, Taiwan) was used to record the sEMG signal synchronously, the bandwidth was 30 Hz to 500 Hz, and the sampling rate was also 1000 Hz.

Application Program for the Cyclists
In this study, we developed an APP using a JavaScript program for the cyclists to use. The user could watch their own muscle conditions and the information of the other cyclists, the weather information, the GPS position, the pedaling rate, and the speed velocity of the bicycle on this APP. The EMG patch with the BLE module transferred the level of muscle fatigue and the pedaling rate to the APP every two seconds. Figure 8 shows the home page of the APP. In the beginning, the APP would show the addresses of the median address control (MAC) of all BLE modules. Then, the APP would connect the EMG patch automatically. When users touched the 'map' icon, a Google map would be displayed. When users touched the 'stop' icon, the APP would disconnect from the EMG patch.

Application Program for the Cyclists
In this study, we developed an APP using a JavaScript program for the cyclists to use. The user could watch their own muscle conditions and the information of the other cyclists, the weather information, the GPS position, the pedaling rate, and the speed velocity of the bicycle on this APP. The EMG patch with the BLE module transferred the level of muscle fatigue and the pedaling rate to the APP every two seconds. Figure 8 shows the home page of the APP. In the beginning, the APP would show the addresses of the median address control (MAC) of all BLE modules. Then, the APP would connect the EMG patch automatically. When users touched the 'map' icon, a Google map would be displayed. When users touched the 'stop' icon, the APP would disconnect from the EMG patch.
When the APP got the ten MF values, the average of the first five MF values would be the baseline, and the average of the other MF values was used to calculate the level of muscle fatigue. If the averaged MF value was larger than the baseline value, the averaged MF value was replaced as the baseline value. Therefore, the baseline MF value must be the maximum value when estimating muscle fatigue. We defined 10 levels for the muscle-fatigue conditions. The zero level represented no muscle fatigue, and the tenth level represented the worst muscle fatigue. According to the "Detecting the Number When the APP got the ten MF values, the average of the first five MF values would be the baseline, and the average of the other MF values was used to calculate the level of muscle fatigue. If the averaged MF value was larger than the baseline value, the averaged MF value was replaced as the baseline value. Therefore, the baseline MF value must be the maximum value when estimating muscle fatigue. We defined 10 levels for the muscle-fatigue conditions. The zero level represented no muscle fatigue, and the tenth level represented the worst muscle fatigue. According to the "Detecting the Number of Muscle Contractions" section, the pedaling rate was also shown on this page. The level of muscle fatigue, _ , is defined below: The APP data would be transferred to the server by 4G communication, which includes the _ , using one byte, the step velocity using one byte, and the GPS position using eight bytes. The GET method of the HTTP was used to transfer this data. According to the data of the GPS position, the speed of the bicycle would be calculated on the server. The server also got the weather information from the central weather bureau. Then, the data for each cyclist would be transferred back to the APP. Table 1 shows the data size and protocol. The total bytes are 23 bytes. Number 1 represents the data of the APP user. Number 2 represents the data of the others.  Figure 9 shows the results of the EMD by the MATLAB code on the computer system. The activities of the muscle during the isotonic contractions are clearly displayed in the IMF1 which is the same as the study of Liu [17]. All the other IMFs and the residual signals do not show the clear activities of the muscle. Figure 10 shows the change of the real-time (black line) and the off-line (red The APP data would be transferred to the server by 4G communication, which includes the Level Muscle_Fatigue , using one byte, the step velocity using one byte, and the GPS position using eight bytes. The GET method of the HTTP was used to transfer this data. According to the data of the GPS position, the speed of the bicycle would be calculated on the server. The server also got the weather information from the central weather bureau. Then, the data for each cyclist would be transferred back to the APP. Table 1 shows the data size and protocol. The total bytes are 23 bytes. Number 1 represents the data of the APP user. Number 2 represents the data of the others.  Figure 9 shows the results of the EMD by the MATLAB code on the computer system. The activities of the muscle during the isotonic contractions are clearly displayed in the IMF1 which is the same as the study of Liu [17]. All the other IMFs and the residual signals do not show the clear activities of the muscle. Figure 10 Table 3. All slope values of MF change for the ten male subjects.

Number
First Second   Figure 11 shows the map information of the APP. The red symbol represents the user, the blue symbol is another cyclist. The weather information shows on the top. The APP could help the user to understand the condition of their muscles and the riding information immediately. Moreover, they can also see the riding information of another cyclist. Therefore, cyclists could use this APP to ride the bicycle at an optimal speed for exercise.

Discussion
The term 'consumer health care' is a new concept in the industry, and it means that there is increased health awareness from using the wireless technique, helping to build healthy consciousness for every citizen [19]. There are some wearable devices developed to monitor the body's physiological information, such as an electroencephalogram, an electrocardiogram, an EMG, or that show the respiration and heart rate [20]. These devices monitor the raw signals with low Figure 11. A sample map of the APP for a cyclist.

Discussion
The term 'consumer health care' is a new concept in the industry, and it means that there is increased health awareness from using the wireless technique, helping to build healthy consciousness for every citizen [19]. There are some wearable devices developed to monitor the body's physiological information, such as an electroencephalogram, an electrocardiogram, an EMG, or that show the respiration and heart rate [20]. These devices monitor the raw signals with low sampling rates, and their algorithms are not complex enough to get certain important features of the measuring signals [21]. Their advantages are that they have a long-term monitoring of about two to seven days [20]. However, if the device is only used to monitor the body condition in real time during exercise, it will only last one day or even shorter. Therefore, when the wearable device has to have a higher sampling rate and a higher complex algorithm, the way to design the firmware of the device would be a challenge.
Some wearable devices used the textile electrodes to measure electrocardiogram and EMG signals [16,19]. In this study, we designed bicycle pants which had two textile electrodes on the lining of the pants to measure the lateral femoral muscle, as shown in Figure 12a. When the subject wore these bicycle pants, the EMG patch was placed on the pants as shown in Figure 12b. However, the tail end of pants would follow the pedaling cycle to move. The textile electrodes also were moved. Therefore, the sEMG signal was coupled with many artificial noises. The sensitivity of assessing muscle fatigue became low. Thus, we used the Ag/AgCl electrodes to measure the sEMG signal, which also could hold the EMG patch on the muscle. lining of the pants to measure the lateral femoral muscle, as shown in Figure 12a. When the subject wore these bicycle pants, the EMG patch was placed on the pants as shown in Figure 12b. However, the tail end of pants would follow the pedaling cycle to move. The textile electrodes also were moved. Therefore, the sEMG signal was coupled with many artificial noises. The sensitivity of assessing muscle fatigue became low. Thus, we used the Ag/AgCl electrodes to measure the sEMG signal, which also could hold the EMG patch on the muscle. The limitations of wearable devices include the power consumption (mAh), the memory size (kilobytes), and a clock (MHz/s). In this study, the sampling rate of the sEMG signal was 1000 Hz. One segment was 2048 sampling points. The SRAM of the MCU only has 48 kilobytes for registering the data, because 16 kilobytes of memory are used for the other registers of the MCU. In the EMG patch, the analog-to-digital converter (ADC) buffer for 1024 sampling points needed 2 kilobytes of memory. Because the FFT and EMD methods belong to the complex algorithms, they need a large amount of memory. The multiplication numbers were 1024 2048 , and the additional numbers were 2048 2048 for the FFT calculation [22]. The total memory size of the FFT algorithm for the real and complex numbers was 16 kilobytes. In the EMD algorithm, the memory size of one sampling data segment for the sEMG data was 8 kilobytes. The memory sizes of the registers for the upper and lower envelopes were 8 kilobytes and 8 kilobytes, separately. According to the Nyquist frequency, the first 1024 points of the PSD for the IMF1 component were used to estimate the MF value. Thus, the memory size for the PSD was 2 kilobytes. Because the four second data were used to estimate one MF value, one was used for the new data and the other one for the old data. Therefore, the total 46 kilobytes of SRAM were used to run the FFT and EMD algorithm.
In the EMD algorithm, the difference signal, ( ) [23] was obtained by the iteration method. The different IMF components were calculated in sequence. Since the running time of the EMD algorithm depends on the complexity of the signal, the EMD is very hard to be implemented in a real-time system. However, according to the study of Liu [17], the IMF1 of the sEMG signal had a higher sensitivity for detecting muscle fatigue than the other IMF components. We also found that the average value of the difference signal would be close to zero when its iteration time was ten. In Table 2, we compared the real-time MF values from the EMG patch and the off-line MF values with the computer system. Their ERMS values are very small, the average of which is only 2.17 ± 0.7019 Hz. This result shows that the IMF1 component can be obtained by iterating ten times, and the The limitations of wearable devices include the power consumption (mAh), the memory size (kilobytes), and a clock (MHz/s). In this study, the sampling rate of the sEMG signal was 1000 Hz. One segment was 2048 sampling points. The SRAM of the MCU only has 48 kilobytes for registering the data, because 16 kilobytes of memory are used for the other registers of the MCU. In the EMG patch, the analog-to-digital converter (ADC) buffer for 1024 sampling points needed 2 kilobytes of memory. Because the FFT and EMD methods belong to the complex algorithms, they need a large amount of memory. The multiplication numbers were 1024 × log 2 2048, and the additional numbers were 2048 × log 2 2048 for the FFT calculation [22]. The total memory size of the FFT algorithm for the real and complex numbers was 16 kilobytes. In the EMD algorithm, the memory size of one sampling data segment for the sEMG data was 8 kilobytes. The memory sizes of the registers for the upper and lower envelopes were 8 kilobytes and 8 kilobytes, separately. According to the Nyquist frequency, the first 1024 points of the PSD for the IMF1 component were used to estimate the MF value. Thus, the memory size for the PSD was 2 kilobytes. Because the four second data were used to estimate one MF value, one was used for the new data and the other one for the old data. Therefore, the total 46 kilobytes of SRAM were used to run the FFT and EMD algorithm.
In the EMD algorithm, the difference signal, d(t) [23] was obtained by the iteration method. The different IMF components were calculated in sequence. Since the running time of the EMD algorithm depends on the complexity of the signal, the EMD is very hard to be implemented in a real-time system. However, according to the study of Liu [17], the IMF1 of the sEMG signal had a higher sensitivity for detecting muscle fatigue than the other IMF components. We also found that the average value of the difference signal would be close to zero when its iteration time was ten. In Table 2, we compared the real-time MF values from the EMG patch and the off-line MF values with the computer system. Their E RMS values are very small, the average of which is only 2.17 ± 0.7019 Hz. This result shows that the IMF1 component can be obtained by iterating ten times, and the upper and lower envelopes were obtained by a second-order function. The running time for calculating an MF value was 0.213 s under the MUC with the 32 MHz clock.
In this study, the EMG patch was limited by the size of SRAM and the running clock of the MCU. Thus, we designed the sampling rate of the EMG patch to be 1000 Hz and the bandwidth of the anti-aliasing filter to be 33.9 to 482.5 Hz. Although the high cutoff frequency was very close to the Nyquist frequency of 500 Hz, the signal energy at the cutoff frequency has been attenuated to the half energy in the pass-band. Thus, the sampling EMG signal might have the aliasing phenomenon. However, according to the study of Liu [17], the maximum MF value for the EMG signal was about 280 Hz when the sampling rate was 2000 Hz and the sample data was 30 s. In our study, the maximum MF value was about 240 Hz when the sampling rate was 1000 Hz and the sample data was 4 s. The two results were very close. In Tables 3 and 4, the slope values of MF change are all negative, which is similar to the results of the previous study [17].

Conclusions
Finally, we designed the EMG patch to monitor the conditions of muscle fatigue in the muscle during isotonic contraction. It used two electrodes to measure the sEMG signal. The ARM Cortex-M4 processor could run the FFT and EMD algorithm to detect the MF values of the EMG signal in real time. The results of this study show that the real-time MF values measured by the EMG patch were very close to the off-line MF values measured by the computer system. Moreover, an APP was designed in this study, which could display the levels of muscle fatigue and the riding information of the user, and the information of other cyclists in real time. Therefore, the EMG patch could be used to monitor the muscle-fatigue conditions during exercise to avoid sport injuries in the future.