• No results found

Wireless electromyogram system

N/A
N/A
Protected

Academic year: 2022

Share "Wireless electromyogram system"

Copied!
77
0
0

Loading.... (view fulltext now)

Full text

(1)

IN

DEGREE PROJECT ELECTRONICS AND COMPUTER ENGINEERING,

FIRST CYCLE, 15 CREDITS STOCKHOLM SWEDEN 2020,

Wireless electromyogram system

ANDREAS DUNCA

QUOC HOANG ANH NGUYEN

KTH ROYAL INSTITUTE OF TECHNOLOGY

SCHOOL OF ELECTRICAL ENGINEERING AND COMPUTER SCIENCE

(2)

Wireless electromyogram system

Andreas Dunca

Quoc Hoang Anh Nguyen

8/25/2020

Bachelor’s thesis

Examiner Ana Rusu

Academic adviser/Supervisor Saul Rodriguez Duenas

KTH Royal Institute of Technology

School of Electrical Engineering and Computer Science (EECS) Department of integrated devices and circuits (EKT)

SE-100 44 Stockholm, Sweden

(3)
(4)

Abstract | i

Abstract

Venous thromboembolism (VTE) is one of the most common cardiovascular diseases. KTH and its academic and industrial partners intend to develop a system to combat VTE by forcing

movements of inactive muscles. An important part of this system is a unit that can sense muscular activity over time. Electromyography (EMG) is used to measure the activation potential of muscles.

The goal of this thesis is to develop an EMG device that can measure bioelectric signals and convey this data to other devices. This thesis is mainly an exploration to identify the potential solution and more work is needed to develop the required system. The EMG device must be small, modular, battery powered and be able to communicate wirelessly with other devices. A functioning EMG system requires an appropriate amplification for the result to be legible and requires extensive filtering as well as detailed circuit board design to eliminate noise or interference that can affect the result.

This project utilized a top down approach. An architecture of the EMG system was made and broken down into functional blocks. Each block was implemented separately and the whole solution was tested experimentally to ensure that all the specifications were fulfilled. To validate the EMG device, a series of reference images were used together with directly observing the correlation between muscle activation and its signal with an oscilloscope.

The result was a fully functional EMG device that consisted of two PCB: a PCB with EMG circuitry (analog circuit) and a PCB with digital processing for communication (digital circuit). The EMG results were consistent between test subjects and could easily be correlated to muscle

movement and force. The reference images indicated that it was functioning as intended. There was still 50 Hz common mode noise present in the EMG device which could have been due to its wide bandwidth and poor low frequency properties.

The goals and requirements were fulfilled: a fully functional wireless, modular, small and battery driven EMG device was developed. The noise level of the EMG could have been lower and would need some further improvements. An integrated battery could be implemented to eliminate the need for users to provide a battery. An app could be developed in tandem with the EMG device, with friendly user interface, for healthcare personnel.

The thesis workers strived to minimize the number of used components and power

consumption. All components were RoHS certified and discarded components were collected for proper waste management. Energy consumption could have been further minimized in the digital PCB by implementing sleep mode and a watchdog timer. This thesis strived to implement as much of the 17 global sustainability goals set by the United Nations (UN). In conclusion, the main sustainability goal of this thesis was “3 – Good Health and well-being”. Other sustainability goals were “12 – Responsible consumption and production”, “13 – Climate action”, “15 – Life on land”

were deemed to have been considered in this thesis.

Keywords

Venous thromboembolism, VTE prevention, Electromyogram, Embedded system, Muscle sensor

(5)
(6)

Sammanfattning | iii

Sammanfattning

Venös tromboemboli (VTE) är en av de vanligaste kardiovaskulära sjukdomarna. KTH och dess akademiska och industriella partner avser att utveckla ett system med uppdrag att bekämpa VTE genom att stimulera inaktiva muskler. Elektromyografi (EMG) används för att mäta musklernas aktiveringspotential. Syftet med denna avhandling är att utveckla en EMG-enhet som kan mäta bioelektriska signaler och överföra denna data till andra enheter. Ett fungerande EMG system kräver en lämplig förstärkning för att resultatet ska vara läsbart och kräver filtrering samt utförlig kretskortdesign för att eliminera brus/störningar som kan påverka resultatet negativt.

Projektet använde en Top-Down strategi. En arkitektur av EMG-systemet genomfördes och sedan delades upp i funktionella block. Varje block implementerades separat och hela lösningen testades experimentellt för att säkerställa att alla specifikationer uppfylldes. För att validera EMG- enheten användes referensbilder tillsammans med att direkt observera sambandet mellan

muskelaktivering och dess signal via ett oscilloskop.

Resultatet var en helt funktionell EMG-enhet som bestod av två PCB: en PCB med EMG

funktionalitet (analog krets) och en PCB med digital processering för kommunikation (digital krets).

EMG mätningarna var konsistenta mellan testpersoner och kunde lätt korreleras med

muskelrörelse och spänningskraft. Referensbilderna indikerade att den fungerade som avsedd. Det fanns fortfarande 50 Hz common mode brus i EMG-enheten, vilket kan ha orsakas av dess breda bandbredd och dåliga lågfrekvensegenskaper.

Målen och kraven uppfylldes: en fullt funktionell trådlös, modulär, liten och batteridriven EMG- enhet. Brusnivån för EMG kunde ha varit lägre och skulle behöva ytterligare förbättringar. Ett integrerat batteri kunde implementeras för att eliminera användarnas behov av att tillhandahålla ett batteri. En applikation kunde ha utvecklats för EMG-enheten, med ett användarvänligt

användargränssnitt, för vårdpersonal.

Examensarbetarna strävade efter att minimera användning av komponenter och

strömförbrukning under arbetsprocessen. Alla komponenter var RoHS-certifierade och kasserade komponenter insamlades för korrekt avfallshantering. Energiförbrukning kunde ha minimerats ytterligare i det digitala kretskortet genom att implementera sleep mode och en watchdog timer. I detta examensarbete var det önskvärt att implemnetera de 17 globala hållbarhetsmålen uppsatta av FN (Förenta Nationerna). Sammanfattningsvis uppfylldes huvudsakligen “3 – Good Health and well-being”. Hållbarhetsmålen ”12 - Ansvarig konsumtion och produktion”, ”13 – Klimatåtgärder”,

”15 - Liv på land” anses även att ha beaktas i denna avhandling.

Nyckelord

Venös tromboemboli, Förebygga VTE, Elektromyografi, Inbyggda system, Muskelsensor

(7)
(8)

Acknowledgments | v

Acknowledgments

We would like to acknowledge Saul Rodriguez Duenas for providing us with this project and for supervising us (throughly). Saul has been a great mentor that has been both reliable and cunning.

Further appreciation goes to PhD Alejandro Fernandez Schrunder who helped a great deal when debugging the first PCB made.

Muchas gracias!

And to Yu-Kai Huang who always lent a helping hand and a friendly face.

謝謝!

We acknowledge Ana Rusu for allowing us to partake in this important and exciting project.

Mulțumesc!

Samt till alla goda klasskamrater från TIEDB vill vi tacka er för erat stöd genom åren!

Tack!

Yep, a whole lot of people allowed this thesis to happen and we are grateful to you all.

Thank you!

Engineers stick together!

Stockholm, July 2020

Andreas Dunca & Quoc Nguyen

(9)
(10)

Table of contents | vii

Table of contents

Abstract ... i

Keywords ... i

Sammanfattning ... iii

Nyckelord ... iii

Acknowledgments ... v

Table of contents ... vii

List of Figures ... ix

List of Tables ... xi

List of acronyms and abbreviations ... xiii

1 Introduction ... 1

1.1 Background ... 1

1.2 Problem ... 2

1.3 Purpose ... 2

1.4 Goals ... 2

1.5 Research Methodology ... 2

1.6 Delimitations ... 2

1.7 Structure of the thesis ... 3

2 Background ... 5

2.1 Electromyography ... 5

2.1.1 Muscle Architecture ... 5

2.1.2 EMG Electrodes and placement ... 5

2.1.3 EMG signal ... 6

2.1.4 EMG signal acquisition ... 6

2.1.5 Amplification ... 7

2.1.6 Filtering ... 7

2.1.7 Full wave rectifier ... 9

2.1.8 Integrator ... 10

2.2 Related work ... 10

2.2.1 Electromyography for robot prosthesis ... 10

2.2.2 Electromyography for rehabilitation ... 11

2.2.3 Precision rectifiers ... 11

2.3 Summary ... 11

3 Method ... 13

3.1 Research Process ... 13

3.2 Research Paradigm ... 14

3.3 Data Collection ... 14

3.3.1 Sample Size ... 14

3.3.2 Target Population ... 14

3.4 Planned Measurements ... 14

3.4.1 Test environment ... 14

3.4.2 Hardware/Software used ... 15

3.5 Assessing reliability and validity of the data collected ... 15

3.5.1 Reliability ... 15

3.5.2 Validity ... 15

(11)

3.6 Planned Data Analysis ... 15

3.6.1 Data Analysis Technique ... 15

3.6.2 Software Tools ... 16

3.7 Evaluation framework ... 16

3.8 Sustainability ... 16

4 EMG system ... 19

4.1 Research stage ... 19

4.1.1 Detection ... 20

4.1.2 Analog front end ... 20

4.1.3 Processing ... 21

4.1.4 Essential parameters ... 21

4.1.5 Hardware components ... 22

4.2 Simulation stage ... 23

4.3 Design stage ... 26

4.3.1 Hardware block diagram ... 26

4.3.2 Schematic ... 27

4.3.3 PCB design ... 28

4.4 Programming stage... 31

4.4.1 Software flow chart ... 32

4.5 Testing ... 33

4.5.1 Hardware ... 33

4.5.2 Software ... 35

5 Results and Analysis ... 37

5.1 EMG device ... 37

5.2 EMG measurement result ... 38

5.2.1 EMG muscle measurements ... 39

5.2.2 EMG noise measurements ... 42

5.2.3 EMG noise measurements breadboard ... 48

5.3 Reliability Analysis... 50

5.4 Validity Analysis ... 50

5.5 Discussion ... 50

6 Conclusions and Future work ... 53

6.1 Conclusions ... 53

6.2 Limitations ... 54

6.3 Future work ... 54

6.4 Reflections upon sustainability ... 55

References ... 57

(12)

List of Figures | ix

List of Figures

Figure 1.1 - Simplified overview of the EMG system. ... 1

Figure 2.1 - Instrumentation Amplifier ... 6

Figure 2.2 - Non-Inverting Operational Amplifier ... 7

Figure 2.3 - 2nd Order High Pass Filter... 8

Figure 2.4 - 2nd Order Low Pass Filter ... 8

Figure 2.5 - Inverting Band Pass Filter... 9

Figure 2.6 - Full Wave Rectifier ... 9

Figure 2.7 - Integrator... 10

Figure 3.1 - Research process, top down approach ... 13

Figure 4.1 - Project overview – development of EMG system ... 19

Figure 4.2 - EMG system overview ... 19

Figure 4.3 - Amplification & Filtering step ... 20

Figure 4.4 - Final circuit ... 23

Figure 4.5 - Final circuit simulation result... 24

Figure 4.6 - Making AD623 IA component in QUCS-S ... 24

Figure 4.7 - Simulating component circuit ... 25

Figure 4.8 - Simulating component in final circuit ... 26

Figure 4.9 - Hardware block diagram of EMG system ... 26

Figure 4.10 - Digital circuit ... 27

Figure 4.11 - Analog circuit ... 28

Figure 4.12 - Analog circuit PCB without copper pour ... 29

Figure 4.13 - Analog circuit PCB with copper pour ... 29

Figure 4.14 - Analog circuit PCB 3D view ... 30

Figure 4.15 - Digital circuit PCB without copper pour ... 30

Figure 4.16 - Digital circuit PCB with copper pour ... 31

Figure 4.17 - Digital circuit PCB 3D view ... 31

Figure 4.18 - Software flowchart ... 32

Figure 4.19 - TDD for hardware ... 34

Figure 4.20 - TDD tests and order for each stage in the analog PCB ... 34

Figure 5.1 - Digital circuit PCB ... 37

Figure 5.2 - Analog circuit PCB ... 37

Figure 5.3 - Stacked EMG system with Bluetooth module... 37

Figure 5.4 - Final EMG system with Electrodes ... 38

Figure 5.5 - EMG measurement from analog PCB sent to KTH-logger via the digital PCB. ... 38

Figure 5.6 - Test subject 1 <Biceps>: blue graph integrator, red graph rectifier... 39

Figure 5.7 - Test subject 1 <Calf>: blue graph integrator, red graph rectifier ... 39

Figure 5.8 - Test subject 1 <Biceps>: blue graph rectifier, red graph filter ... 40

Figure 5.9 - Test subject 1 <Calf>: blue graph rectifier, red graph filter ... 40

Figure 5.10 - Test subject 2 <Biceps>: blue graph integrator, red graph rectifier ... 41

Figure 5.11 - Test subject 2 <Calf>: blue graph integrator, red graph rectifier ... 41

Figure 5.12 - Test subject 2 <Biceps>: blue graph rectifier, red graph filter ... 42

Figure 5.13 - Test subject 2 <Calf>: blue graph rectifier, red graph filter ... 42

Figure 5.14 - Test subject 1 <Biceps><Noise>: blue graph integrator, red graph rectifier ... 43

Figure 5.15 - Test subject 1 <Calf><Noise>: blue graph integrator, red graph rectifier ... 43

Figure 5.16 - Test subject 1 <Biceps><Noise>: blue graph rectifier, red graph filter ... 44

Figure 5.17 - Test subject 1 <Calf><Noise>: blue graph rectifier, red graph filter ... 44

Figure 5.18 - Test subject 1 <Biceps><Noise>: blue graph filter, red graph IA ... 45

(13)

Figure 5.19 - Test subject 1 <Calf><Noise>: blue graph filter, red graph IA ... 45

Figure 5.20 - Test subject 2 <Biceps><Noise>: blue graph integrator, red graph rectifier ... 46

Figure 5.21 - Test subject 2 <Calf><Noise>: blue graph integrator, red graph rectifier ... 46

Figure 5.22 - Test subject 2 <Biceps><Noise>: blue graph rectifier, red graph filter ... 47

Figure 5.23 - Test subject 2 <Calf><Noise>: blue graph rectifier, red graph filter ... 47

Figure 5.24 - Test subject 2 <Biceps><Noise>: blue graph filter, red graph IA ... 48

Figure 5.25 - Test subject 2 <Calf><Noise>: blue graph filter, red graph IA ... 48

Figure 5.26 - Test subject 2 with breadboard <Biceps><Noise>: blue graph integrator, red graph rectifier ... 49

Figure 5.27 - Test subject 2 with breadboard <Biceps><Noise>: blue graph rectifier, red graph filter ... 49

Figure 5.28 - Test subject 2 with breadboard <Biceps><Noise>: blue graph filter, red graph IA ... 49

(14)

List of Tables | xi

List of Tables

Table 4-1. Important parameters used in the EMG system ... 21

Table 4-2. Component overview and description ... 22

Table 4-3. AT commands for EMG system ... 33

Table 5-1. Noise measurement summary in ACrms ... 43

Table 5-2. EMG noise measurement summary of breadboard implemented circuit ... 48

(15)
(16)

List of acronyms and abbreviations | xiii

List of acronyms and abbreviations

AC Alternating current

ADC Analog-to-Digital converter

AT Hayes command set

C Capacitor

CMRR Common mode rejection ratio CNS Central nervous system

DC Direct current

EEE Electronics and Electrical Equipment EMC Electromagnetic compatibility

EMG Electromyograph

EMI Electromagnetic interference

EU European Union

GBP Sufficient gain bandwidth IA Instrumentation amplifier

Ib Input bias

IC Integrated circuit

LDO Low dropout

MCU Microcontroller unit Op-Amp Operational amplifier PCB Printed circuit board PSRR Power supply rejection ratio

R Resistor

REM RMS

Rare earth metal Root mean square

RoHS Restriction of Hazardous Substances

RX Receiver

TDD Test driven development

TX Transmitter

UART Universal Asynchronous Receiver/Transmitter

UN The United Nations

VTE Venous thromboembolism

WEEE Waste of Electronics and Electrical Equipment

(17)
(18)

Introduction | 1

1 Introduction

This chapter introduces the subject of this thesis, its goals and the outline structure of this report.

1.1 Background

KTH and its academic and industrial partners are currently working on a device that can prevent venous thromboembolism (VTE) in the legs. VTE causes blood clots to form in the veins, which can spread to the rest of the human body [1]. Bedridden patients consequently have a higher risk of developing blood clots due to poor blood circulation [1]. The device is meant to monitor a bedridden patient’s muscle activity and force muscle movement when they have been idle for a longer period of time. In this way blood circulation is improved and the risk of blood clots considerably lowered. The device could also be used alert health care personnel that action is required to prevent VTE.

An electromyograph (EMG) is a device that measures bioelectric potentials of muscles [2]. A motor unit is the connection between a motor neuron and muscle fiber which enables muscles to move by electrical impulses, transmitted by the brain through the central nervous system (CNS) [2].

Bioelectric potential is a generic term for all types of electric potential of the human body and other organisms. When the electrical potential is that of a muscle it is called a myoelectric (myo Greek. - muscle) activation potential [2]. This activation potential is what the EMG measures. EMG systems can be divided into three parts (see figure 1.1) [2]: detection, amplification and processing, which is how the EMG device in this thesis is structured.

Detection consists of electrodes that conducts bioelectric signals. There are different electrode configurations and electrode types to measure bio potentials and in this project three electrodes are needed in order to detect myoelectric signals: a positive, a negative and a reference which are placed strategically along the measured muscle.

Amplification is required to increase the strength of the detected signal in order to process it, since myoelectric signals are extremely weak; about 1 - 10mV (peak-to-peak) depending on the muscle [2]. Amplification is implemented through operational amplifiers (Op-Amp), commonly used in different configurations to mostly increase strength of a signal but also to stabilize it through negative feedback. This amplification needs to be around 1000-10000 times in order to be

processed [2]. Furthermore, to increase the quality or resolution of these signals, analog filters are required. The function of filters is to block or attenuate certain frequencies, particularly 50 Hz common mode noise for EMG systems, and can greatly improve the quality of the measured signals.

After amplification, the signal is processed by digital circuitry; a microcontroller that converts analog data to digital data and that conveys information to other devices. In this project the

Figure 1.1 - Simplified overview of the EMG system.

(19)

2 | Introduction

EMG system data is sent to a mobile app via a wireless Bluetooth connection which is used as an example in figure 1.1.

The purpose of this thesis is to develop an EMG device that can monitor muscle activity and display this data to another device.

1.2 Problem

Detecting myoelectric signals requires a suitable amount of amplification. Exceedingly high gain would saturate the signal and insufficient gain would make it indistinguishable from noise. In all electrical systems some level of interference and noise is always present. Filtering out noise and reducing interference is crucial to acquire a legible signal especially for a circuit with high amplification. Careful design of the EMG’s printed circuit board (PCB) layout must be taken into consideration to ensure minimal interference. Furthermore, the electrodes in the EMG system needs to be placed correctly in order to get proper measurements. The EMG device needs to be modular, portable and wireless, since it is going to be used in a clinical environment.

In this thesis we will explore the possibility of creating a small, wireless and battery driven device that can measure and process myoelectric signals.

1.3 Purpose

The prototype developed in this thesis will aid medical research in prevention of VTE and will be used to measure myoelectric activity of muscles.

1.4 Goals

The goal was to develop a fully functional battery-operated EMG system that can measure myoelectric signals and send the measured data over a Bluetooth connection to other devices.

Furthermore, the EMG device was required to be modular, small, battery driven and wireless.

1.5 Research Methodology

This thesis is performed by using quantitative research paradigm methods which were

experimental. A top down structure was implemented for this project. An architecture of the EMG system was made and broken down into functional blocks. Each block was implemented separately and the whole solution was tested experimentally to validate that all the specifications were fulfilled.

1.6 Delimitations

An integrated battery in the EMG device was delimited since the time frame for the projects was limited. An external powerbank and a micro USB connector were chosen to power the device.

Communication via Wi-Fi between the EMG device and KTH-logger was not implemented because of its complexity in relation to Bluetooth communication. Furthermore, no software applications (apps) were developed, primarily because there was already an app, KTH-logger developed by Saul Rodriguez Duenas (the supervisor) that were made for EMG purposes but also due to a lack of experience in app development.

Detailed sensor performance in terms of sensor characteristics was deemed to be outside the scope of this thesis and was only discussed in terms of observed noise present in the EMG device.

(20)

| 3

3 1.7 Structure of the thesis

Section 1 introduces the subject of this thesis. It describes the background, problem, purpose, delimitation, and goals of this thesis.

Section 2 presents detailed background information related to EMG and its concepts such as filtering, amplification, types of electrodes and common EMG configurations.

Section 3 presents this thesis research methodology in detail and what work structure and project method has been used to implement the project. It also presents sustainability goals and

considerations for this project.

Section 4 presents the project itself: project method, hardware design, project architecture, software, schematics, simulations, PCB design and testing.

Section 5 presents and discusses the result of this thesis and analyses validity and reliability.

Section 6 presents a conclusion to the project and showcases the final estimation of the project in terms of the experience gained in the project, goals set out for the project, future prospects and sustainability.

(21)
(22)

Background | 5

2 Background

This chapter provides a detailed background about electromyography and related topics. Section 2.1 describes the structure of an EMG system, its components and working principles. It also explains basic anatomy in relation to EMG. Section 2.2 describes related work used as guidelines in this project.

2.1 Electromyography

Electromyography (EMG) is a medical diagnostic technique which deals with the measurement and analysis of the electric potential produced during the communication between the brain and the muscles through the Central Nervous System (CNS) [2]. EMG is used to detect these activation potentials. The instrument used to capture the myoelectric signals is known as an electromyograph (EMG) and the analyzed result is called an electromyogram. Electromyography is usually used in healthcare as a medical tool for assessment of patients with neuromuscular diseases and disorders of motor control [3].

2.1.1 Muscle Architecture

When a person activates a muscle, the brain sends a bioelectric signal through the central nervous system to a motor [2]. A motor unit is a meeting point where a motor neuron associates with a skeletal muscle [4]. A skeletal muscle is attached to the bone and is responsible for the movement of bones [5]. At the motor neuron a small electrical potential is generated, a myoelectric potential [4].

The myoelectric potential persists as long as the muscle is required to work [4]. If the muscles are required to generate greater force, then more motor units will be activated and results in higher EMG signal amplitudes [4].

2.1.2 EMG Electrodes and placement

The electrodes used in this project were gelled electrodes. Gelled electrodes contain a composite of Silver–Silver chloride (Ag-AgCl) which is an electrolytic substance that conducts electrons between electrodes and the skin [2]. Disposable gelled EMG electrodes are most common, but reusable gelled electrodes are available as well [2]. For measurements with gelled electrodes there are some skin preparations required as there must be good contact between the gel and the skin surface.

Common preparations is to wipe the skin with abrasive and alcohol-based wipes to remove dead skin and remove excess moisture [2].

The 3-electrodes configuration[2] was utilized in this project. The 3-electrodes configuration consists of one positive, one negative and one reference electrode. The positive and negative

electrodes are placed apart from each other which results in a differential potential. This potential is what is measured in an EMG device [2]. The reference electrode sets the common mode voltage for the differential measurement and it typically carries a common-mode feedback component that attempts to attenuate or cancel low frequency common-mode noise. The negative and positive electrodes should be place 1-2 cm from each other along the length of the muscle fibers [2]. To acquire the best possible signal, the “belly” of the muscle usually is the best place to attach the electrodes, midway up the muscle, as there’s a high density of muscle fibers [2, 6]. The reference electrode is placed in a neutral zone such as the tendons, far away from the other two electrodes not to interfere with the signals [7].

(23)

6 | Background

2.1.3 EMG signal

The myoelectric signals are extremely low; around 1 mV - 10 mV (peak-to-peak) depending on the muscle, operational amplifiers are needed to increase the strength of signals [2]. Since the signals are considerably weak, the amplification needs to be hundreds of times. The myoelectric signals lie between 0-500 Hz but are dominant around 50-150 Hz. Analog filters are implemented to increase the quality of these signals. The function of filters is to block or attenuate certain frequencies, particularly 50 Hz noise from AC power sources. Furthermore, there is noise caused from other sources: from the interface between electrodes and the skin, from movement of electrode’s cable connecting to the amplifier, from components, from PCB layout amongst other. Proper design of the electronic circuitry can attenuate this noise. The myoelectric signal acquired by the electrodes needs to be processed in various steps before it can be used in a microcontroller unit (MCU). The signal needs to be detected, amplified, filtered, rectified and integrated.

2.1.4 EMG signal acquisition

EMG system use differential amplification to acquire electrical signals [2]. It often contains an instrumentation amplifier (IA)(figure 2.1) for high input impedance and high common mode rejection ratio (CMMR). Common mode rejection ratio (CMRR) measures how well a operational amplifier (op amp) can reject noise present on both inputs [8]. The gain and output voltage of an instrumentation amplifier can be expressed by:

𝐺𝑎𝑖𝑛 = (1 +2𝑅2

𝑅1) ×𝑅4

𝑅3

(1)

𝑉𝑜𝑢𝑡 = (𝑉2− 𝑉1) × 𝐺𝑎𝑖𝑛 (2)

The values of R3 and R4 are usually set to be equal since high gain on the second stage gain is likely to amplify noise.

Figure 2.1 - Instrumentation Amplifier

(24)

| 7

7 2.1.5 Amplification

The next step is amplification. Myoelectric signals must be amplified up to a suitable level for analysis and further processing. Figure 2.2 is an example of a non-inverting amplifier. The input signal is applied directly to the non-inverting (+) terminal which would give a positive gain, as opposed to an inverting op amp that gives a negative gain, meaning that the input signal won’t be inverted on the output. The gain of a non-inverting op amp is determined by equation 3. The feedback loop with the Rf – R2 voltage divider network applies a small part of the output back to the inverting (-) terminal which stabilizes the output considerably. Technically, an op-amp amplifies the difference in voltage between the two input terminals [9].

𝐺𝑎𝑖𝑛 = 1 + 𝑅𝑓

𝑅2 (3)

2.1.6 Filtering

Filtering is a way to attenuate certain frequencies. In an EMG system filters are used to remove high and low frequency components that occur due to capacitive coupling, inductive coupling and electromagnetic interference (EMI). It’s possible to implement filtering with Op-Amps, which gives better filtering quality and enables the possibility of amplification. These filters are called Active filters or active Op-Amp filters. A filter can also have a certain order which is a number that identifies to what degree a filter attenuates a signal and is measured in dB/decade. There are three distinct filter types that are widely used:

• High pass filter

The high pass filter only allows frequencies above the threshold or cut-off frequency (fc) to pass through, whereas frequencies below fc, low frequency noise, is attenuated. A simple high pass filter, also known as a CR circuit, is made by using a capacitor and a resistor [10].

A CR filter is a first order filter and attenuates 20dB/decade and for such a filter the cut-off frequency can be found 3dB from its maximum gain. Second order filters attenuate signals with 40 dB/decade compared to a simple CR circuit that attenuates 20 dB/decade [11]. This means that second order filters will suppress noise better. The cut-off frequency for a 2nd order high pass filter is determined by equation 4, where in this thesis R1=R2 and C1=C2 which is also equal to the equation for first order high pass filters. In this thesis a 2nd order active high pass filter was used to attenuate frequencies below 15 Hz. The Op-Amp

configuration in figure 2.3 does not provide any gain and therefore the inverting input (- sign) is connected to the output of the Op-Amp, a negative feedback that stabilizes the output.

Figure 2.2 - Non-Inverting Operational Amplifier

(25)

8 | Background

• Low pass filter

Low pass filters “pass” frequencies below fc and attenuates frequencies above fc. Common first order low pass filters consist of a resistor and a capacitor and known as RC circuit [12].

An RC filter is a first order filter that attenuates 20dB/decade and for such a filter the cut- off frequency can be found 3dB from its maximum gain. In this thesis a 2nd order active low pass filter (figure 2.4) was used to attenuate noise above 723 Hz. As with 2nd order high pass filters, it attenuates frequencies above fc with 40 dB/decade and does not provide any gain to the circuit as the output is connected to the inverting input of the Op-Amp. The cut-off frequency of 2nd order low pass filter can also be determined by equation 4 and as with the 2nd order high pass filter the values were set( R1=R2, C1 = C2) so that equation 4 would be simplified. The simplified equation is the same for calculating the cut-off frequency of first order low pass filters.

• Band pass filter

A band pass filter (figure 2.5) is a combination of a high pass filter and a low pass filter. The filter has two cut-off frequencies, one for lower frequencies and one for higher frequencies.

The band pass filter allows frequencies in the pass band to have high gain and outside the pass band to be attenuated. The width of the pass band is referred to as the bandwidth; a high bandwidth passes a greater range of frequencies and a small bandwidth only allows few frequencies to pass [13]. The cut-off frequencies are determined by the RC pair (see equation in 6 and 7). In this thesis a first order active inverting bandpass filter was used to

𝑓𝑐= 1

2𝜋√𝑅1𝑅2𝐶1𝐶2

(4)

Figure 2.4 - 2nd Order Low Pass Filter Figure 2.3 - 2nd Order High Pass Filter

(26)

| 9

9 apply gain and attenuate frequencies below 15 Hz and above 723 Hz. By choosing resistors R1 and R2 (see equation 5) the gain was set to 22 linear scale and cut-off set by using the equation for fc1 and fc2. Furthermore, the inverting bandpass in 2.8 inverts the input signal resulting in a negative gain on the output, which was an important factor in the EMG circuit.

𝐺𝑎𝑖𝑛 = −𝑅2 𝑅1

(5)

𝑓𝑐1= 1 2𝜋𝑅1𝐶1

(6)

𝑓𝑐2= 1 2𝜋𝑅2𝐶2

(7)

2.1.7 Full wave rectifier

A rectifier is a circuit that converts alternating current (AC) into direct current (DC) by inverting either positive or negative waveforms depending on application [14]. In figure 2.6 a sinusoidal signal (AC) enters the rectifier which results in an output signal which has inverted half cycles. The result is a positive signal or current that does not alternate i.e. a DC current. A rectifier often consists of diodes with the ability to conduct electricity in one direction. Through diodes, the rectifier is able to convert negative AC waveforms into one-way DC [14]. The full wave rectifier converts both positive half cycles and negative half cycles of AC, which means that the full wave

Figure 2.5 - Inverting Band Pass Filter

Figure 2.6 - Full Wave Rectifier

(27)

10 | Background

rectifier converts the whole full cycle of AC to DC, which also improves the signal [14]. In figure 2.6 the direction of the diodes determine which half cycles are rectified; reverting the direction of the diodes in figure 2.6 would result in a negative output signal.

2.1.8 Integrator

An integrator (figure 2.7) is a circuit that performs integration: The output is the integration of the input over a set amount of time. An integrator circuit consists of both passive and active

components. The purpose of the integrator is summing the infinitely small quantities in the waveform signal over a period of time and is in this thesis used in tandem with a full wave rectifier to create a stable and legible DC signal [15]. An extra resistor, R2, added to provide gain as shown in figure 2.7.

2.2 Related work

There were two major work publications used in this project, “Signal Acquisition Using Surface EMG and Circuit Design Considerations for Robotic Prosthesis” [2] and “Movement control and non-invasive electromyography: project CoMES” by Roberto Merletti ” [16], and one minor related work article, ”Precision rectifiers” [14], which provided a basis to develop the EMG system.

2.2.1 Electromyography for robot prosthesis

The main source of information to this project was “Signal Acquisition Using Surface EMG and Circuit Design Considerations for Robotic Prosthesis” by Muhammad Zahak Jamal [2]. This publication together with information given by the supervisor has been the basis of the project. It showcased the very basics of EMG and developing an EMG system and taught the basics of related EMG topics such as anatomy of muscles and bioelectricity in the muscles. The most important information from this publication was regarding the circuitry needed to develop an EMG system;

what type of amplification configurations, amplification and signal filtering strategies required.

Other important aspects were information about electrodes and its optimal placements for

measurements. It gave a good overview of what types of electrodes existed, with its advantages and disadvantages. This publication was also used as a basis for the background information in section 2.

Figure 2.7 - Integrator

(28)

| 11

11 2.2.2 Electromyography for rehabilitation

PhD thesis and presentation “Movement control and non-invasive electromyography: project CoMES” by Roberto Merletti [16] was a series of educational slides(and documents) showcasing detailed principles of an EMG system related to rehabilitation of muscles. Its focus was on reading data from one or several sources, with focus on signal conditioning, general EMG principles, sampling, surface electrodes and its repercussions. This source was provided by the supervisor and has been of great help in terms of understanding EMG systems in general and more profoundly. It was especially useful regarding signal conditioning and noise considerations and which frequencies to filter. The main contribution this publication had was the reference images used to validify the EMG system.

2.2.3 Precision rectifiers

“Precision Rectifiers” by Rod Elliott [14] on the site “ESP” showcased several useful rectifying circuits essential for the project’s EMG functionality, to rectify the signals in order to integrate them.

2.3 Summary

The most important aspects for an EMG system can be concluded into the following main areas:

• Electrodes – there are several types of electrodes, but surface electrodes are most commonly used. Surface electrodes are optimal since they are noninvasive but as consequence need proper preparation and placement to prevent signal interference and ensure proper contact.

• Amplification and filtering – Myoelectric signals have a low potential, 1-10mV, and require high gain in order to be processed further. Operational amplifiers (Op-Amps) are used to amplify signals and there are many types of op amp configurations. In an electrical system there is bound to be distortions in the signals dude to different types of interference (noise).

To reduce interference filters are commonly used. There are two distinct types of filters: low pass and high pass. Second order filters attenuate unwanted frequencies with 40 dB/decade rather than 20db/decade. An Instrumentation amplifier reduces common noise, noise present on both electrodes simultaneously. Active band pass filter is a configuration that passes signals within a certain bandwidth and it is a combination of both low pass and high pass filter. In this way the noise in the signals is reduced and also amplified to a compatible level for digital components.

• Muscle physiology – muscle fiber orientation determines where electrodes should be placed depending on muscles since the direction of the electrical impulses are parallel to the muscle fibers. Each muscle fiber has a motor unit and these motor units act collectively in what is called the innervation zone. In order to get proper values, the electrodes need to be placed above this zone.

Two major publications and one minor were used as a resource for this project. The two major publications greatly provided both detailed and general information about EMG systems, what circuitry to include, how to improve signal quality, what frequencies to filter, what gain to have in the circuit, which type of electrodes to use and how to place these electrodes for proper signal acquisition. The minor related work article provided information about rectifiers.

(29)
(30)

Method | 13

3 Method

The purpose of this chapter is to provide an overview of the research method used in this thesis.

Section 3.1 describes the research process.

Section 3.2 details the research paradigm.

Section 3.3 focuses on the data collection techniques used for this research.

Section 3.4 describes planned measurements.

Section 3.5 explains the techniques used to evaluate the reliability and validity of the data collected.

Section 3.6 describes the method used for the data analysis.

Section 3.7 describes the framework selected to evaluate the EMG system.

3.1 Research Process

The project had a top down approach (see figure 3.1). An overview and architecture based on the requirements of an EMG system was established and divided into functional blocks. These blocks were then implemented separately and eventually integrated together. The EMG system consisted of all these functional blocks. The finished product was experimentally tested and troubleshooted until the requirements had been met.

The project aimed to have an agile work environment with SCRUM: an agile project method targeted at small to medium sized IT projects focusing on a parallel development of a project in the form of tasks. However, practically a crude agile approach was implemented as SCRUM was deemed excessive for the tasks at hand. There were always clear tasks to be done and these tasks could be added or modified any time by the supervisor. Each stage of the project was straightforward and relatively small in scale which made it unnecessary to create a rigid structure. As the workplace was obstructed (CoVid19 pandemic) much of the work was done remotely. This altered the project’s process, where meetings were held more seldom via communication software (Zoom) and as the prior experiences of SCRUM had been through physical means, SCRUM was further demotivated.

Figure 3.1 - Research process, top down approach

(31)

14 | Method

Originally a test-driven development (TDD) was desired but due the restrictions of the workplace, testing the circuit on breadboards and breakout boards was not possible. This led to a change in structure where early stage breadboard testing was avoided and replaced by focusing on simulating the circuit and the evaluating the finished PCB functionality and performance. TDD in terms of software was also excessive since the majority of the code was already written (code premade and paired to the mobile app) and added coded was not complex and included mostly microcontroller (MCU) configurations which was facilitated by the GUI of MPLAB X IDE. However, when mounting and testing the PCB, TDD was implemented by testing each stage of the circuit before mounting components of the next stage and measuring the component values before mounting. This is described in detail in section 4). This was an efficient way of debugging the PCB board. Furthermore, due to design faults in the first PCB a second version was made, which was tested on a breadboard prior to being designed into a PCB.

3.2 Research Paradigm

Electronics is a natural science and was therefore naturally inclined towards a quantitative research paradigm.

3.3 Data Collection

Data collection was needed to test and verify that the EMG system operated as intended.

Measurements of leg muscles were performed by the thesis workers and on the thesis workers reassuring that no breach of privacy regarding medical data or similar was breached. There were no trials on actual bedridden patients.

3.3.1 Sample Size

Samples were taken on the arm (biceps) and the leg (calf). There were 6 samples on one arm, 6 samples on one leg from 2 people (the thesis workers) respectively.

3.3.2 Target Population

The EMG system was purposed to measure bedridden patients, particularly their legs. It was assumed that they were at a typical resting pulse as they were rendered immobile. Since the only test subjects were this thesis’s authors, the target population were people of adult age (20-30 years) at a resting pulse.

3.4 Planned Measurements

To verify that the EMG worked as intended, EMG data was measured continuously, displayed and observed to see if the flexing of the muscles was related to what was being displayed. It was also compared to reference EMG systems to estimate the quality of the signal.

3.4.1 Test environment

The test model consisted of 6 repetitive measurements of leg(calf) and arm(biceps) respectively on two test subjects: the thesis workers. For each measurement, the data was observed in four outputs of the EMG circuit (analog PCB): after IA, after filtering, after rectifying and after integrating the signal.

In order to acquire adequate data two factors were important:

(32)

| 15

15

• Skin contact - Before applying the surface electrodes, the skin was cleaned with an abrasive gel and dried with alcohol based sanitary wipes. This was to reduce the skin’s impedance by first removing dead skin with abrasive gel and then applying alcohol to reduce moisture. Furthermore, hairy areas were avoided or shaved for minimal interference.

• Placement - As explained in section 2 the muscle's motor units are gathered around the innervation zone. To acquire adequate signal quality the positive and negative electrodes of the EMG system were placed above this zone or about the mid-point of the muscle, parallel to the muscle fibers longitudinal axis. The positive (Vp) and negative (Vn) electrodes were spaced with about 1-2 cm after each other. The third electrode (common mode feedback) was placed at a neutral zone, a zone where the myoelectric signals were weak or not present.

The tendinous insertion (the tendons) was used as a feedback reference [2].

3.4.2 Hardware/Software used

Oscilloscope and signal generator software “PicoScope” together with its hardware (PicoScope 2204) was used to monitor the EMG signals. The app “KTH-logger” was also used to test the wireless (Bluetooth) transmission and that the data could be displayed correctly digitally.

3.5 Assessing reliability and validity of the data collected

This section showcases the strategy to evaluate the EMG system in terms of reliability and validity.

3.5.1 Reliability

To evaluate reliability, six measurements would be taken on two different test subjects (the thesis workers) on one arm (biceps) and one leg (calf) respectively. If the results were consistent i.e. if the measurements showed the same type of wave forms expected on different locations, the system would be deemed reliable. If the noise levels were consistent between test subjects from the EMG measurements, then that would also contribute to further reliability.

3.5.2 Validity

To evaluate validity the EMG device data would be observed in correspondence to the action of the muscle measured i.e. observe how to muscle moves in relation to measured signals. Furthermore EMG measurements would be compared to reference images published by Merletti [16]. If the measured waveform concurred with the references, the system was considered valid.

3.6 Planned Data Analysis

This section showcases data analysis strategies and evaluation framework for the EMG system.

3.6.1 Data Analysis Technique

By observing the peak voltage and the general waveform of the graph it’s possible to determine whether the system had enough gain and how it was affected by noise. The strategy was to observe data and compare it with the movement of the measured muscle and compare the data to the reference information, with the evaluation framework in perspective (see section 3.7 Evaluation framework).

(33)

16 | Method

3.6.2 Software Tools

The EMG system was paired through Bluetooth to a mobile app developed by the supervisor. This app, “KTH – logger”, sent AT commands to the EMG device to start or stop the EMG system

amongst other things. When the EMG system was activated it sent sampled data to the app which in turn plotted the information in a continuous graph. Other UART apps were used to test the

connection.

3.7 Evaluation framework

The following questions were used as a basis to evaluate the system:

• Is the system functional? Does it perform as expected and can it operate all commands?

• Does it have appropriate bandwidth? Are the cut-off frequencies as expected?

• Is the gain for the EMG system appropriate? Is the signal saturated?

• What amount of noise is present in the system?

• Are the results reliable?

• Are the results valid?

3.8 Sustainability

In electronic components there are rare earth metals (REM) [17], that are often disposed incorrectly [18]. It’s possible to recycle these metals which allows less resources to be mined and processed, and also that these components are disposed in an environmentally friendly way [18]. Common

substances found in solder and solder masks, which are used to mount components onto PCB, are lead (Pb) and tin (Sn) [19]. Lead is classified by the European union (EU) as an environmentally hazardous substance and is one of many substances defined in Restriction of Hazardous Substances (RoHS) directive [18, 19].

RoHS was implemented to prevent hazardous metals and compounds [18] and is within EU a requirement to have RoHS certification in order to sell an electronic product on the market [20].

The EU has since long established a directive for waste of electronics and electrical equipment (WEEE), a directive to ensure that electronics and electrical equipment (EEE) is disposed of

correctly in a manner that is environmentally friendly and ethical [18]. Furthermore there are illegal waste streams where WEEE is shipped to illegal waste centers where they simply burn or toss WEEE in garbage heaps, not handling the consequences, which is highly environmentally destructive [21].

Some REM and other metals used in electronics come from illegal sources, where people are exploited and risk their lives for small monetary gain [21]. There are some manufacturers like Intel that have certified resources [22] for their products but it’s often difficult to prove that they are as the metals or ores are smelted together in refineries [21].

In this project all components needed to be RoHS certified and any electrical waste was to be disposed of at a recycling center. Components were to be used carefully by testing and debugging before replacing components, but also by reusing components whenever possible. In soldering and testing there’s always electrical equipment to assist the process: soldering station, ventilation, oscilloscope, computer, voltage supply and function generator. To minimize their power consumption, they were to be turned off when idle and the voltage supply was mainly a battery instead of voltage generator. Furthermore, the computers used were energy efficient(eco-design) which also replaced paper documents for electronic documents such as datasheets.

Another important focus was the prevention of the COVID19 virus in the work environment.

This was planned to be done by decreasing the amount of people working in the same room,

(34)

| 17

17 disinfecting and washing hands thoroughly and by working remotely on the project whenever possible.

The United Nations (UN) has set 17 goals for sustainability and development [23] and in conclusion this project strived to achieve the following out of the 17 goals:

• 3 – Good health and well-being. (Main goal)

• 12 – Responsible consumption and production.

• 13 – Climate action.

• 15 – Life on land.

(35)
(36)

EMG system | 19

4 EMG system

The development of this thesis EMG system was broken down into five stages and can be viewed comprehensively in figure 4.1. The subsequent sections will provide detailed information of each stage.

4.1 Research stage

The first stage was research, a pre-study for developing an understanding for EMG systems and its nuances to consider. As mentioned in section 1 the EMG system could be divided into three parts:

detection, amplification (filtering included) and processing (see figure 4.2 or figure 1.1). The hardware was then separated into two parts: an analog EMG circuit and a digital processing circuit.

Figure 4.1 - Project overview – development of EMG system

Figure 4.2 - EMG system overview

(37)

20 | EMG system

4.1.1 Detection

The detection part pertains to electrodes; the type of electrode used to conduct the bioelectric signals and the electrode setup to be used. The myoelectric signals were detected by using 3- electrodes configuration which contained three electrodes: a positive, a negative and a reference.

The difference in potential between the positive and negative electrode was what the EMG measured whereas the reference was used to set common mode level and cancel common mode noise in the body.

These had to be placed properly on the muscle (as mentioned in section 2.1.2) to be measured and then connected to the next part, the amplification part which is referred to as the analog circuit.

4.1.2 Analog front end

This part represents the analog circuit, which did three essential operations:

• Amplifies – increases signal to a readable value.

• Filters - improves signal quality.

• Rectifies and integrates – converts signal into to a readable DC value.

Figure 4.3 gives a comprehensive view of the analog circuit:

1. Instrumentation amplifier – amplifies the difference in potential from the negative and positive electrode by 20 dB. Reduces common mode noise.

2. 2nd order non-inverting active high pass filter – attenuates frequencies below 15 Hz with 40dB/decade

3. Inverting active bandpass filter – attenuates frequencies below 15 Hz and above 723 Hz with 20 dB/decade. Provides a gain of 26.8 dB and inverts the signal.

4. 2nd order non-inverting active low pass filter - attenuates frequencies above 723 Hz with 40dB/decade.

Figure 4.3 - Amplification & Filtering step

(38)

| 21

21 5. Full wave rectifier - converts negative signals to positive signals.

6. Integrator – integrates signal to a readable DC value and also provides an adjustable gain to the circuit between 3.9 dB – 30.3 dB. Note that in the simulation (see section 4.2.

Simulation) the gain was set to 30.3 dB and in the physical PCB a 20k trimmer was mounted, enabling adjustable gain.

4.1.3 Processing

Lastly the processing part where the signal was converted into digital data via the MCU’s ADC. The main purpose of the processing part is to transmit data wirelessly to another device via a Bluetooth connection.

The microcontroller that has been used in this project was PIC16(L)F18426 from Microchip technologies. The MCU was chosen by the supervisor based on what was available already. It has multiple communications interfaces, mainly UART serial communication which was the interface used to connect to the Bluetooth module. The MCU also supports high baud rate, up to 115 200 bps, which allowed faster data transfer between the MCU and the Bluetooth app, resulting in a more responsive graph in KTH-logger. PIC16(L)F18426 operates with 1.8V - 3.6V power supply which was compatible with the power supply used for the analog circuit. Furthermore, the MCU offers up to 12 I/O pins which opens up the possibility for future modifications [24].

The Bluetooth module used was HC-06. It uses serial interface UART which was very easy to implement. Four pins needed to be connected:

1. VCC pin to power source (3.3V) 2. GND pin to ground

3. Transmit pin (TXD) to Receiver pin on MCU 4. Receiver pin (RXD) to Transmit pin on MCU

HC-06 operates with 3.3V power supply which was suitable for the circuit. The HC-06 can support higher baud rates than 115 200 bps but was limited by the MCU [25]. Since the speed of myoelectric signals are incredibly fast, the MCU must also have sufficient processing power, therefore the MCU was configured to use a 16Mhz clock frequency.

4.1.4 Essential parameters

The research stage yielded in important parameters used in the EMG system. These parameters were: the center frequency of myoelectric signal, cut-off frequencies, electrode type, electrode configuration and gain. These parameters are listed in table 4-1 below. However practically, the cut- off frequencies were adjusted to the circuit simulation results as well as the gain when testing the analog circuit on breadboard.

Table 4-1. Important parameters used in the EMG system

Initial Parameters Value/Type

Total output gain 51 - 77 dB (1000 – 7000 linear)

Center frequency of myoelectric signal 50 - 150 Hz

Ambient noise 50 Hz

Cut-off frequency lower 50 Hz

Cut-off frequency upper 200 Hz

Electrode type AgCl gelled surface electrode

Electrode configuration 3-electrode configuration

(39)

22 | EMG system

Adjusted Parameters Value

Cut-off frequency lower 15 Hz

Cut-off frequency upper 723 Hz

Total output gain on the PCB 57 dB

4.1.5 Hardware components

In the research stage the components were selected for the EMG system and are summarized in table 4-2 below:

Table 4-2. Component overview and description

Component Component description Function in system

AD623 Instrumentation amplifier IC To amplify the potential difference from the EMG electrodes and reduce common mode noise.

AD8574 General purpose quad

operational amplifier

Used to implement integrators, a full wave rectifier, DC bias and active op amp filters.

HC-06 Bluetooth module Sends digital data from MCU via

UART to paired Bluetooth devices.

BAS70-04 Schottky diode IC Used to implement full wave rectifier.

PIC16LF18426 Microcontroller Used to convey data from analog circuit to user with additional information.

MCP1703T 3302ECB Fixed 3.3V low dropout (LDO) voltage regulator

Used to convert unfiltered 5V power input to a stable 3.3V power output for the circuit.

All Op-Amp components were chosen to match these criteria:

• High CMRR (especially for instrumentation amplifier) - CMRR >100 dB

• High impedance on input – Rin > 10 MOhm

• Low impedance on outputs – Rout < 1 Ohm

• Sufficient Gain bandwidth (GBP) - GBP ≥ 1 MHz

• Low input bias current (Ib) - Ib < 7 nA

• Has a SPICE model compatible with simulation software (QUCS-S)

• Operates with single supply

• Operates with 3.3 power supply

• High power supply rejection ratio (PSRR) – 60 dB

These criteria were discussed with the supervisor prior to selection, particularly CMRR and PSRR.

(40)

| 23

23 The diode IC contained two Schottky diodes, which were chosen because of their low forward voltage, which rectifies signals closer to 0 volt. The MCP1703T 3302ECB component was chosen due to its low dropout; it could regulate the output voltage closely to its supply voltage, which was useful in case 3.3-3.7 V batteries were used as a power source. PSRR, CMRR were two important aspects where high PSRR reduces power supply ripples and high CMRR reduces common mode noise, which is essential for the instrumentation amplifier but also the rest of the circuit, to get a good signal from the muscles.

It should also be noted that two instrumentation amplifiers were used: AD8237 and AD623. The reason why AD623 was chosen was due to its component design: it has had pins to enable common mode feedback whereas AD8237 did not.

4.2 Simulation stage

The circuit simulation was done in QUCS-S an open source circuit simulator with spice

compatibility. In QUCS-S the analog circuit was tested for its gain, waveform and filtering quality.

First, the basic circuit was provided by the supervisor and changed to operate with single supply, 3.3 V. Its parameters were adjusted with the parameters seen in table 4-1. The IC

components selected in table 4-2 were then used to implement the basic circuit (see figure 4.4) and simulated as shown in fig. 4.5. The most notable change was the addition of a DC bias buffer to provide a bias point so that the AC signals could have a negative swing, as well as the addition of an IA IC. The DC bias point was set as half of the power supply, VDD/2. The non-inverting inputs and resistors were connected to this bias point as well as the reference point(ref) for the IA. The cut-off frequencies were adjusted so that the bandwidth would be large enough for enough amplification. In the simulation result of the final circuit the gain, frequency response, rectification and integration was scrutinized. The input signal simulated was 1mV 160 Hz AC signal. In the top left graph in figure 4.5 the IA output signal is seen, which has an amplitude of 10.8 mV: a gain of 11(linear). In the next amplification stage (the bandpass filter) the signal is amplified to 200mV: a gain of about 19(linear) which is seen in the graph just below the IA graph in figure 4.5. Then at the rectifier the signal is inverted for every half cycle so that all peaks are negative, seen in the bottom right graph in figure 4.5. And at the final stage the signal is integrated (converted to DC) and approaches 3.3V eventually as is seen in the bottom left graph in figure 4.5.

Figure 4.4 - Final circuit

(41)

24 | EMG system

The simulation of the final circuit was done stepwise. A compatible component circuit file (.cir) was acquired from the manufacturer and then made into a component in QUCS-S. Then it was simulated scrutinizing its gain and waveform, with the exception of the Schottcky diode where the forward voltage was scrutinized instead. The component was then incorporated into the total circuit.

As an example, the simulation process of the IA AD623 is shown below:

1. Create QUCS-S compatible component and attach ports corresponding to its datasheet (figure 4.6).

2. Simulate the model to ensure its functionality (figure 4.7).

Figure 4.6 - Making AD623 IA component in QUCS-S Figure 4.5 - Final circuit simulation result

(42)

| 25

25 3. Simulate tested component in final circuit (figure 4.8).

Figure 4.7 - Simulating component circuit

(43)

26 | EMG system

Many simulations were made and there were two IA amplifiers simulated AD8237 and AD623. The latter was the one used and therefore the other one is excluded in this section. The different filtering stages and the DC bias was simulated as in step 2-3 above.

4.3 Design stage

The third stage was design: designing a PCB circuit with the requirements of a small battery-

operated wireless EMG system. At first the design was free formed meaning it could be any size and have any layout, but later the design of the PCB was changed to mimic that of the Adafruit Feather development board [26] because of its small and intelligent design.

Apart from Adafruit Feather’s general design, the layout in terms of electrical characteristics and performance had to be scrutinized. This layout design was based on previous experience from both the thesis workers and the supervisor, but also based on PCB design guidelines by the

component’s manufacturer.

The following subsections will go further into detail regarding the EMG system’s hardware structure, the schematic implemented in the PCB and PCB design considerations.

4.3.1 Hardware block diagram

The overview of the EMG system’s hardware can be seen in figure 4.9. The main components were the MCU PIC16LF18426, Bluetooth module HC-06, instrumentation amplifier AD623, quad op amp AD8574 and LDO voltage regulator. The HC-06 Bluetooth module communicates via UART

protocol with a baud rate of 115200 and was controlled by the MCU via KTH-logger app. The output of the analog amplifying and filtering blocks (marked red in figure 4.9) are connected to an ADC pin

Figure 4.9 - Hardware block diagram of EMG system Figure 4.8 - Simulating component in final circuit

(44)

| 27

27 of the MCU, to convert analog data to digital data with 12 bits of conversion. Furthermore, there are indication LED for both the voltage regulator and the MCU to indicate the power supply is on and for testing the MCU.

4.3.2 Schematic

The hardware was separated into two: a digital circuit (figure 4.10) and an analog circuit (figure 4.11). Both circuits had their own power supply circuit that connected to a micro-USB that could run on 3.3V or 5V, to be able to test them separately. These two circuits had two 8-pin headers in order to stack the circuits on top of each other to connect the output of the EMG to the input of the MCU in order to minimize space.

The digital circuit consisted mainly of PIC16LF18426 (the MCU) and had 5 pins; PGD, PGC, MCLR, GND and 3.3V that were connected to one of the headers J1 (see figure 4.10). These pins were used to connect to a PicKit3, a common device used for programming PIC microcontrollers.

Two MCU USART pins were connected to the HC-06 Bluetooth module for serial communication.

Other “unused” pins were configured as ADC inputs and were connected to header J3, which in turns connects to the parallel output of the analog circuit PCB.

Figure 4.10 - Digital circuit

(45)

28 | EMG system

The analog circuit consisted of the components used for amplifying and filtering stages such as instrumentation amplifier AD623 and quad op amp AD8574 and was the EMG circuit. The output of the integrator was divided into six parallel output to make the device modular. These outputs in turn connect to J3 in the digital circuit PCB.

4.3.3 PCB design

In the early stages of the project, the PCB design was arbitrary (apart from EMC layout) and both the digital and analog circuit were incorporated in one PCB. Shortly after, the design was changed to mimic the Adafruit Feather board. These new dimensions made the design constrained due to its small component area and was therefore compromised by constructing two separate boards that could be stacked on top of each other like an IO shield. The PCB, especially the analog PCB, had a lot of ground and power connections which made it difficult to route.

The result was two multi layered PCB boards with dimensions 22.86 mm x 50.8 mm and 2.54mm pin headers on each side with a micro USB input on the left and core components in the center and other components on the right.

To minimize signal interference and electromagnetic interference (EMI) components and routes were placed away from the edges and the power supply was sectioned away. Both boards had isolated poured areas grounded to improve electromagnetic compliance (EMC). Furthermore, decoupling capacitors were placed close to all IC components according to manufacturer’s

Figure 4.11 - Analog circuit

(46)

| 29

29 recommendation to prevent sudden electrical impulses. These were the similarities between the analog and digital circuit PCB. However, PCB layout for each board had to be adapted after its components.

The analog circuit PCB (figure 4.12-4.14) was a 4-layer board: top signal layer, ground plane, power plane, bottom signal layer. Due to the number of components and the constraints of the Adafruit feather dimensions, a 4-layer board was needed in order to route all components. A close ground and power plane also help to prevent capacitively induced noise. PCB tracks were avoided underneath components (particularly IC) to minimize the risk of interfering with the component’s internal operation.

Figure 4.13 - Analog circuit PCB with copper pour Figure 4.12 - Analog circuit PCB without copper pour

References

Related documents

In this step most important factors that affect employability of skilled immigrants from previous research (Empirical findings of Canada, Australia &amp; New Zealand) are used such

participation in the strategy formulation process. When it comes to participation in the strategy formulation process, this study shows that it is equally critical to engage

improvisers/ jazz musicians- Jan-Gunnar Hoff and Audun Kleive and myself- together with world-leading recording engineer and recording innovator Morten Lindberg of 2l, set out to

Based upon this, one can argue that in order to enhance innovation during the time of a contract, it is crucial to have a systematic of how to handle and evaluate new ideas

When Stora Enso analyzed the success factors and what makes employees &#34;long-term healthy&#34; - in contrast to long-term sick - they found that it was all about having a

After referring to Dassonville, Cassis and Keck, the Court offered a new, three-part definition of when national measures constitute MEQRs that distinguishes between

According to Shiʿi belief, the last Shiʿi Imam Mohammad ibn al-Hassan, known as al-Mahdi (born 868), began an underground life in the mid-870s to escape persecution from

Since public corporate scandals often come from the result of management not knowing about the misbehavior or unsuccessful internal whistleblowing, companies might be