copyright 2005 by saksit siriprayoonsak1 real-time measurement of prehensile emg signals master...
Post on 21-Dec-2015
212 views
TRANSCRIPT
Copyright 2005 by Saksit Siriprayoonsak 1
Real-Time Measurement of Prehensile EMG signals
Master Thesis
Saksit Siriprayoonsak
Supervisor: Marko Vuskovic
Department of Computer ScienceSan Diego State University
August 24, 2005
Copyright 2005 by Saksit Siriprayoonsak 2
Contents
Introduction EMG Overview Apparatus for EMG Measurement Implementation of EMG Capture Program Experimental Results Conclusion
Copyright 2005 by Saksit Siriprayoonsak 3
Multifunctional Prosthetic Hand Control
A research in Robotics Laboratory, SDSU
Copyright 2005 by Saksit Siriprayoonsak 4
Object of Thesis
Main purpose: Design and develop hardware and software for
measuring surface EMG signals from real human muscles in real-time.
Immediate application: To control the existing SDSU multifingered robot
hand.
Copyright 2005 by Saksit Siriprayoonsak 5
EMG Overview• EMG – Electromyography• Electromyography measures the electrical impulses of muscles at
rest and during contraction.• Amplitudes of EMG signal range between 0 to 10 mV (peak-to-
peak) or 0 to 1.5 mV (rms).• Frequency of EMG signal is between 0 to 500 Hz.• The usable energy of EMG signal is dominant between 50-150 Hz.
Source: http://www.delsys.com/library/papers/SEMGintro.pdf
Copyright 2005 by Saksit Siriprayoonsak 6
Amplification of EMG Signals
Factors to be considered:• Boost signal to TTL standard level (± 5 V.)
– Enough gain
• Noise/Artifact problem– Filter, stability of electrodes attached to skin, proper
grounding
• DC offset or bias problem– Bias adjustment
• Power consumption– Consume less current
Copyright 2005 by Saksit Siriprayoonsak 7
EMG Measurement Stages
Copyright 2005 by Saksit Siriprayoonsak 8
EMG Amplifier: Electrode and Extension
• Stereo phone wire with 3 conductors– Positive input to preamplifier– Negative input to preamplifier– Shield as the input of body reference circuit
• Velcro strap for securing the electrode to the skin
Copyright 2005 by Saksit Siriprayoonsak 9
EMG Amplifier: Electrode and Extension (cont.)
• Plastic piece and snap on for holding electrode elements• Dimension of 1 inch between electrode contacts• 4 electrode extensions and 1 body reference extension• Total of 9 electrode contacts
Copyright 2005 by Saksit Siriprayoonsak 10
EMG Amplifier: Power Supply
• Dual Supply – Positive Power Supply– Negative Power
Supply
• Two 9-volt batteries connected in series
• Capacitors provide stability of electrical current.
Power Supply Unit Circuit
Copyright 2005 by Saksit Siriprayoonsak 11
EMG Amplifier: Preamplifier
• Industry standard instrumentation amplifier op-amp (INA2128)– Accuracy: providing high bandwidth at high
gain and output offset current
• Differential amplifier circuit with 2 inputs
• High gain to boost the EMG signals
• Body Reference Circuit or Feed Back (OPA2604)
Copyright 2005 by Saksit Siriprayoonsak 12
EMG Amplifier: Preamplifier (cont.)
BURR-BROWN INA2128 Application Information
Copyright 2005 by Saksit Siriprayoonsak 13
EMG Amplifier: Preamplifier (cont.)
Gain Equation:
501
1 22
G
G
kGain
R
Rwhere R R
Find RG at Gain = 1,000:
1 50
2 2 ( 1)
1 50
2 (1000 1)
25.025
GR k
Gain
k
Find Gain at RG = 22 ohm:
501 1137.364
2 22
kGain
Preamplifier with Body Reference Circuit (1 channel)
Copyright 2005 by Saksit Siriprayoonsak 14
EMG Amplifier: Averaging Body Reference Circuit
• Common body reference circuit for 4 channels• Using summing amplifier circuit and sign changing circuit
Inverting Summing Amplifier Circuit
Sign Changing Circuit (Inverting Amplifier Circuit)
For independent R1, R2, R3, and R4:
4
4
3
3
2
2
1
1
R
V
R
V
R
V
R
VRVout F
For R1= R2= R3= R4:
1 2 3 41
FRVout V V V VR
2
1
RVout Vin
R
For independent R1, and R2:
For R1= R2:VinVout
Copyright 2005 by Saksit Siriprayoonsak 15
EMG Amplifier: Average Body Reference Circuit (Cont.)
Common Body Reference Output:
Average Body Reference Circuit
1 2 3 4
1 2 3 4
1
11 1
1 4.7
1
4
kVoutB VoutA
kk k
Bodyref Bodyref Bodyref Bodyrefk k
Bodyref Bodyref Bodyref Bodyref
1 2 3 4
1
4.7
kVoutA Bodyref Bodyref Bodyref Bodyref
k
Copyright 2005 by Saksit Siriprayoonsak 16
EMG Amplifier: Filter
• Suppress noise that has been amplified by the preamplifier
• Help to sink any DC current that cause bias to the output
• Select particular signal frequency range
• Use RC High Pass Filter of 12 Hz
Copyright 2005 by Saksit Siriprayoonsak 17
EMG Amplifier: Filter (cont.)
Cutoff Frequency: Cutoff Frequency of 12 Hz:
RC High Pass Filter RC High Pass Filter
Cutoff Frequency of 12Hz
1
2cutofffRC
Hz
nFkf cutoff
12
66.11
150912
1
Copyright 2005 by Saksit Siriprayoonsak 18
EMG Amplifier: Amplifier and Bias Adjustment
• Provide abilities to amplify and adjust reference level of output signals
• Individual amplifier and bias adjustment unit for each channel
• Use Non-Inverting circuit for amplifier unit• Use Voltage Follower Offset Adjustment
circuit for bias adjustment unit• Provide Gain of 21 times• Provide Offset of ± 9 volts
Copyright 2005 by Saksit Siriprayoonsak 19
EMG Amplifier: Amplifier and Bias Adjustment (cont.)
Non-Inverting Amplifier Circuit
Non-Inverting Output:
3
1
1R
Vout VinR
3
1
1R
GainR
Copyright 2005 by Saksit Siriprayoonsak 20
EMG Amplifier: Amplifier and Bias Adjustment (cont.)
Amplifier Gain:
40
35
1
01
10
1
RGain
R
k
At :
040 R
Amplifier Circuit with Gain Adjustment
Amplifier Circuit with Gain Adjustment
At :
kR 20040 40
35
1
2001
10
21
RGain
R
k
k
Copyright 2005 by Saksit Siriprayoonsak 21
EMG Amplifier: Amplifier and Bias Adjustment (cont.)
Offset Adjustment for Voltage Follower
2R 2 0R Vadj VccCase 1: at 0% of : ( ohms; volts )
3
1
1R
GainR
3
1
1R
Vout Vin VccR
2RCase 2: at 50% of : ( ohms; volts )22 2
RR 0Vadj
3
21
1
2
RGain
RR
3
21
1
2
RVout Vin
RR
2RCase 3: at 100% of : ( ohms; volts )Vadj Vcc2 2R R
3
1 2
1R
GainR R
3
1 2
1R
Vout Vin VccR R
Output of the circuit:
( )Vout Vin Gain Vadj
1 2: where V Vadj V
Copyright 2005 by Saksit Siriprayoonsak 22
EMG Amplifier: Amplifier and Bias Adjustment (cont.)
Bias Adjustment Circuit
2R 2 0R Vadj VccCase 1: at 0% of : ( ohms; volts )
38
37
1
11
101.1
RGain
R
k
k
2RCase 2: at 50% of : ( ohms; volts )22 2
RR 0Vadj
38
4137
1
21
150
102
1.029
RGain
RR
kk
k
2RCase 3: at 100% of : ( ohms; volts )Vadj Vcc2 2R R
38
37 41
1
11
10 501.017
RGain
R R
k
k k
_ ( ) 9Vout final Vout Amp V
Output of the circuit:
: 9 _ 9 volts.where Vout final V
Copyright 2005 by Saksit Siriprayoonsak 23
A/D Interface Card
• NI 6220 M-Series Multifunction DAQ
• Clock Speed: 8 Hz, up to 1 MHz
• Analog Input Resolution: 16 bits
• Number of Analog Input Channels: 8
Copyright 2005 by Saksit Siriprayoonsak 24
Final Product Assembly
• Circuit designed and tested on breadboard• Schematic created by Multisim8• PCB layout created by Ultiborad7
Copyright 2005 by Saksit Siriprayoonsak 25
Final Product Assembly (cont.)
• A schematic diagram is drawn using Multisim8.
• Netlist contains all circuit connections.
• Netlist is transferred to Ultiboard7 for PCB layout.
• PCB is a double layer (top copper layer and bottom copper layer)
• Through holes connect between 2 layers.
Copyright 2005 by Saksit Siriprayoonsak 26
Final Product Assembly (cont.)
PCB shipped by the manufacturer
Copyright 2005 by Saksit Siriprayoonsak 27
Final Product Assembly (cont.)
PCB after soldering
Copyright 2005 by Saksit Siriprayoonsak 28
Calibration Procedure
• Each channel is individually calibrated.• Input is equal to output (100 mV.)• If an arbitrary gain is needed, the output is desired gain
value multiplied by input.
Copyright 2005 by Saksit Siriprayoonsak 29
EMG Capture
• Provides 3 play modes: Real-Time, Record, and Playback mode.
• Able to save and open EMG data to/from file.
• Display features:– Voltage scales– Time scales– Readout of exact values
Copyright 2005 by Saksit Siriprayoonsak 30
EMG Capture: User Interface
Copyright 2005 by Saksit Siriprayoonsak 31
EMG Capture: Main Parameter Subpanel
• Working with Real-Time mode and Record mode.
• Maximum Buffer Size (Samples per Channel)• Sampling Rate (Hz)
Copyright 2005 by Saksit Siriprayoonsak 32
EMG Capture: Play Mode
Copyright 2005 by Saksit Siriprayoonsak 33
EMG Capture: Real-Time Mode
- Start real time mode
- Stop real time mode
- Freeze output display for examine interesting segments or save the data
- Resume real time mode
- Save data in buffer to file
START
STOP
Pause
Resume
Save
Copyright 2005 by Saksit Siriprayoonsak 34
EMG Capture: Record Mode
- Start to Record the signals in specific time range in seconds.
- Save the data to file
START
Save
Copyright 2005 by Saksit Siriprayoonsak 35
EMG Capture: Playback Mode
- Open EMG data file (.emg)Open
Standard window open dialog
Copyright 2005 by Saksit Siriprayoonsak 36
EMG Capture: Voltage Scale• Voltage scale is
independent for each channel.
• Alternative voltage scales:– 200 mV/Div.– 500 mV/Div.– 1 V/Div.– 2.5 V/Div.– 5 V/Div.
Copyright 2005 by Saksit Siriprayoonsak 37
EMG Capture: Time Scale
• All channels use the same time scale
• Alternative time scales:– 1 mSec/Div.– 5 mSec/Div.– 10 mSec/Div.– 50 mSec/Div.– 100 mSec/Div.– 200 mSec/Div.– 400 mSec/Div.
Copyright 2005 by Saksit Siriprayoonsak 38
EMG Capture: Time Slider
• Scroll time slider to view data from beginning to the end.• The numbers on the left and right corner correspond to
the time stamp of the first and the last sample shown on the output display screen.
• ‘5.416’ is 5 seconds and 416 milliseconds.
Copyright 2005 by Saksit Siriprayoonsak 39
EMG Capture: Readout
• Read extract value at pink vertical line• Need not to compute the value of scale• Unit: Time (sec) , Voltage (V)
Copyright 2005 by Saksit Siriprayoonsak 40
EMG Capture: Output Display
• Displays 4 channels• Voltage: 4 divisions
– 2 positive divisions– 2 negative divisions
• Time: 15 divisions
• Maximum Display:– ±10 volts with 5 volts/Div.
– 6 seconds with 400 mSec/Div
Copyright 2005 by Saksit Siriprayoonsak 41
EMG Capture: Status Bar
• Guide user through the usage• Display important message
eg. Number of samples that went into the buffer.
Copyright 2005 by Saksit Siriprayoonsak 42
EMGC Implementation
• Developed by using Microsoft Visual C++ tool• GUI developed with MFC (Microsoft Foundation Class)
library• Runs on Windows 2000 machine which has A/D
interface card installed• A/D Interface Card: Multifunction Data Acquisition
(DAQ), M-6220 series from National Instrument Company
Copyright 2005 by Saksit Siriprayoonsak 43
EMGC Implementation: Output Buffer Structure
• CArray class from MFC Library used to store input signal data.
• CArray can dynamically shrink and grow if necessary.
struct SOutputData
{
int output_ii; //Iteration start from 0
double time; //Time stamp in Second
double volt1; //Voltage value for CH1, CH2, CH3, and CH4
double volt2;
double volt1;
double volt1;
};
CArray <SOutputData, SOutputData> dumpDataArray;
Copyright 2005 by Saksit Siriprayoonsak 44
EMGC Implementation: Creating Voltages and Time Scales
• Use spin control to select the scales.• Spin control increase/decrease spin value by a
specific number of steps.• Use spin value as the index of scale array.
//For Calculation
double voltScaleSet[5] = {5.0, 2.5, 1.0, 0.5, 0.2}; //unit in volt/div
//For Screen Display
CString voltScaleStrMap[5] = {“5 Volt/Div”, “2.5 Volt/Div”,
“1 Volt/Div”, “500 mVolt/Div”, “200 mVolt/Div”};
Copyright 2005 by Saksit Siriprayoonsak 45
EMGC Implementation: Draw Grid for Graph Output
• Use CDC class (Class Device-Context object) to draw output on the screen.
• The CDC class is a class from the MFC library.
• CDC provides various kinds of drawing functions (working with drawing tool, converting the coordinates,
drawing rectangles, drawing circles, drawing text, changing the color)
Copyright 2005 by Saksit Siriprayoonsak 46
EMGC Implementation: Draw Grid for Graph Output (cont.)
private:
//Variables for drawing output
int _maxTimeDiv; //Max number of divisions to display on Output-Panel
int _maxVoltDiv; //time axis = 15 divisions
//volt axis = 4 divisions (2 positive Divs)
// (2 negative Divs)
int _ptsPerDiv; //How many points are there in 1 division.
//1 point = 0.1 milimeter
//Default 100 points = 1 division is 1 cm wide
// ** Base on: Display Resolution= 1024 x 768
int _maxDrawPtsX; // _maxTimeDiv*_ptsPerDiv, Max Drawing Point for // time
int _maxDrawPtsY; // _maxTimeDiv*_ptsPerDiv, Max Drawing Point for volt
//Default x=1500, y=400
Copyright 2005 by Saksit Siriprayoonsak 47
EMGC Implementation: Draw Grid for Graph Output (cont.)
Copyright 2005 by Saksit Siriprayoonsak 48
EMGC Implementation: Drawing Graph Output
_ ptsPerDivdrawValueX time startTime
curTimeScale
Function CEMGCDlg::voltToDC()
_ _
2
ptsPerDiv maxDrawPtsYdrawValueY volt
vScale
Function CEMGCDlg::voltToDC()
The output can be drawn by using (x,y) coordinate to specify position to draw.
Copyright 2005 by Saksit Siriprayoonsak 49
EMGC Implementation: Saving Data Buffer To File
• File Extension (‘.emg’)• Header line contains
– Sampling rate (HZ)– Record time period (sec)
• Data speparate by a ‘space’.
• Each record separated by a ‘carriage return’ (put in front).
Copyright 2005 by Saksit Siriprayoonsak 50
EMGC Implementation: Read File To Data Buffer
• Read header file– Sampling rate -> computes sampling period– Record time period -> verifies the data file (completed or in
completed)
• Store data in buffer (dumpDataArray)
struct SOutputData
{
int output_ii; //Iteration start from 0
double time; //Time stamp in Second
double volt1; //Voltage value for CH1, CH2, CH3, and CH4
double volt2;
double volt1;
double volt1;
};
CArray <SOutputData, SOutputData> dumpDataArray;
Copyright 2005 by Saksit Siriprayoonsak 51
ResultsOur EMG Amplifier ME3000 Muscle Tester
A comparison of cylindrical grasp recorded from our EMG amplifier and ME3000.
Copyright 2005 by Saksit Siriprayoonsak 52
Results (cont.)Our EMG Amplifier ME3000 Muscle Tester
A comparison of preshaping of cylindrical grasp recorded from our EMG amplifier and ME3000.
Copyright 2005 by Saksit Siriprayoonsak 53
Conclusion This thesis presents an implementation of EMG amplifier
device and EMG Capture program. Major problems were:
• To reduce noise, moving artifacts, system grounding and DC bias.
Problems solved through:• Proper choice of discrete components (resistors, capacitors, and
ICs)• Proper design of circuitry• Final implementation of the device using PCB technology• Systematic experimentation with the prototype (implemented on
a breadboard)• Extensive testing of the device after implementation and
executing final corrections.
Copyright 2005 by Saksit Siriprayoonsak 54
Future Work
EMG amplifier• Smaller size of the housing unit.• Eliminate electrode extensions
EMG Capture program• Add print feature• Add properties feature for changing system
parameters• Improve drawing ability