Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

BITS Pilani, Dubai Campus

Obtaining 2 degrees of freedom using SVM for Upper Arm Neural


Exoskeleton
Abhishek Mahajan, BITS Pilani, Dubai Campus, E-mail: f2013270@dubai.bits-pilani.ac.in
Ameya Kulkarni, BITS Pilani, Dubai Campus
DIAC (P. O. Box 345055), Dubai, UAE

Abstract
We want to build a neural exoskeleton that can be intuitively controlled by a person with
their thoughts. This paper deals with the first portion of this exoskeleton, obtaining 2
degrees of freedom from the arm. We first design our own EMG sensor on a general
purpose PCB and then etch it on a copper clad. Once the sensor is designed, we now acquire
data to process it in MATLAB, where we first normalize the data and then run SVM with
Gaussian kernel to obtain a complex decision boundary. This model is then fed to the ADC
ports of a System on Chip (SOC) BeagleBone Black, an ARM CORTEX microprocessor
based portable computer, allowing us to utilize its PWM output pins to control servo motors
of the gripper in real time. Two servos are operated from a 2 channel EMG sensor allowing
for control in 2 degrees of freedom.

1. INTRODUCTION

EMG is short for electromyography. It means measurement of the electrical impulses produced by muscles.
[1] Each muscle fibre when triggered by a motor neuron develops a muscle unit action potential (muap) which
contributes to the ionic imbalance, and together these muaps form an electrical impulse. [2] It is used for two
major applications, as a diagnostic tool, and as an intuitive control mechanism for prosthetics. We want to
design an EMG based control system to allow intuitive control for a neural exoskeleton, neural prosthetic, as
well as a proxy arm. A neural prosthetic is useful in case of person with missing limb, an exoskeleton can be
used for people with spinal cord injury (SCI), for controlling tremors of people suffering from Parkinson’s
disease, an a proxy arm is useful to do tasks that require dexterity of a real hand but the conditions are
threatening to life. The ideology is to give the user the power to control a machine interface with just thoughts.
One way to go about it is to implant a chip in brain, another is to design a biosynthetic material that can be
connected to the nerves directly and data is sent wirelessly to a processor outside. Both of these methods are
out of our reach as we neither have access to resources for such procedures nor the expertise. A third technique
for control is the non-invasive method of surface electromyography. The motor neurons innervate the muscles
fibre and firing a neuron directly triggers these muscles. [1] Besides, muscles act as natural amplifiers, as
they amplify the voltage impulses from the neurons upto a thousand times.

This is our motivation to proceed with EMG, as it needs no surgery, while control with thoughts is still
possible as the muscles can be controlled voluntarily.

2. MUSCLE SELECTION

To augment a person’s arm strength to lift more weight with equal effort, one muscle group from below elbow
and one from above elbow is needed to control the exoskeleton. We target two muscle groups to acquire
sEMG signal: brachii (bicep) and brachioradialis (forearm muscle). The bicep is the strongest muscle group
in the arm, and brachioradialis is directly innervated by the median nerve.

2.1 Electrode Selection and Placement

We choose Ag/Ag-Cl disposable electrodes as they are cheap and have the lowest half-cell potential and
hence low DC offset (220mV approximately). [3]

The EMG sensor is based on differential amplification technique. And we opted for bipolar configuration as
we had to focus on two big muscle groups. The bony part of the elbow was chosen as the ground for both the
muscles. The electrodes were placed 1 cm apart on each muscle’s belly as the muscle is fiber density is
highest here and gives the greatest value for EMG (Fig. 2). [4]

The Fourth United Arab Emirates Undergraduate Research Competition UGSRC - 1


BITS Pilani, Dubai Campus

Fig. 1: Bipolar electrode placement for a muscle group (the two gray bar shapes are contact points)
Courtesy : Muhammad Zahak Jamal , Intech 2012 [4]

(a) (b)
Fig. 2:
Electrodes placed at (a) bony part of elbow for ground (b) 1 cm off muscle belly for both groups
Isometric Contraction of (a) brachioradialis (the red hatched part) (b) biceps brachii (with the blue and
green lead wire electrodes)

3. EMG SENSOR DESIGN


The first stage is the instrumentation amplifier which is required to take signal from near the belly of the
muscle so that the common noise can be rejected. This takes care of most artifacts but DC offset still persists,
for which we implement a high pass filter of cut off frequency 10.07 Hz. [4], [5] After this a precision half
wave rectifier is added so that an envelope can be obtained with the help of an integrator. Finally a voltage
controlled oscillator is added to hear a speaker’s frequency vary directly with voltage, and hence the EMG
strength. [6]
𝑅4 𝑅2
The formulas used to design the different stages are: (a) instrumentation amplifier: gain = (1 + )
𝑅3 𝑅1
1 𝑅𝑓 𝑅𝑓
(b) high pass filter: gain = cutoff = , gain = (1 + ) (c) half wave rectifier: gain = − (d) envelope
2𝜋𝑅𝐶 𝑅𝑖 𝑅𝑖
𝑅𝑓 1
detector: gain = − cutoff = . [5], [6]
𝑅𝑖 2𝜋𝑅𝐶

UGSRC - 2 The Fourth United Arab Emirates Undergraduate Research Competition


BITS Pilani, Dubai Campus

The net gain is calculated by multiplying successive gains in the following block diagram (Fig. 3). Net Gain
= 201*1*1*20 = 4020.

INSTRUMENTATI HIGH PASS PRECISION HALF ENVELOPE VOLTAGE


ON AMPLIFIER FILTER WAVE RECTIFIER DETECTOR CONTROLLED
•Gain = 201 •Cutoff = 10.07 •Gain = 1 •Cutoff = 1.14 Hz OSCILLATOR
Hz •Gain = -20 •Net |Gain| =
•Gain = 1 4020

Fig. 3: Block Diagram of Different stages of amplification and filtering

Based on this circuit schematic, first components were soldered on a general purpose PCB and then a PCB
design layout was created for manual etching with FeCl3. This PCB schematic is created for through the hole
components.

(a) (b)

Fig. 4: PCB Schematic (a) Top (b) Bottom (not to scale)

The op amp ICs for implementing this circuit were selected based on their properties and easy availability,
explained in the table in Fig. 5.

Fig. 5: Table of ICs used

IC NAME IC TYPE USAGE


TL084 Quad JFET input Op amp [7] Instrumentation Amplifier and Low pass
filter
LM324 Quad Op Amp [8] Half wave rectifier and Integrator
LM339 Quad Differential Comparators [9] Voltage controlled oscillator

4. DATA ACQUISITION
The EMG signal was acquired using the previously designed EMG sensor which has 4 output pins: (i) Raw
EMG Output (ii) Half Wave Rectified Output (HW) (iii) Envelope Detector Output (ED) (iv) Voltage
Controlled Oscillator (VCO).

Data was observed by connecting the output of the EMG signal sensor to Agilent Digital Storage Oscilloscope
(DSO) (Fig. 6). And then using the save feature of the DSO, data was stored in .csv format in a USB drive.

The Fourth United Arab Emirates Undergraduate Research Competition UGSRC - 3


BITS Pilani, Dubai Campus

Similarly, the ADC ports of Beaglebone Black were used to read and record HW and ED values. These values
were then stored in a .csv file. [Ports Used: P9-33 and P9-35] BeagleBone Black is a system on chip with
ARM 335x series Cortex A8 onboard microprocessor with inbuilt PRU 32-bit microcontrollers which aid
high sampling rate and also has general purpose i/o pins, pwm and lots of other features which allow us real-
time EMG signal processing and servo control. Its portability is another advantage that makes it pivotal to an
EMG based control system for an upper arm exoskeleton.

4.1 Methodology

Two features of the signal were captured, Half Wave rectified output and the Envelope Detector Output. First
the signals for isometric muscle contraction were recorded (for 5 seconds): (a) The brachioradialis muscle
was contracted in a supinated position keeping elbow flexed at 90° whereas (b) the biceps brachii was flexed
and held constant at different angles along the curl of the arm for each sample. Then the signals for arm rest
position were recorded (for 5 seconds) when both brachioradialis and brachii were at rest. The data was
acquired from the left arms of two subjects. For both the positions, a combination of 500 and then 1000 values
was recorded. The data recorded was then imported and visualized in MATLAB. [10]

Fig.6: DSO Waveform Channel 1: Half Wave Rectified Output (Yellow) Channel 2: Envelope Detector
(Green)

5. DATA PREPROCESSING

The two features HW and ED are both on a very different scale and it is necessary to get both these features
on a comparable scale. Amongst various feature scaling methods, Mean Normalization is the most promising
̅
𝒙(𝒊)−𝑿
tool to get both features in a range of [-1,1]. Mean Normalization: 𝑧(𝑖) . For every training example 𝒙(𝒊),
𝑺(𝒊)
with 𝑋̅ being the mean and 𝑺(𝒊) the standard deviation for that feature. [11]

6. SVM WITH GAUSSIAN KERNEL

In order to achieve a complex nonlinear decision boundary, a radial basis function (RBF) kernel or Gaussian
kernel was implemented. This allowed for formation of new features using proximity landmarks 𝑙(𝑖) . [11]

UGSRC - 4 The Fourth United Arab Emirates Undergraduate Research Competition


BITS Pilani, Dubai Campus

−∥𝑥−𝑙(𝑖) ∥2
( )
Gaussian Kernel: 𝑓(𝑖) = 𝑒 2𝜎2

6.1 Choosing the learning parameters C and 

1
The learning parameters for SVM i.e. the regularization parameter 𝐶 = and  for implementing Gaussian
𝜆
kernel were found by running svmTrain on every possible combination of C and  defined in this array:
[ 0.01 0.02 0.08 0.32 1.28 2.56]. For conciseness these values were chosen to be increasing multiples of 2.
As there are 6 elements in the array, svmTrain was run for 62 (36) different iterations generating 36 different
SVM models. After training, a 1x6 vector of minimum error values was generated using the svmPredict
function. A ‘global minimum’ was obtained from this vector and the corresponding values of C and  for that
SVM model were chosen as optimal values. [11]
svmTrain was now run with Gaussian kernel using these optimal values for C and . A decision boundary
was visualized on the test set shown in Fig. 7 (b).

(a) (b)

Fig. 7: Plots for (a) Acquired Data in MATLAB + for Isometric contraction and for Rest (no contraction)
(b) Complex Decision Boundary

7. GRIPPER CONTROL USING BEAGLEBONE BLACK

We got the 3d printable design of gripper online. [12] This gripper has two degrees of freedom, first is its
grip similar to pinch grip type (with thumb and four fingers), for instance our hand in a mitten grabbing a
tray, and second is the rotation at its base, akin to wrist pronation and supination (rotation either clockwise
or anticlockwise).

(a) (b)

Fig. 8: Gripper in (a) Open position (b) Closed position

The Fourth United Arab Emirates Undergraduate Research Competition UGSRC - 5


BITS Pilani, Dubai Campus

The decision boundary model obtained was then integrated in the BeagleBone Black which was used to
control the PWM output for the servo motors of the gripper. The gripper was programmed to: Remain
“closed” during the rest position of the bicep; “open” during the Isometric Contraction of the bicep; “turn
clockwise 90°” during the isometric contraction of the brachioradialis; “return to initial position” during the
rest position of the brachioradialis.(Fig. 8)

EMG Preprocessing Prediction


Filtering & Decision

EMG Data Parameter


Amplification acquisition hunt Effector

Fig. 9: Process flow diagram

CONCLUSION

We first designed an EMG sensor from which we acquire data via DSO (and BeagleBone Black). This data
was stored for offline processing. Once the two feature sets of interest (Half wave rectified output and
Envelope detector output) were normalized, optimum values for learning parameters C and  were obtained
by locating a global minimum using svmTrain. A decision boundary was obtained on the test set and this
model was then integrated into BeagleBone Black to control the gripper. The complete process flow diagram
is shown in Fig. 9.

The PCB schematic designed in this paper was for through the hole components, but we will prepare a new
design using surface mount components as they come in higher precision ranges and are much smaller in size
allowing for a more compact design of the EMG sensor. When the Fast Fourier transform of the signal was
observed, it became evident that instrumentation amplifier fails to completely remove the 50 Hz line noise.
The next version of the PCB design will incorporate a band pass filter to band limit the signal and a notch
filter to remove the line noise. The signal to noise ratio of the device will be measured to ensure high common
rejection ratio and the SNR can also be utilized as a feature for training SVM.

The SVM technique is a robust method for this specific application, and we are currently testing it to measure
its efficiency. In near future we will also utilize other features from the signal to first obtain greater accuracies
and then more degrees of freedom from the same channel of EMG sensor. This demands for multipolar
electrode configuration as it reduces cross talk from surrounding muscle groups and gives a feature rich signal
from the muscle group of interest, [4] as well as choosing muscle groups that are directly innervated by the
nerves.

ACKNOWLEDGEMENT

We would like to thank Dr Swarnalatha for her immense support and help throughout our endeavor. We are
also grateful to Dr Anand Kumar for his continuous prodding to make us try harder to find solutions, Dr D J
Shariff for his inputs on biological perspective, Dr Kalaichelvi and Dr Shazia for their guidance in machine
learning and Dr Mary Lourde for her critique on sensor designing aspects. We would also like to thank Dr
Abhishek Sharma, LNMIIT Jaipur, India, as we achieved our first degree of freedom under his supervision
and Dr Elliot Rouse, Northwestern University Chicago, USA for his quick and succinct replies to any doubts
we have regarding this field. Lastly we would like to thank Mr Thakur and Mr. Hidayatullah for assisting us
in labs, and all our friends who allowed us to record their EMG data.

UGSRC - 6 The Fourth United Arab Emirates Undergraduate Research Competition


BITS Pilani, Dubai Campus

REFERENCES

[1] Peter Konrad, “ABC of EMG – A Practical Introduction to Kinesiological Electromyography” p.


7.
[2] Leslie Cromwell, Fred J. Weibell, Erich A. Pfeiffer, “Biomedical Instruments and Measurements
3rd Edition”.
[3] Stephen Lee and John Kruse “Biopotential Electrode Sensors in ECG/EEG/EMG Systems”,
www.analog.com/MedicalICs.
[4] Muhammad Zahak Jamal, “Signal Acuisition using sEMG & Circuit Design Considereations for
Robotic Prosthesis”, Intech 2012.
[5] Adel S. Sedra, Kenneth C. Smith, “Microelectronic Circuits 5 th Edition”.
[6] ECE 3110 Laboratory Experiment No. 5, “EMG Detector with Audiovisual Output”, Electrical
and Computer Engineering Dept., University of Utah.
[7] www.ti.com, SLOS081H –FEBRUARY 1977–REVISED JANUARY 2014.
[8] http://onsemi.com, Semiconductor Components Industries, LLC, 2013 October, 2013 − Rev. 25.
[9] www.ti.com, SLCS006S –OCTOBER 1979–REVISED AUGUST 2012.
[10] Mariana Mirela Stanescu“A simplified Protocol to analyse the EMG parameters in Brachioradialis
contraction”, ‘Anghel Saligny’ Technical Highschool, Roşiorii de Vede, Romania.
[11] Andrew Ng, https://www.coursera.org/learn/machine-learning.
[12] Jan Jaap, http://www.thingiverse.com/thing:2415

The Fourth United Arab Emirates Undergraduate Research Competition UGSRC - 7

You might also like