# Electromyography Wearable Device Applied to the Medical Field

Authors: Fahima Hajjej; Manal Abdullah Alohali; Malek Hasan; Md Maruf Haque Khan
Journal: Wireless Communications and Mobile Computing
 (2022)

---

## Abstract

Electromyography is a diagnostic practice that examines the condition of the muscles and the nerves that regulate them. It allows neuromuscular disorders and lesions to be diagnosed, categorized based on their severity, and the most appropriate related treatment to be carried out based on the type of ailment detected. A neurologist or physical therapist is usually the one who performs this type of exam. The idea of carrying out this research arises from the need to work with a device that can perform the functions described so far to apply these medical studies to sports, physiotherapy, and rehabilitation to achieve full recovery after suffering a neuromuscular injury. This paper intends to work within the Internet of Medical Things (IoMT) to connect professionals and patients through the Internet and speed up diagnoses and treatments. This article discusses the design of a wearable electromyography device capable of performing the functions of acquisition, processing, and transmission of the signal generated by the muscles to diagnose and treat neuromuscular diseases or injuries. Specifically, the paper focuses on the design of a device that is capable of acquiring the signal generated by the muscles and processing the signal.


---

## Body

## 1. Introduction

Considering that the increasingly rapid advance of the technologies that surround us can be ignored and, in this way, will not affect our lives is no longer a plausible idea. The world is increasingly connected, and the Arabic context [1, 2] has shown an increase in use, corresponding to 80% of the population using the Internet. Still, according to the data, the number of Internet accesses via cell phone has tripled in Arabic countries in recent years. There is a direction towards the growing influence of technologies in our lives. It is clear then that the use of terms such as Internet of Things (IoT), Internet of Everything (IoE), cloud computing [1], cyberculture, ubiquitous computing, wearables, or wearable devices will be a regular part of our day-to-day. Thus, these terms will represent changes in our lives, according to Sri et al. [3]. Therefore, the discussion of issues such as these can facilitate the understanding of this process experienced. Resources such as wearables, mentioned above, will allow different data to be collected by sensors and, in this way, enable an increasingly targeted and personalized use by the professionals involved to seek the goals outlined in physical activities, with a very accurate follow-up, as expected by Piwek et al. [4]. For health and fitness, more continuous monitoring is sought through smartphones, for example. Alazzam et al. [5] point out that the consequences of physical inactivity could become a major problem worldwide. These diseases have alarming projections for the coming years, according to data from the World Health Organization (WHO) highlighted by Alazzam et al. [5], reaching up to 44 million related deaths by the year 2020, requiring adequate interventions to prevent these types. of problems. According to available literature data [2, 6], gadgets will be the most representative on the market in the coming years from the standpoint of m-Health. Thus, smartphones continue to dominate the device market, but watches and bracelets are on the rise, while tablets, for example, are expected to decline throughout this time period. The promotion of physical activities is among the actions with great importance in this sense, improving the quality of life, and can be helped by the use by professionals of technologies that favour the management of information. Thus, as it is feasible to perceive, more and more IoT-related devices will be part of our reality, being inserted into our routine. It will be the case of smart homes, m-Health, and smart transit, among many other services that will interfere directly and indirectly in our lives [7], requiring adequacy since some services are no longer such a distant reality in some contexts. The development of applications connected to the Internet of Things (IoT) has provided the creation of potentially integrated solutions for various challenges. This connected ecosystem of wearable technology, static devices, and applications has helped to collect and process vital data for healthcare informatics.The motivation for completing this project is the necessity to work with a device capable of performing the activities outlined thus far to apply these medical studies to sports, physiotherapy, and rehabilitation to achieve full recovery. Thus, a wearable gadget, which is small enough to be fastened or adhered to the patient in some way while he is being treated, is portable and communicates data to central software. It is meant to function within the Internet of Medical Things (IoMT), to connect experts and patients over the Internet and speed up diagnostics and treatments [8]. Shimmer [9], one of the leading technologies at the moment, offers a wide range of wireless instruments and devices for the collecting and analysis of a wide variety of biophysical information. It distinguishes itself from the competitors due to its tiny size and weight. The first thing we look for in our current work is a reliable connection that allows for fast data transmission; for this reason, we have focused on Bluetooth technology, which, in addition to all of the above, was easier to implement at the prototype level.


## 2. Methodology

### 2.1. Hardware Requirements

Regarding the physical design of our device, the following points must meet:(i)
It must be a consistent system that collects and amplifies a microvolt signal to obtain an accurate electromyogram (absolute signal)(ii)
The system must be able to communicate with other devices via Bluetooth signal(iii)
The dimensions must be reduced to meet the premise of being wearable(iv)
The system must have a certain autonomy that allows its use without needing to be connected to any power source(v)
All specifications included within Surface Electromyography for the Non-Invasive Assessment of Muscles will be applied (within the limits of an academic project)


### 2.2. Software Requirements

At the software level, it has the following:(i)
Sending and receiving data through Bluetooth technology, from the processor integrated into the system to an APP(ii)
The APP must integrate the minimum functionalities for the correct reception of the electromyogram(iii)
The functionality of sending and receiving data must be robust to not be affected by external agents that may deteriorate the signal


### 2.3. MyoWare EMG Muscle Sensor

MyoWare EMG Muscle Sensor (Sparkfun Electronics) [10] is an electromyography device sold as a kit and designed to work with an Arduino board. It consists of a plate just a few centimeters in size, accompanied by two sensors already inserted to collect the muscle signal and a third sensor that will act as GND, coupled by a cable attached to another muscle. Different shields can be added to this system, which allows it to increase its functionalities, such as Bluetooth and LCD screen. This device presents the best value for money and on which we have based ourselves to carry out that retro-engineering process that has allowed us to design our system. MyoWare EMG Muscle Sensor consists of signal acquisition and amplification circuit, a rectification of the same, and finally, a “smoothing” [11]. Said board lacks a data transmission system; therefore, for our device, just add the necessary components to work with that function. Next, begin to describe our wearable electromyography device design.


## 2.1. Hardware Requirements

Regarding the physical design of our device, the following points must meet:(i)
It must be a consistent system that collects and amplifies a microvolt signal to obtain an accurate electromyogram (absolute signal)(ii)
The system must be able to communicate with other devices via Bluetooth signal(iii)
The dimensions must be reduced to meet the premise of being wearable(iv)
The system must have a certain autonomy that allows its use without needing to be connected to any power source(v)
All specifications included within Surface Electromyography for the Non-Invasive Assessment of Muscles will be applied (within the limits of an academic project)


## 2.2. Software Requirements

At the software level, it has the following:(i)
Sending and receiving data through Bluetooth technology, from the processor integrated into the system to an APP(ii)
The APP must integrate the minimum functionalities for the correct reception of the electromyogram(iii)
The functionality of sending and receiving data must be robust to not be affected by external agents that may deteriorate the signal


## 2.3. MyoWare EMG Muscle Sensor

MyoWare EMG Muscle Sensor (Sparkfun Electronics) [10] is an electromyography device sold as a kit and designed to work with an Arduino board. It consists of a plate just a few centimeters in size, accompanied by two sensors already inserted to collect the muscle signal and a third sensor that will act as GND, coupled by a cable attached to another muscle. Different shields can be added to this system, which allows it to increase its functionalities, such as Bluetooth and LCD screen. This device presents the best value for money and on which we have based ourselves to carry out that retro-engineering process that has allowed us to design our system. MyoWare EMG Muscle Sensor consists of signal acquisition and amplification circuit, a rectification of the same, and finally, a “smoothing” [11]. Said board lacks a data transmission system; therefore, for our device, just add the necessary components to work with that function. Next, begin to describe our wearable electromyography device design.


## 3. Description of the Wearable Electromyography Device

### 3.1. Hardware Level

#### 3.1.1. Critical Components

Our system consists of several basic stages studied during the degree and that will explain later. Therefore, it was very important to choose integrated circuits that offered many operational amplifiers with which to perform all the necessary functions.Finally, the following have been chosen:(i)
TL072: integrated circuit containing 2 TL072 operational amplifiers with JFET input and 8 pins(ii)
TL074: integrated circuit containing 4 TL074 operational amplifiers with JFET input and 14 pins(iii)
INA106: 8-pin precision differential amplifierThe rest of the components will be described in the sections dedicated to each of the stages.


#### 3.1.2. System Stages

Next, present the phases that make up the system. General data of each one is included.(1) Acquisition Stage. Data collection, in our case, an analog signal, is differentially between the two electrodes (Figure 1) that collect the impulse generated by the muscles.Figure 1
Data acquisition stage.The amplifier used in this case is the INA106. Two of the three electrodes are connected to the amplifier inputs, and the last one goes to GND to act as a reference. Signal acquisition stage components R1 and R2 values are 1 MΩ.(2) Amplification Stage. The impulse emitted by the muscles is in the order of microvolts (Figure 2), so we need an amplification stage that allows us to work with a higher value signal to treat it more precisely.Figure 2
Amplification stage.In this case, use the TL074 component, whose pins 1, 2, and 3 correspond to the first amplifier included.(3) Filtering Stage (High-Pass Filter). It is responsible for the attenuation of the signal for low-frequency values, allowing only the passage for frequencies higher than its cut-off frequency. Since this is such a weak input signal, removing as much noise as possible is essential for a proper reading. The cut-off frequency is 106.1 Hz.Here, use the TL074, with its pins 5, 6, and 7 corresponding to the second amplifier (Figure3). The rest of the high-pass filter components with values are C1 (0.01 μF), R5 (150 kΩ), and R6 (15 0kΩ).Figure 3
High-pass filter.(4) Rectification Stage. It is a very important step since we will use the Arduino board to work the signal. This tool only converts positive signal levels to digital data with its analog/digital converter.The TL074 component uses the last two amplifiers corresponding to pins 8, 9, and 10 and 12, 13, and 14 (Figure4), respectively. Also, the rectification stage components have the values of R7 (10 kΩ), R8 (10 kΩ), R9 (10 kΩ), R10 (10 kΩ), R11 (10 kΩ), D1 (1N4148), and D2 (1N4148).Figure 4
Rectification stage.(5) Filtering Stage (Low-Pass Filter). With this filter, attenuate the frequencies that are above the cut-off strongly. As before, what we are looking for is to remove noise for better processing. Its cut-off frequency is 1974 Hz.Here, use the TL072 (Figure5) component and its pins 1, 2, and 3 that correspond to the first amplifier. Also, the low-pass filter components have the values C2 (1 μF), R12 (82 kΩ), and R13 (82 kΩ).Figure 5
Low-pass filter.(6) Investment Stage. This stage is an amplifier that inverts the gain value of the signal since the first amplifier had a negative gain, and with this phase, apply negative gain again.We use the last three pins 5, 6, and 7 of the TL072 amplifier (Figure6) with investment stage component values R14 (1 kΩ) and R15 (10 kΩ).Figure 6
Investment stage.This is the last stage; therefore, pin 7 of the amplifiers, which corresponds to the system output, is connected to an analog input of the processor, which will be described later. The value of the voltage supplied by the source isVs=±9 V. To carry out the entire experimental procedure, use a voltage source that provides up to ±30 V and which was part of one of the practices carried out in the electronics subject of power. Finally, this will be replaced by a 9.6 V LiPo battery.


#### 3.1.3. Other Features

Once we have defined the system in charge of amplifying and processing the muscle signal, we will present some extra functionalities that have been added to have a complete device that meets all the requirements described above.(1) On/Off Switch. In order to start and end the data transmission, a switch has been arranged together with an operation indicator LED. For this, I have used a green LED, and as a switch, the chosen component has been a 2-position toggle switch. Next, show the design, in which we see that the switch is connected to 2 digital input pins of our Arduino board, in addition to being powered at +5 V. Toggle switch components with the values are R16 (1 kΩ), R17 (1 kΩ), and R18 (1 kΩ) (Figure 7).Figure 7
Toggle switch connection.(2) Bluetooth (Hardware). For the integration of a communication system via Bluetooth, I have used the HC-05 device, which is compatible with Arduino and has the following characteristics:
(i)
-Bluetooth protocol v1.1(ii)
2.4 GHz frequency(iii)
Class II transmission power (range 15-20 m)(iv)
It can be configured to work as a Master and also as a Slave(v)
1 Mbps transmission speedIt is a very economical solution with excellent features according to the objective for which it is used in this project. The connection is very simple, since you simply have to connect the pins: 5 V, GND, TX, and RX of the HC-05 to the corresponding ones in Arduino.(3) EMG Instruments. In our case, we have used AgCl electrodes because they are the ones that contribute less noise. In terms of shape and size, these sensors are usually rectangular, square, or circular; those used for this project have been circular, 20 mm in diameter [12]. Lastly, the placement (Figure 8) distance should be approximately 20 mm (measured distance between the centers of both sensors), and the placement is described below:
(i)
Sensor 1. Emitter placed in the center of the muscle being treated(ii)
Sensor 2. The emitter was placed at one end of the muscle under treatment(iii)
Sensor 3. GND is placed in another muscle to act as a reference and eliminate noiseFigure 8
Placement of electrodes [13].Another fundamental point is the cables. In order to use it with a breadboard, it needed a specific termination, and all the ones could find on the Internet using a JACK connector 3.5 mm. Ultimately, the solution was to cut off that terminal and add soldered male pins. The length of the cables is 50 cm each, enough to have good mobility while the pertinent tests are carried out.


### 3.2. Software Level

#### 3.2.1. ESP32 and Arduino NANO

In this section, we will describe the tools used to process the signal obtained by the hardware part and the different codes with which have programmed the system. First, enter to assess the processor. As already know, our device includes Bluetooth communication, which is why, in principle, we started working with the ESP32 board. One of the great advantages is that it already integrates Wi-Fi communication and Bluetooth. However, its main characteristics are as follows:(i)
The clock speed of 160–240 MHz(ii)
36 GPIO pins (general purpose input/output)(iii)
16 A/D converters with 12 bit resolution(iv)
2 D/A converters with 8 bit resolution(v)
2 serial ports(vi)
2 I2C channels(vii)
4 SPI channelsIn addition, it is compatible with the Arduino IDE; that is, by making a series of changes in the configuration of the Arduino platform, use the ESP32 board with the same user interface. However, once the processor was implanted with the rest of the components, the result was not what was expected [14]. Compared to some first tests carried out with Arduino UNO as a prototype, the graph’s resolution was worse and, above all, had many problems with the compilation and upload of the code to the board itself. This resulted in unreliable operation, such that sometimes it compiled fine and gave accurate operation. At the same time, the output was a constant that did not correspond to the actual output signal. As the system is simple and not too many connections to the processor are required, the chosen model is Arduino NANO. Its small dimensions allow a comfortable integration, and its main characteristics are shown as follows:
(i)
Microcontroller: ATMEGA328(ii)
Power supply 7–12 V(iii)
14 digital ports(iv)
8 analog ports(v)
16 KB RAM memory and 512 bytes of EPROM(vi)
Frequency: 16 MHzThe big drawback is that it lacks integrated Bluetooth on the board itself, so it is necessary to add a module capable of carrying out this function. We have discussed the chosen component in the previous chapter, the HC-05 (Figure9), whose characteristics have already been described [15]. Now all the components that will make the operation of our wearable electromyography device possible are defined. At first, I implanted the entire system on a protoboard and then, having checked the entire design, proceeded to solder the components again on Bakelite to remove the wiring and have a better-integrated system that can be seen below.Figure 9
Complete system with Arduino NANO and HC-05.It is necessary to have a code that correctly describes the actions that we want our device to carry out. To do this, the strategy was to program the actions independently, starting with the basic function that involves obtaining the electromyogram graph and continuing with programming the Bluetooth module and the switch. For a better understanding of each part, we are going to make an explanation of the most relevant:(i)
The first 2 paragraphs define the pins (input or output) to which the 2 positions of the switch, the LED, and the character “#” will correspond to create a string of the data obtained(ii)
In the loop, make the LED light up for position 1 of the switch and the data acquired by the system begins to print, thanks to the electrodes placed on the muscle. On the other hand, if the switch goes to position 2, that data printing stops, displaying the message “NOT CONNECTED”, and the LED turns off(iii)
In the serial event, define the communication with the HC-05 module for the use of BluetoothUp to this point, the entire operation of the system would be defined. The last thing left for us is to configure a receiver to have a wireless information transmission.


#### 3.2.2. Android APP

For the Bluetooth connection, a considerable number of applications are created with a general purpose that allows for carrying out a wide variety of functions. To test for the first time, the BT term APP was used, which offered the numerical data corresponding to the output signal. It is a good option to test the system, but our objective is to obtain a complete electromyogram. The tool used to create the application is APP INVENTOR22. It is a programming environment created by Google for developing Android applications. The programming system is done through blocks, which is intuitive and easy to use once you have a little practice [16].The created application is EMG BT, and its entire development is described below. We start by creating a variable that refers to the MAC address of the devices that will be connected via Bluetooth. The variable “SCALED” defines a 0 when starting the application, since otherwise, when taking data, it would be continuing from the last point written in the last connection; that is, it must start at 0 each time that starts a connection. We will also show a screen once we start the application, which defines a notice that will tell us that we must enable the Bluetooth function of our smartphone if it is disconnected. Also, with the delimiter, make a line break that will make it so that not all the data is on the same line. Let us create the option to add devices. What will do is fill the screen with the list of connected devices that exist in a range of 15 to 20 m (since our HC-05 module is class II). They will appear first with the MAC and then with the name they have associated. Once chosen, one of them will have the “CONNECT” button available that activates the Bluetooth connection by calling the MAC associated with the chosen device through a segment of 17 characters, which was the initial length defined for this variable in the first block. This is shown in the second block of the following image. Next, and once we have pressed the connect button, what will do is ask the program if the connection is already made; and if so, the option to “DISCONNECT” will appear on the central screen to be able to exchange the connection between devices.In the same way, disconnect the module, and the message will appear “CONNECT” since it can link to another one. To continue, we will define the function that will allow us to see the graph of the electromyogram. To do this, the first thing to do is define the variablesX0 and Y0. Adda+1to the variable in question so that the graph advances each clock cycle and shapes it, controlling the width and length it will have. But at some point, you will reach the end of the dedicated space, so you must clean the screen when you reach the far right of it and start over. That is what is shown in the block; once the variable X reaches the limit, delete everything graphed and make it start again, but following the same trend. Finally, it will associate each data received to a point on the graph. In our case, we can receive either numerical data or a text message if the switch activates the off function. We will ask if the data received includes the “#” symbol at the beginning; if it is not, we will simply have to display the message on the graph.This will have a lengthL, as shown as follows:
(1)L=numberofdigits+“#”,For example,(2)Length=3=55+“#”.We are taking each data as several characters so that if our electromyogram detects a signal with a value of 200, the APP will receive 4 characters and will have to subtract one from it. pass it to the graph. All this is controlled with the reading speed provided by the HC-05 module. All these blocks are what make up the program. The last thing to be done is to aesthetically configure the interface that will manage from the phone.As defined above, there is an “ADD DEVICES” button to choose the Bluetooth module you want to link in each case; with the “CONNECT” button, start the communication. The white box will be presented with the text messages, and the yellow box is the space dedicated to the graph.


## 3.1. Hardware Level

### 3.1.1. Critical Components

Our system consists of several basic stages studied during the degree and that will explain later. Therefore, it was very important to choose integrated circuits that offered many operational amplifiers with which to perform all the necessary functions.Finally, the following have been chosen:(i)
TL072: integrated circuit containing 2 TL072 operational amplifiers with JFET input and 8 pins(ii)
TL074: integrated circuit containing 4 TL074 operational amplifiers with JFET input and 14 pins(iii)
INA106: 8-pin precision differential amplifierThe rest of the components will be described in the sections dedicated to each of the stages.


### 3.1.2. System Stages

Next, present the phases that make up the system. General data of each one is included.(1) Acquisition Stage. Data collection, in our case, an analog signal, is differentially between the two electrodes (Figure 1) that collect the impulse generated by the muscles.Figure 1
Data acquisition stage.The amplifier used in this case is the INA106. Two of the three electrodes are connected to the amplifier inputs, and the last one goes to GND to act as a reference. Signal acquisition stage components R1 and R2 values are 1 MΩ.(2) Amplification Stage. The impulse emitted by the muscles is in the order of microvolts (Figure 2), so we need an amplification stage that allows us to work with a higher value signal to treat it more precisely.Figure 2
Amplification stage.In this case, use the TL074 component, whose pins 1, 2, and 3 correspond to the first amplifier included.(3) Filtering Stage (High-Pass Filter). It is responsible for the attenuation of the signal for low-frequency values, allowing only the passage for frequencies higher than its cut-off frequency. Since this is such a weak input signal, removing as much noise as possible is essential for a proper reading. The cut-off frequency is 106.1 Hz.Here, use the TL074, with its pins 5, 6, and 7 corresponding to the second amplifier (Figure3). The rest of the high-pass filter components with values are C1 (0.01 μF), R5 (150 kΩ), and R6 (15 0kΩ).Figure 3
High-pass filter.(4) Rectification Stage. It is a very important step since we will use the Arduino board to work the signal. This tool only converts positive signal levels to digital data with its analog/digital converter.The TL074 component uses the last two amplifiers corresponding to pins 8, 9, and 10 and 12, 13, and 14 (Figure4), respectively. Also, the rectification stage components have the values of R7 (10 kΩ), R8 (10 kΩ), R9 (10 kΩ), R10 (10 kΩ), R11 (10 kΩ), D1 (1N4148), and D2 (1N4148).Figure 4
Rectification stage.(5) Filtering Stage (Low-Pass Filter). With this filter, attenuate the frequencies that are above the cut-off strongly. As before, what we are looking for is to remove noise for better processing. Its cut-off frequency is 1974 Hz.Here, use the TL072 (Figure5) component and its pins 1, 2, and 3 that correspond to the first amplifier. Also, the low-pass filter components have the values C2 (1 μF), R12 (82 kΩ), and R13 (82 kΩ).Figure 5
Low-pass filter.(6) Investment Stage. This stage is an amplifier that inverts the gain value of the signal since the first amplifier had a negative gain, and with this phase, apply negative gain again.We use the last three pins 5, 6, and 7 of the TL072 amplifier (Figure6) with investment stage component values R14 (1 kΩ) and R15 (10 kΩ).Figure 6
Investment stage.This is the last stage; therefore, pin 7 of the amplifiers, which corresponds to the system output, is connected to an analog input of the processor, which will be described later. The value of the voltage supplied by the source isVs=±9 V. To carry out the entire experimental procedure, use a voltage source that provides up to ±30 V and which was part of one of the practices carried out in the electronics subject of power. Finally, this will be replaced by a 9.6 V LiPo battery.


### 3.1.3. Other Features

Once we have defined the system in charge of amplifying and processing the muscle signal, we will present some extra functionalities that have been added to have a complete device that meets all the requirements described above.(1) On/Off Switch. In order to start and end the data transmission, a switch has been arranged together with an operation indicator LED. For this, I have used a green LED, and as a switch, the chosen component has been a 2-position toggle switch. Next, show the design, in which we see that the switch is connected to 2 digital input pins of our Arduino board, in addition to being powered at +5 V. Toggle switch components with the values are R16 (1 kΩ), R17 (1 kΩ), and R18 (1 kΩ) (Figure 7).Figure 7
Toggle switch connection.(2) Bluetooth (Hardware). For the integration of a communication system via Bluetooth, I have used the HC-05 device, which is compatible with Arduino and has the following characteristics:
(i)
-Bluetooth protocol v1.1(ii)
2.4 GHz frequency(iii)
Class II transmission power (range 15-20 m)(iv)
It can be configured to work as a Master and also as a Slave(v)
1 Mbps transmission speedIt is a very economical solution with excellent features according to the objective for which it is used in this project. The connection is very simple, since you simply have to connect the pins: 5 V, GND, TX, and RX of the HC-05 to the corresponding ones in Arduino.(3) EMG Instruments. In our case, we have used AgCl electrodes because they are the ones that contribute less noise. In terms of shape and size, these sensors are usually rectangular, square, or circular; those used for this project have been circular, 20 mm in diameter [12]. Lastly, the placement (Figure 8) distance should be approximately 20 mm (measured distance between the centers of both sensors), and the placement is described below:
(i)
Sensor 1. Emitter placed in the center of the muscle being treated(ii)
Sensor 2. The emitter was placed at one end of the muscle under treatment(iii)
Sensor 3. GND is placed in another muscle to act as a reference and eliminate noiseFigure 8
Placement of electrodes [13].Another fundamental point is the cables. In order to use it with a breadboard, it needed a specific termination, and all the ones could find on the Internet using a JACK connector 3.5 mm. Ultimately, the solution was to cut off that terminal and add soldered male pins. The length of the cables is 50 cm each, enough to have good mobility while the pertinent tests are carried out.


## 3.1.1. Critical Components

Our system consists of several basic stages studied during the degree and that will explain later. Therefore, it was very important to choose integrated circuits that offered many operational amplifiers with which to perform all the necessary functions.Finally, the following have been chosen:(i)
TL072: integrated circuit containing 2 TL072 operational amplifiers with JFET input and 8 pins(ii)
TL074: integrated circuit containing 4 TL074 operational amplifiers with JFET input and 14 pins(iii)
INA106: 8-pin precision differential amplifierThe rest of the components will be described in the sections dedicated to each of the stages.


## 3.1.2. System Stages

Next, present the phases that make up the system. General data of each one is included.(1) Acquisition Stage. Data collection, in our case, an analog signal, is differentially between the two electrodes (Figure 1) that collect the impulse generated by the muscles.Figure 1
Data acquisition stage.The amplifier used in this case is the INA106. Two of the three electrodes are connected to the amplifier inputs, and the last one goes to GND to act as a reference. Signal acquisition stage components R1 and R2 values are 1 MΩ.(2) Amplification Stage. The impulse emitted by the muscles is in the order of microvolts (Figure 2), so we need an amplification stage that allows us to work with a higher value signal to treat it more precisely.Figure 2
Amplification stage.In this case, use the TL074 component, whose pins 1, 2, and 3 correspond to the first amplifier included.(3) Filtering Stage (High-Pass Filter). It is responsible for the attenuation of the signal for low-frequency values, allowing only the passage for frequencies higher than its cut-off frequency. Since this is such a weak input signal, removing as much noise as possible is essential for a proper reading. The cut-off frequency is 106.1 Hz.Here, use the TL074, with its pins 5, 6, and 7 corresponding to the second amplifier (Figure3). The rest of the high-pass filter components with values are C1 (0.01 μF), R5 (150 kΩ), and R6 (15 0kΩ).Figure 3
High-pass filter.(4) Rectification Stage. It is a very important step since we will use the Arduino board to work the signal. This tool only converts positive signal levels to digital data with its analog/digital converter.The TL074 component uses the last two amplifiers corresponding to pins 8, 9, and 10 and 12, 13, and 14 (Figure4), respectively. Also, the rectification stage components have the values of R7 (10 kΩ), R8 (10 kΩ), R9 (10 kΩ), R10 (10 kΩ), R11 (10 kΩ), D1 (1N4148), and D2 (1N4148).Figure 4
Rectification stage.(5) Filtering Stage (Low-Pass Filter). With this filter, attenuate the frequencies that are above the cut-off strongly. As before, what we are looking for is to remove noise for better processing. Its cut-off frequency is 1974 Hz.Here, use the TL072 (Figure5) component and its pins 1, 2, and 3 that correspond to the first amplifier. Also, the low-pass filter components have the values C2 (1 μF), R12 (82 kΩ), and R13 (82 kΩ).Figure 5
Low-pass filter.(6) Investment Stage. This stage is an amplifier that inverts the gain value of the signal since the first amplifier had a negative gain, and with this phase, apply negative gain again.We use the last three pins 5, 6, and 7 of the TL072 amplifier (Figure6) with investment stage component values R14 (1 kΩ) and R15 (10 kΩ).Figure 6
Investment stage.This is the last stage; therefore, pin 7 of the amplifiers, which corresponds to the system output, is connected to an analog input of the processor, which will be described later. The value of the voltage supplied by the source isVs=±9 V. To carry out the entire experimental procedure, use a voltage source that provides up to ±30 V and which was part of one of the practices carried out in the electronics subject of power. Finally, this will be replaced by a 9.6 V LiPo battery.


## 3.1.3. Other Features

Once we have defined the system in charge of amplifying and processing the muscle signal, we will present some extra functionalities that have been added to have a complete device that meets all the requirements described above.(1) On/Off Switch. In order to start and end the data transmission, a switch has been arranged together with an operation indicator LED. For this, I have used a green LED, and as a switch, the chosen component has been a 2-position toggle switch. Next, show the design, in which we see that the switch is connected to 2 digital input pins of our Arduino board, in addition to being powered at +5 V. Toggle switch components with the values are R16 (1 kΩ), R17 (1 kΩ), and R18 (1 kΩ) (Figure 7).Figure 7
Toggle switch connection.(2) Bluetooth (Hardware). For the integration of a communication system via Bluetooth, I have used the HC-05 device, which is compatible with Arduino and has the following characteristics:
(i)
-Bluetooth protocol v1.1(ii)
2.4 GHz frequency(iii)
Class II transmission power (range 15-20 m)(iv)
It can be configured to work as a Master and also as a Slave(v)
1 Mbps transmission speedIt is a very economical solution with excellent features according to the objective for which it is used in this project. The connection is very simple, since you simply have to connect the pins: 5 V, GND, TX, and RX of the HC-05 to the corresponding ones in Arduino.(3) EMG Instruments. In our case, we have used AgCl electrodes because they are the ones that contribute less noise. In terms of shape and size, these sensors are usually rectangular, square, or circular; those used for this project have been circular, 20 mm in diameter [12]. Lastly, the placement (Figure 8) distance should be approximately 20 mm (measured distance between the centers of both sensors), and the placement is described below:
(i)
Sensor 1. Emitter placed in the center of the muscle being treated(ii)
Sensor 2. The emitter was placed at one end of the muscle under treatment(iii)
Sensor 3. GND is placed in another muscle to act as a reference and eliminate noiseFigure 8
Placement of electrodes [13].Another fundamental point is the cables. In order to use it with a breadboard, it needed a specific termination, and all the ones could find on the Internet using a JACK connector 3.5 mm. Ultimately, the solution was to cut off that terminal and add soldered male pins. The length of the cables is 50 cm each, enough to have good mobility while the pertinent tests are carried out.


## 3.2. Software Level

### 3.2.1. ESP32 and Arduino NANO

In this section, we will describe the tools used to process the signal obtained by the hardware part and the different codes with which have programmed the system. First, enter to assess the processor. As already know, our device includes Bluetooth communication, which is why, in principle, we started working with the ESP32 board. One of the great advantages is that it already integrates Wi-Fi communication and Bluetooth. However, its main characteristics are as follows:(i)
The clock speed of 160–240 MHz(ii)
36 GPIO pins (general purpose input/output)(iii)
16 A/D converters with 12 bit resolution(iv)
2 D/A converters with 8 bit resolution(v)
2 serial ports(vi)
2 I2C channels(vii)
4 SPI channelsIn addition, it is compatible with the Arduino IDE; that is, by making a series of changes in the configuration of the Arduino platform, use the ESP32 board with the same user interface. However, once the processor was implanted with the rest of the components, the result was not what was expected [14]. Compared to some first tests carried out with Arduino UNO as a prototype, the graph’s resolution was worse and, above all, had many problems with the compilation and upload of the code to the board itself. This resulted in unreliable operation, such that sometimes it compiled fine and gave accurate operation. At the same time, the output was a constant that did not correspond to the actual output signal. As the system is simple and not too many connections to the processor are required, the chosen model is Arduino NANO. Its small dimensions allow a comfortable integration, and its main characteristics are shown as follows:
(i)
Microcontroller: ATMEGA328(ii)
Power supply 7–12 V(iii)
14 digital ports(iv)
8 analog ports(v)
16 KB RAM memory and 512 bytes of EPROM(vi)
Frequency: 16 MHzThe big drawback is that it lacks integrated Bluetooth on the board itself, so it is necessary to add a module capable of carrying out this function. We have discussed the chosen component in the previous chapter, the HC-05 (Figure9), whose characteristics have already been described [15]. Now all the components that will make the operation of our wearable electromyography device possible are defined. At first, I implanted the entire system on a protoboard and then, having checked the entire design, proceeded to solder the components again on Bakelite to remove the wiring and have a better-integrated system that can be seen below.Figure 9
Complete system with Arduino NANO and HC-05.It is necessary to have a code that correctly describes the actions that we want our device to carry out. To do this, the strategy was to program the actions independently, starting with the basic function that involves obtaining the electromyogram graph and continuing with programming the Bluetooth module and the switch. For a better understanding of each part, we are going to make an explanation of the most relevant:(i)
The first 2 paragraphs define the pins (input or output) to which the 2 positions of the switch, the LED, and the character “#” will correspond to create a string of the data obtained(ii)
In the loop, make the LED light up for position 1 of the switch and the data acquired by the system begins to print, thanks to the electrodes placed on the muscle. On the other hand, if the switch goes to position 2, that data printing stops, displaying the message “NOT CONNECTED”, and the LED turns off(iii)
In the serial event, define the communication with the HC-05 module for the use of BluetoothUp to this point, the entire operation of the system would be defined. The last thing left for us is to configure a receiver to have a wireless information transmission.


### 3.2.2. Android APP

For the Bluetooth connection, a considerable number of applications are created with a general purpose that allows for carrying out a wide variety of functions. To test for the first time, the BT term APP was used, which offered the numerical data corresponding to the output signal. It is a good option to test the system, but our objective is to obtain a complete electromyogram. The tool used to create the application is APP INVENTOR22. It is a programming environment created by Google for developing Android applications. The programming system is done through blocks, which is intuitive and easy to use once you have a little practice [16].The created application is EMG BT, and its entire development is described below. We start by creating a variable that refers to the MAC address of the devices that will be connected via Bluetooth. The variable “SCALED” defines a 0 when starting the application, since otherwise, when taking data, it would be continuing from the last point written in the last connection; that is, it must start at 0 each time that starts a connection. We will also show a screen once we start the application, which defines a notice that will tell us that we must enable the Bluetooth function of our smartphone if it is disconnected. Also, with the delimiter, make a line break that will make it so that not all the data is on the same line. Let us create the option to add devices. What will do is fill the screen with the list of connected devices that exist in a range of 15 to 20 m (since our HC-05 module is class II). They will appear first with the MAC and then with the name they have associated. Once chosen, one of them will have the “CONNECT” button available that activates the Bluetooth connection by calling the MAC associated with the chosen device through a segment of 17 characters, which was the initial length defined for this variable in the first block. This is shown in the second block of the following image. Next, and once we have pressed the connect button, what will do is ask the program if the connection is already made; and if so, the option to “DISCONNECT” will appear on the central screen to be able to exchange the connection between devices.In the same way, disconnect the module, and the message will appear “CONNECT” since it can link to another one. To continue, we will define the function that will allow us to see the graph of the electromyogram. To do this, the first thing to do is define the variablesX0 and Y0. Adda+1to the variable in question so that the graph advances each clock cycle and shapes it, controlling the width and length it will have. But at some point, you will reach the end of the dedicated space, so you must clean the screen when you reach the far right of it and start over. That is what is shown in the block; once the variable X reaches the limit, delete everything graphed and make it start again, but following the same trend. Finally, it will associate each data received to a point on the graph. In our case, we can receive either numerical data or a text message if the switch activates the off function. We will ask if the data received includes the “#” symbol at the beginning; if it is not, we will simply have to display the message on the graph.This will have a lengthL, as shown as follows:
(1)L=numberofdigits+“#”,For example,(2)Length=3=55+“#”.We are taking each data as several characters so that if our electromyogram detects a signal with a value of 200, the APP will receive 4 characters and will have to subtract one from it. pass it to the graph. All this is controlled with the reading speed provided by the HC-05 module. All these blocks are what make up the program. The last thing to be done is to aesthetically configure the interface that will manage from the phone.As defined above, there is an “ADD DEVICES” button to choose the Bluetooth module you want to link in each case; with the “CONNECT” button, start the communication. The white box will be presented with the text messages, and the yellow box is the space dedicated to the graph.


## 3.2.1. ESP32 and Arduino NANO

In this section, we will describe the tools used to process the signal obtained by the hardware part and the different codes with which have programmed the system. First, enter to assess the processor. As already know, our device includes Bluetooth communication, which is why, in principle, we started working with the ESP32 board. One of the great advantages is that it already integrates Wi-Fi communication and Bluetooth. However, its main characteristics are as follows:(i)
The clock speed of 160–240 MHz(ii)
36 GPIO pins (general purpose input/output)(iii)
16 A/D converters with 12 bit resolution(iv)
2 D/A converters with 8 bit resolution(v)
2 serial ports(vi)
2 I2C channels(vii)
4 SPI channelsIn addition, it is compatible with the Arduino IDE; that is, by making a series of changes in the configuration of the Arduino platform, use the ESP32 board with the same user interface. However, once the processor was implanted with the rest of the components, the result was not what was expected [14]. Compared to some first tests carried out with Arduino UNO as a prototype, the graph’s resolution was worse and, above all, had many problems with the compilation and upload of the code to the board itself. This resulted in unreliable operation, such that sometimes it compiled fine and gave accurate operation. At the same time, the output was a constant that did not correspond to the actual output signal. As the system is simple and not too many connections to the processor are required, the chosen model is Arduino NANO. Its small dimensions allow a comfortable integration, and its main characteristics are shown as follows:
(i)
Microcontroller: ATMEGA328(ii)
Power supply 7–12 V(iii)
14 digital ports(iv)
8 analog ports(v)
16 KB RAM memory and 512 bytes of EPROM(vi)
Frequency: 16 MHzThe big drawback is that it lacks integrated Bluetooth on the board itself, so it is necessary to add a module capable of carrying out this function. We have discussed the chosen component in the previous chapter, the HC-05 (Figure9), whose characteristics have already been described [15]. Now all the components that will make the operation of our wearable electromyography device possible are defined. At first, I implanted the entire system on a protoboard and then, having checked the entire design, proceeded to solder the components again on Bakelite to remove the wiring and have a better-integrated system that can be seen below.Figure 9
Complete system with Arduino NANO and HC-05.It is necessary to have a code that correctly describes the actions that we want our device to carry out. To do this, the strategy was to program the actions independently, starting with the basic function that involves obtaining the electromyogram graph and continuing with programming the Bluetooth module and the switch. For a better understanding of each part, we are going to make an explanation of the most relevant:(i)
The first 2 paragraphs define the pins (input or output) to which the 2 positions of the switch, the LED, and the character “#” will correspond to create a string of the data obtained(ii)
In the loop, make the LED light up for position 1 of the switch and the data acquired by the system begins to print, thanks to the electrodes placed on the muscle. On the other hand, if the switch goes to position 2, that data printing stops, displaying the message “NOT CONNECTED”, and the LED turns off(iii)
In the serial event, define the communication with the HC-05 module for the use of BluetoothUp to this point, the entire operation of the system would be defined. The last thing left for us is to configure a receiver to have a wireless information transmission.


## 3.2.2. Android APP

For the Bluetooth connection, a considerable number of applications are created with a general purpose that allows for carrying out a wide variety of functions. To test for the first time, the BT term APP was used, which offered the numerical data corresponding to the output signal. It is a good option to test the system, but our objective is to obtain a complete electromyogram. The tool used to create the application is APP INVENTOR22. It is a programming environment created by Google for developing Android applications. The programming system is done through blocks, which is intuitive and easy to use once you have a little practice [16].The created application is EMG BT, and its entire development is described below. We start by creating a variable that refers to the MAC address of the devices that will be connected via Bluetooth. The variable “SCALED” defines a 0 when starting the application, since otherwise, when taking data, it would be continuing from the last point written in the last connection; that is, it must start at 0 each time that starts a connection. We will also show a screen once we start the application, which defines a notice that will tell us that we must enable the Bluetooth function of our smartphone if it is disconnected. Also, with the delimiter, make a line break that will make it so that not all the data is on the same line. Let us create the option to add devices. What will do is fill the screen with the list of connected devices that exist in a range of 15 to 20 m (since our HC-05 module is class II). They will appear first with the MAC and then with the name they have associated. Once chosen, one of them will have the “CONNECT” button available that activates the Bluetooth connection by calling the MAC associated with the chosen device through a segment of 17 characters, which was the initial length defined for this variable in the first block. This is shown in the second block of the following image. Next, and once we have pressed the connect button, what will do is ask the program if the connection is already made; and if so, the option to “DISCONNECT” will appear on the central screen to be able to exchange the connection between devices.In the same way, disconnect the module, and the message will appear “CONNECT” since it can link to another one. To continue, we will define the function that will allow us to see the graph of the electromyogram. To do this, the first thing to do is define the variablesX0 and Y0. Adda+1to the variable in question so that the graph advances each clock cycle and shapes it, controlling the width and length it will have. But at some point, you will reach the end of the dedicated space, so you must clean the screen when you reach the far right of it and start over. That is what is shown in the block; once the variable X reaches the limit, delete everything graphed and make it start again, but following the same trend. Finally, it will associate each data received to a point on the graph. In our case, we can receive either numerical data or a text message if the switch activates the off function. We will ask if the data received includes the “#” symbol at the beginning; if it is not, we will simply have to display the message on the graph.This will have a lengthL, as shown as follows:
(1)L=numberofdigits+“#”,For example,(2)Length=3=55+“#”.We are taking each data as several characters so that if our electromyogram detects a signal with a value of 200, the APP will receive 4 characters and will have to subtract one from it. pass it to the graph. All this is controlled with the reading speed provided by the HC-05 module. All these blocks are what make up the program. The last thing to be done is to aesthetically configure the interface that will manage from the phone.As defined above, there is an “ADD DEVICES” button to choose the Bluetooth module you want to link in each case; with the “CONNECT” button, start the communication. The white box will be presented with the text messages, and the yellow box is the space dedicated to the graph.


## 4. Results and Discussion

The design is complete; now proceed to an analysis of the results obtained. The first thing I will do is describe what I expect to see. Grosso modo, I have said before that I can obtain 2 types of graphs from an electromyogram. The pure signal (Figure10) would show us a signal of the following style.Figure 10
EMG pure signal.The picture shows a reference voltage that is cantered at 2 V, and once the muscle contraction occurs, the amplitude increases. However, what to do in our device is obtain the second type of graph, the RMS value of the electromyogram signal, which gives us a clearer view of muscle effort. This image does not represent the RMS value of the pure graph above. It is just an example of seeing the voltage spikes during the movement. Depending on the treatment being followed, this tool can measure muscle fatigue, strength, etc., so the patient must perform specific movements for each case.Surface electromyography has certain important limitations to be aware of. Studies related to the reliability of this method focus on slow movements and controlled tasks. However, for more dynamic movements, there may be a change in the volume of the muscle and its displacement, which affects the relative position between electrodes, causing the intensity of the signal not to be recorded with great precision. Now that we know the expected result, let us see what gets with our system. In the first place, an image of the signal (Figure11) was obtained by means of the serial plotter of Arduino.Figure 11
EMG signal.As can be seen, the experimental result shows 4 contractions of the biceps muscle of the left arm. The contraction highlighted in red shows a prolonged effort, and the value progressively decreases due to muscle fatigue. The following figure shows a snapshot taken from a video explaining the operation, hence the low quality. We can see how the voltage increases as I flex my biceps.


## 5. Conclusion and Future Perspective

In conclusion, it can be seen throughout this TFG that electromyography is a very useful tool for diagnosing neuromuscular diseases because, with the appropriate technology, it allows for rapid action by the appropriate professionals. A device has been designed based on research and other systems that have already been created, resulting in a synthesis of knowledge and research that has allowed us to integrate various components with the ultimate goal of making our electromyography device effective in this work. What has been attempted is to integrate as much knowledge as possible gained during the course so that the research work is consistent and complete. Many enhancements have been implemented, particularly at the system software level, but my lack of solid programming knowledge has hindered me. Furthermore, it is important to note that for most of my years of study, my time has been divided between career and work, reducing the time that could be dedicated to the TFG. However, we believe that the result was positive, highlighting the following points:(i)
It has been possible to integrate the entire device in an arable way, making wireless communication possible between the instrument and other tools with a Bluetooth function(ii)
The results obtained and the shape of the graph, EMG envelope, are faithful to those obtained using other devices of higher quality and cost(iii)
One of the objectives of the work was to integrate the entire system while minimizing the cost. Many small- and medium-sized companies have to deal with a high cost to obtain this type of instrument, so this could be a good option if the entire design is improved and industrializedThe basis of electromyography hides a large number of possible future applications that are very interesting, mainly for the field of health. Currently, many prostheses for people who have lost some of their limbs due to illness, accident, etc., can be seen. Such prostheses usually have a fixed position. But thanks to electromyography, we can use the control of the signal originating from other muscles to move a motor in the prosthesis that allows us to perform daily movements. For example, imagine a person who has lost his forearm. A prosthesis could be designed using a 3D printer, placing servomotors at strategic points such as the wrist joint. Using pulses that activate the motor movement when another muscle, such as the biceps, contracts, it could be possible for a person who has lost a hand to reach for a glass of water or make a fist. Many independent developers have already been able to create devices of this type using this technology, but this practice may become more common in the future. Electromyography, on the other hand, supports the field of neurophysiology, a specialty that studies the nervous and muscular systems for the diagnosis and treatment of various ailments. With the advancement of EMG and the fusion of both sciences, the patient may be able to regain control of their movements and improve their quality of life through an advanced and comprehensive diagnosis. With physiotherapeutic advances, tests and results will be almost instantaneous, improving treatments for each case.



---

*Source: 5906815-2022-08-25.xml*