You are on page 1of 44

INSTITUTO TECNOLÓGICO DE

MÉRIDA

NAME OF THE PAPER


“MOVEMENT OF THE MOUSE POINTER THROUGH THE MEASUREMENT OF
ELECTROOCULOGRAPHY SIGNALS WITH LABVIEW”

TEAM MEMBERS
BARAJAS LLANES ANDREA GUADALUPE
ENCALADA SALAZAR ALEJANDRO JOSÉ
MEDINA GAMBOA HUMBERTO ANDRÉS
PECH MAY FRANCISCO GEOVANNY
PÉREZ RUÍZ ISMAEL ELIEZER
VALLADARES PÉREZ JOSÉ HUMBERTO

PROFESSOR
MCI. JOEL SÁNCHEZ PAZ

DATE
3/DECEMBRE/2013

NAME OF THE SUBJECT


MODELING OF PHYSIOLOGICAL SYSTEMS

MOVEMENT OF THE MOUSE 1


INDEX
1. Summary……………………………………………………………………………….….6
2. Introduction………………………………………………………………………………..7
3. Antecedent………………………………………………………………………………..12
4. Methodology………………………………………………………………………………14
 Electrooculography……………………………………………………………….….14
 Design of prototype ……………………………………………………………..…..15
 Amplification and filtered
 Stability
 DAQ
 Interface
 Programming environment
5. Results ……………………………………………………………………………………22
6. Conclusion………………………………………………………………………………...34
7. References………………………………………………………………………….….....35
8. Annexes………………………………………………………………………………...…37

MOVEMENT OF THE MOUSE 2


INDEX OF PICTURES

 Figure 1. Modeling eye as a dipole……………………………………………………14


 Figure 2. Location of the electrodes…………………………………………………..14
 Figure 3. EOG ideal waveform when the person looks up at the front and down..14
 Figure 4. Block diagram of the prototype……………………………………………..15
 Figure 5. Diagram of the AD620……………………………………………………….15
 Figure 6. Components used for the filter design……………………………………..16
 Figure 7. Bode diagram…………………………………………………………………16
 Figure 8. Tools that owns the LIFA library…………………………………………….17
 Figure 9. Connectivity Tools Menu paragraph………………………………………..20
 Figure 10. Setup Menu block "Call Library Function"………………………………..20
 Figure 11. Setting Parameters in the Call Library Function…………………………21
 Figure 12. Division of eighth order filter……………………………………………….22
 Figure 13. Poles and zeros graph without the unitary feedback……………………25
 Figure 14. Poles and zeros graph adding a unitary feedback to the function……..26
 Figure 15. Signal representative of the movement to the right and then moving to
the left……………………………………………………………………………………..27
 Figure 16. Signal obtained from the upward movement and the downward
movement immediately………………………………………………………………….27
 Figure 17. Eye blinking………………………………………………………………….28
 Figure 18. Front view of final programa…………………………………………….....28
 Figure 19. Stages of digital processing in LabView…………………………………..29
 Figure 20. Stages blocks the signal reading………………………………………….29
 Figure 21. Init block……………………………………………………………………..30
 Figure 22. Getting the offset value of the signals…………………….…..................30
 Figure 23. Elimination of offset………………………………………………………...31
 Figure 24. Calibration step……………………………………………………………..31
 Figure 25. Evaluation stage cases…………………………………………………….31
 Figure 26. Block evaluation stage cases……………………………………………...32
 Figure 27. Stage actuator implemented through a subvi…………………………....33
 Figure 28. Stage block actuator………………………………………………………..33

MOVEMENT OF THE MOUSE 3


INDEX OF TABLES

 Table 1. Indicator values according to the amplitude of the signal…………….19

 Table 2. Replies of actuator………………………………………………………...19

MOVEMENT OF THE MOUSE 4


ABBREVIATIONS

 USB. Universal Serial Bus

 ATP. Adenosine Triphosphate

 CA2+. Calcium

 CNS Central Nervous System

 PNS. Peripheral Nervous System

 EOG. Electrooculography

 EEG. Electroencephalography

 EMD. Empirical Mode Decomposition

 LIFA. LabView Interface for Arduino

 DAQ. Data Acquisition

 NI-VISA. National Instruments Virtual instrument Software Architecture

 ADC. Analog to-Digital Converter

 V. Volts

 uV. micro Volts

 DLL. Dynamic Library Link

 OS. Operating System

MOVEMENT OF THE MOUSE 5


1. SUMMARY

This paper shows the development of a prototype that attends to people with mobility
disabilities, such as quadriplegics or spastic paralysis patients.

This technique allows detection of eye movements based on recording the potential
difference between the cornea and the retina, these property is used in the project to control
the movement of the mouse cursor in a precise manner on the computer screen. The
prototype is a compact design powered with a voltage that goes from -9V to 9V. This voltage
is provided by batteries.

The use of those devices as well as conventional electrodes made a product with a
relatively low cost as proposed in other jobs.

MOVEMENT OF THE MOUSE 6


2. INTRODUCTION

The motor disability is a condition that has increased considerably. Just in Mexico,
sources of Instituto Nacional de Estadística y Geografía (INEGI) say that about 5% of the
population has a disability of some kind, of which 58% is motor disability. The origin and
nature of such diseases are multiple, but in most cases mental activity and functionality of
the individual's eyes remain intact, the latter being an excellent resource that can enable the
disabled person to continue interacting with their environment by performing practically
normal activities.

There are currently several studies dedicated to the developing of various prototypes
using the electrical signals generated in the eyes movement and obtained by EOG to control
different objects like wheelchair, robotic arms, GUIs assistance to disabled, cursor and
computer keyboard (Rosas-Cholula, Ramírez Cortés, Escamilla Ambrosio & Alarcón
Aquino, 2011)

(Caballero Gaviria, et al., 2011), proposed a human computer interface based on EOG
and consisting of four stages: signal acquisition, filters, amplifiers and pattern recognition
and generating control signals, the prototype uses mixed-signal circuits, which reduces the
number of components thereof, however is only focused on the vertical and horizontal
movements of the cursor.

Before going further, it’s important to know the physiology of the systems involved to
achieve the best recording for the EOG signal. For this project mainly the muscular and
nervous system are involved. Nervous system is divided into two parts, the central nervous
system and peripheral nervous system.

Muscular system

The muscular system consists of the set of skeletal muscles, whose mission is the
body movement. Both muscles and bones constitute the musculoskeletal system, which is
the active part, because the muscles are responsible for the movement of bones.

Skeletal muscles contract in response to nerve impulses. These impulses travel by


motor nerve ending in the muscles. The contact zone between a nerve and a muscle fiber
called striated skeletal neuromuscular junction or endplate.

MOVEMENT OF THE MOUSE 7


The human body has over 600 muscles. These muscles attach directly or indirectly
(through tendons) to bone and usually work in antagonistic pairs, when one contracts the
other relaxes.

Functions of the muscular system

The main functions of the muscular system are:

 Body movement (locomotion) or any of its parts.


 Heat production. Muscles produce 40% of body heat at rest and up to 80% during
the year exercise.
 The maintenance of posture.
 Mimicry: by action of certain muscles, especially of the face, you can take certain
gestures that serve to express feelings.

The musculoskeletal system is divided into two parts:

Axial skeleton: it is composed of the bones of the head, neck and trunk. Protects vital
organs, in this the appendicular skeleton is articulated and in total there are 8 bones.

Appendicular skeleton: it is composed of the bones of the limbs. It is the most mobile
part of the body, and is made of 126 bones

A skeletal muscle structure.

Skeletal muscles are composed of striated muscle fibers that are organized as follows:

 Each muscle fiber is surrounded by a thin membrane of connective tissue called


endomysium.
 Several fibers are grouped in bundles called fascicles. Each part is surrounded by a
layer of connective tissue called perimysium.
 All the fascicles form the muscle, which in turn, is surrounded by a sheath of
connective tissue called epimysium
 Connective tissue components of a muscle joined to form tendon, whereby the
muscle attaches to the bone. In the broad muscles tendons are flattened and are
called aponeuroses.

Also, skeletal muscles have a lot of blood vessels.

MOVEMENT OF THE MOUSE 8


Muscle contraction

The muscle contraction occurs in the following stages:

 A nerve impulse travels down a motor nerve to the motor plate.


 Nerve secretes a small amount of acetylcholine (neurotransmitter).
 Acetylcholine in muscle causes the release of large amounts of Ca2 + ions that were
stored in the sarcoplasmic reticulum.
 Ca2 + ions act on troponin and tropomyosin, regulatory proteins that are part of actin
filament, causing the sliding of the actin and myosin, which determines the
shortening of the sarcomeres and, therefore, muscle fiber.
 Ca2 + ions are pumped back into the sarcoplasmic reticulum, where they will remain
until you get a new nerve impulse.

Muscle contraction requires an input of energy obtained from high-energy bonds of ATP.

Nervous system

The nervous system, along with the endocrine system integrates and controls the many
functions that allow men to regulate its internal environment and react to its external
environment or to address it. The functional unit of the nervous system is a neuron,
consisting of a body containing the cell nucleus, the metabolic machinery in dendrites to
receive stimuli, and an axon that transmits stimuli to other cells. The nervous system is
divided into two parts: the central nervous system and peripheral nervous system.

Central nervous system (CNS)

The central nervous system consists of the brain and spinal cord. It is protected by three
layers: dura (outer membrane), arachnoid mater (middle), pia mater (inner membrane); also
called meninges. In addition, the brain and spinal cord are protected by bone casings, which
are the skull and spine respectively. This is a very complex system, since it is responsible
for perceiving stimuli from the outside world and to transmit impulses muscles and nerves.
The cavities of these bodies (ventricles in the case of the brain and ependymal duct in the
case of the spinal cord) are filled with a clear, colorless liquid, which is called cerebrospinal
fluid. Its functions are varied: it serves as a medium of exchange of certain substances, as

MOVEMENT OF THE MOUSE 9


removal system of waste products, to maintain the proper ionic equilibrium and as
mechanical damping system.

The cells forming the central nervous system are arranged such that two formations
lead to very characteristics: gray matter, consisting of the soma and dendrites of neurons,
in addition to amylenic fibers; and white matter, formed mainly by myelinated nerve
processes (axons), whose function is to drive the information, in addition to myelinated fibers
are what give it that color showing.

In short, all animals whose body has a central nervous system are provided with neural
mechanisms responsible for receiving and processing the sensations gathered by the
receptor organs of the different senses and transmit orders answer accurately to various
effector organs.

Peripheral nervous system (PNS)

This section of the nervous system consists of nerves and neurons that reside or extend
outside the central nervous system (CNS), to the limbs and organs. The main function of
SNP is to connect the central nervous system (CNS) to the limbs and organs. The difference
between this and the CNS is in the peripheral nervous system which is not protected by
bone or blood-brain barrier, allowing atoxins exposure and mechanical damage. The
peripheral nervous system is thus the coordinates, regulates and integrates our internal
organs, through involuntary responses.

It consists of 12 pairs of cranial nerves and 31 pairs of spinal nerves. In the peripheral
nervous system (PNS) Schwann cells help guide the growth of axons and regeneration of
injuries.

Somatic nervous system

 Spinal nerves, which are those that send sensory information (touch, pain) of the
trunk and limbs to the central nervous system through the spinal cord. They also
send position information and status of the muscles and joints of the trunk and limbs
through the spinal cord. Receive motor commands from the spinal cord to control
skeletal muscle. There are a total of 31 pairs of nerves, 4 each with two parts or
roots: a sensitive and a motor.

MOVEMENT OF THE MOUSE 10


The sensitive part is the one that carries impulses from receptors to the spinal cord.

The motor part is what carries impulses from the spinal cord to the corresponding effectors.
Always have to take into account the spinal nerves.

 Cranial nerves that send sensory information from the neck and head toward the
central nervous system. Receive motor commands to control the skeletal muscles
of the neck and head; and are 12 pairs of cranial nerves.

Autonomic nervous system

Regulates all body functions, controls smooth muscle, heart, guts and glands by order
of the central nervous system.

 Parasympathetic branch: is active when the body is at rest, stimulates peristalsis,


relaxes the myocardium, contracted bronchi, among others.
 Sympathetic Branch: Prepare the body for physical activity, increasing heart rate,
dilating the bronchi, contracting the rectum, bladder relaxation, etc.

It is composed by roots, plexus and nerve trunks.

MOVEMENT OF THE MOUSE 11


3. ANTECEDENT

The biopotentials have been used for applications where is needed a system that could
be able to measure and process physiological signals that cause the muscles during the
contraction and relaxation of these. Then, people with disabilities who find it impossible
interact with electronic devices may have a solution or an instrument to manipulate or use
these electronic devices. These biopotentials are obtained and applied for many purposes,
such as controlling the direction in which a wheelchair carriage until now can be controlled
in artificial prostheses with signals obtained from the brain moves.

One of these biopotentials used are those generated by the muscles of the eye. The
EOG has been used to design interfaces for people with disabilities that only allow them to
move their eyes. Gips et al. (1994), the Boston College in the United States, developed a
system called Eagle Eyes, also based on Electrooculography (EOG) to control a computer
mouse pointer. The system performs a spatial location in an x-y plane based on the electrical
potential on the eyes. The system is now used in many schools and libraries in the United
States. [8]

The EOG technique used in this paper is a method that can detect eye movements and
is based on recording the potential difference between the cornea and the retina. The
corneal-retinal potential is produced by hyperpolarization and depolarization of nerve cells
in the retina. The set (cornea-retina) forms a dipole in the previous-posterior axis direction:
positive on the corneal zone and negative on the retinal zone. [6 and 11]

With this antecedent, the tools necessary to know the correct way to measure the
potential generated by muscles that cause muscle movements have been acquired.

What makes this system different to the existing ones is the ability to detect the eyes
flickering. With this, five different signals can be obtained from the measurement. This make
possible to perform more functions than the existing devices.

One of the main obstacles was the EOG biopotential recording. Like most biological
potentials, eye potential needs to be recorded by the best way possible in order to then be
amplified and subsequently filtering to remove the noise signals that may affect the
characteristic signal. Documental investigation on this problem made possible to build a
system able to offer a clean, defined signal.

MOVEMENT OF THE MOUSE 12


In (Rosas-Cholula, et al., 2011), authors present a prototype using EOG signals obtained
indirectly through a commercial wireless set of 16 electrodes. Originally used for signal
acquisition of electroencephalography (EE8G), the cursor position is obtained based on
information from a gyroscope included in the set. In the other hand, the mouse clicks are
generated through voluntary user blinking, recorded in the EOG signals. For that purpose,
they propose a decomposition technique in empirical mode (EMD) as a computational tool
fast and simple, to distinguish between the natural blinking and volunteers for the control.

In (Merino et al., 2010) an algorithm for signal processing EOG was proposed. This
device uses as inputs the derivative and the amplitude level of the signal. The derivative is
used to detect the edges of the signals and the amplitude level to filter noise. Even when
the algorithm shows high expectations, the article does not concludes with a final
implementation.

The previously exposed researches provided the necessary information for the
developing of the amplification and filtering section on this project. Also, the knowledge
obtained with this researches made possible to improve the proposed filtering units and thus,
a cleaner and better signal.

MOVEMENT OF THE MOUSE 13


4. METHODOLOGY

The electrooculography (EOG) is a method of registration of the ocular movements


based on the detection of the potential difference between cornea and retina. When the eye
moves from the central position to the edge, retina approximates to one of the electrodes,
while cornea approaches the opposite electrode. This change on dipole orientation is
reflected by a change on the amplitude and polarity of the signal. Therefore, the
measurement and analysis of this changes allow to determine the movement of the eyes.

The EOG signal can be easily obtained by putting a couple of electrodes near of the
eyes, and a reference electrode as shown in Figure 2. Thus, two channels are needed, one
for the vertical movement and one for the vertical movement. According to previous studies,
EOG signals amplitude is between 5uV and 20 uV per grade with a bandwidth form 0 Hz to
30 Hz.(Singh & Singh, 2012), (Brown, Marmor, Vaegan, Brigell & Brach, 2006). The ideal
EOG wave is shown on figure 3.

Figure 1. Modeling eye as a dipole Figure 2. Location of the electrodes

Figure 3. EOG ideal waveform when the person looks up


at the front and down

MOVEMENT OF THE MOUSE 14


PROTOTYPE DESIGN

Figure 4 shows the block diagram that will be used on this project. The block diagram
is divided in three different sections: 1) Amplification and filtering 2) Analog to digital
Conversion and 3) Computer communication and voltage source.

Figure 4. Block diagram of the prototype

Amplification and filtering


EOG signals have very small amplitudes that goes from 10 uV to 300 uV. Its
bandwidth goes from 0 to 30 Hz (Singh & Singh, 2012).

For the amplification section it was necessary an instrumentation amplifier with a


high level of common mode rejection, to minimize the amount of noise of the signal. Also
the instrumentation amplifier must be able to provide of a huge gain, due to the original
amplitude of the signal.

For this purpose, AD620, an instrumentation amplifier, was used. It was chosen
because of its common mode rejection, and low cost in comparison to other amps. A trim
pot was used to vary the gain of the amplifier. That was because the gain of EOG signal
changes from person to person, and is necessary to suit this parameter to the needs of the
patient. Figure below shows the diagram of the AD620.

Figure 5. Diagram of the AD620

MOVEMENT OF THE MOUSE 15


Electrodes were connected on the inverting and non-inverting pins. Reference pin
was connected to ground to provide the system a reference

For the filtering section, only was used an eight order low-pass filter. It was designed
with the software Filter Pro ® to make the design simpler. For this it was used the
Butterworth approximation, because it provides the circuit a more stable frequency
response. Sallen-Key topology was chosen in order to improve the stability of the system.
The cut frequency of the filter was stablished on 16 Hz. This was made in order to enhance
the noise reduction of the filter, to obtain a cleaner signal. It was designed with a lower
frequency than the exposed in the previous sections because real filters has a margin of
error due to the inaccuracy on the values proposed and the tolerance of the components. It
was necessary to consider this factor in order to obtain a better recording of the signal and
avoid problems with the posterior digital processing. Figure below shows the components
used for the filter design.

Figure 6. Components used for the filter design

Figure 7 also shows the Bode diagram. This represents the frequency response of
the filter. The graph shows that even when the cutoff frequency is stablished in 16 Hz, filter
doesn´t cut exactly on this frequency. Instead of this, there is a progressive decrement on
the gain on the signal from that frequency.

Figure 7. Bode diagram

MOVEMENT OF THE MOUSE 16


After this section, a potentiometer was added in order to control the offset of the signal.

Stability

To check the stability of the system, poles and zeros tool was implemented. The
system consists in a low pass filter 8th order, therefore, for analysis can be separated into
4 low pass filter Sallen Key topology second order. Function below shows the generic function
for an active second order low-pass filter.

𝐾
𝐻(𝑠) =
𝑅1 𝐶1 𝑅2 𝐶2 𝑠 2 + [(1 − 𝐾)𝑅1 𝐶1 + 𝑅1 𝐶2 + 𝑅2 𝐶2 ]𝑠 + 1

DAQ

Microcontroller Arduino was used to digitalize data obtained by the amplification and
filtering block. It was necessary to configure some libraries to the software LabView to make
possible the communication between LabView and the microcontroller and, with this, the
analog to digital conversion.

Interface

USB protocol was used in order to stablish the communication between PC and
Arduino.

Programming enviroment

For Data acquisition it was necessary the implementation of a library called “LabView
Interface for Arduino” (LIFA), designed by National Instruments. This library allows the user
to implement Arduino as a DAQ, as described on previous sections.

In order to use Arduino as a DAQ, it’s necessary to write the code given by LIFA on
the microcontroller. This code, shown on the Annex section, allows NI-VISE to recognize
the device as a valid DAQ.

MOVEMENT OF THE MOUSE 17


Figure 8. Tools that owns the LIFA library

Figure 8 shows the tools for this operation. The block “INIT” enables the
communication between Arduino and PC. Some configurations such as baud rate, port ID,
size of packets and the model of Arduino must be set in order to perform this communication.
The block “CLOSE” ends the communication between the device and LabView. USB
protocol is used to this purpose, as mentioned on previous sections.

Microcontroller both analog and digital ports. The block “LOW LEVEL” allows to
manage the writing and reading of this ports.

The block “SENSOR” contains the different settings for the reading of the information
given by the sensors. It also contains the structures to manage actuators, step-by-step
motors and servo motors.

The block “UTILITY” contains the tools to design specific algorithms and the block
“EXAMPLES” provides the user some examples of these functions.

This section contains, at least, the following steps:

I. EOG signals reading: Samples are reading at the sample frequency defined by
user.
II. Calibration: The Electrooculographic offset signal has levels variants from
person to person, coupled with this, amplification, not only amplifies the signal
itself, but also amplifies the level of offset. At this stage the level sought eliminate
offset digitally in order to have a positive voltage and a negative voltage to the
fixings of the thresholds and thus optimize the evaluation of cases. You will also
would provide a gain to the signal acquired for better handling.

MOVEMENT OF THE MOUSE 18


III. Evaluation of cases: EOG signals have different wave forms according to the
movement made. Threshold were proposed to determine the kind of movement
made by the eye and differentiate the movements from the different artifacts. This
block returns a number depending on the position of the signal. The table below
shows the value returned by the program for the different situations.

Indicator X Axis Y Axis


0 Base line Base line
1 Positive value Base line
2 Base line Positive value
3 Negative value Base line
4 Base line Negative value
5 Positive value Positive value
6 Negative value Positive value
7 Negative value Negative value
8 Positive value Negative value

Table 1. Indicator values according to the amplitude of the signal

IV. Actuator: The actuator for this project, is given by the mouse pointer. This
section uses the number given by the previous section to move the mouse
according to the table shown below.
Indicator Mouse movement
0 Without motion
1 Right
2 Up
3 Left
4 Down
5 Right-up
6 Left-down
7 Left up
8 Rigth down
Table 2. Replies of actuador

MOVEMENT OF THE MOUSE 19


LabView allows the usage of the “Dynamic Library Link”, that are the archives with
the extension .dll. This libraries can be used for more than a program at the same time.
Windows also has its own library called “user32” that manages many functions in the
Operative System, such as movement and events of the mouse pointer.

The image below shows the location of this commands on LabView.

Figure 9. Connectivity tools menu paragraph

In order to use this block is necessary to stablish the in settings. This is possible by
pressing double click on the block. Figure below shows the window for this operation.

Figure 10. Setup menu block “Call Library Function”

MOVEMENT OF THE MOUSE 20


The section “Nameorpath” allows the user to specify the name of the library (if it’s
known) or look for that through the Windows folders. Also, many libraries can have different
functions. The section “Functionname” allows the user to select the specific function for the
block.

The image below shows the window “Parameters” where the in and out parameters
can be set. Section “Functionprotype” shows (in parenthesis) the in and out variables of the
function. To enable the usage of the function is necessary to stablish this variables. The
section “Currentparameter” allows the user to declare the variables used in the function. It’s
important to maintain exactly the same name than shown in the section “Functionprototype”
in order to obtain the correct values for the block.

Figure 11. Setting parameters in the Call Library Function

MOVEMENT OF THE MOUSE 21


5. RESULTS

Stability

Figure 12 shows the four section in which the filter is divided. Then the transference
function for each section is obtained.

Figure 12. Division eighth order filter

For the first filter (H1)

𝐾
𝐻1 (𝑠) =
𝑅1 𝐶1 𝑅2 𝐶2 𝑠 2 + [(1 − 𝐾)𝑅1 𝐶1 + 𝑅1 𝐶2 + 𝑅2 𝐶2 ]𝑠 + 1

Substituting the values,

K=1

R1= 200 KΩ

R2=680 KΩ

C1= 22nF

C2= 33nF

𝐻1 (𝑠)
1
=
(200𝐾𝛺)(22𝑛𝐹)(33𝑛𝐹)(680𝐾𝛺)𝑠 2 + [(1 − 1)(200𝐾𝛺)(22𝑛𝐹) + (200𝐾𝛺)(33𝑛𝐹) + (680𝐾𝛺)(33𝑛𝐹)]𝑠 + 1

1
𝐻1 (𝑠) =
1.086086 ∗ 10−4 𝑠 2 + 0.02904𝑠 + 1

For the second filter (H2)

𝐾
𝐻2 (𝑠) =
𝑅1 𝐶1 𝑅2 𝐶2 𝑠2 + [(1 − 𝐾)𝑅1 𝐶1 + 𝑅1 𝐶2 + 𝑅2 𝐶2 ]𝑠 + 1

MOVEMENT OF THE MOUSE 22


K=1

R1=300 KΩ

R2=430 KΩ

C1=22 nF

C2=33 nF

𝐻2 (𝑠)
1
=
(300𝐾𝛺)(22𝑛𝐹)(33𝑛𝐹)(430𝐾𝛺)𝑠 2 + [(1 − 1)(300𝐾𝛺)(22𝑛𝐹) + (300𝐾𝛺)(33𝑛𝐹) + (430𝐾𝛺)(33𝑛𝐹)]𝑠 + 1

1
𝐻2 (𝑠) =
9.3654 ∗ 10−5 𝑠 2+ 0.02409𝑠 + 1

For the third filter (H3)

𝐾
𝐻3 (𝑠) =
𝑅1 𝐶1 𝑅2 𝐶2 𝑠2 + [(1 − 𝐾)𝑅1 𝐶1 + 𝑅1 𝐶2 + 𝑅2 𝐶2 ]𝑠 + 1

K=1

R1=470 KΩ

R2=620 KΩ

C1=10 nF

C2= 33 nF

𝐻3 (𝑠)
1
=
(470𝐾𝛺)(10𝑛𝐹)(33𝑛𝐹)(620𝐾𝛺)𝑠 2 + [(1 − 1)(470𝐾𝛺)(10𝑛𝐹) + (470𝐾𝛺)(33𝑛𝐹) + (620𝐾𝛺)(33𝑛𝐹)]𝑠 + 1

1
𝐻3 (𝑠) =
9.6162 ∗ 10−5 𝑠 2+ 0.03597𝑠 + 1

For the fourth filter:

𝐾
𝐻4 (𝑠) =
𝑅1 𝐶1 𝑅2 𝐶2 𝑠2 + [(1 − 𝐾)𝑅1 𝐶1 + 𝑅1 𝐶2 + 𝑅2 𝐶2 ]𝑠 + 1

MOVEMENT OF THE MOUSE 23


K=1

R1= 110 KΩ

R2=270 KΩ

C1=10 nF

C2=330 nF

𝐻4 (𝑠)
1
=
(110𝐾𝛺)(10𝑛𝐹)(330𝑛𝐹)(270𝐾𝛺)𝑠 2 + [(1 − 1)(110𝐾𝛺)(10𝑛𝐹) + (110𝐾𝛺)(330𝑛𝐹) + (270𝐾𝛺)(330𝑛𝐹)]𝑠 +

1
𝐻4 (𝑠) =
9.801 ∗ 10−5 𝑠 2+ 0.1254𝑠 + 1

To find the transference functions it was necessary to multiply the functions obtained

𝐻(𝑠) = 𝐻5 (𝑠) ∗ 𝐻6 (𝑠)

1 1
𝐻5 (𝑠) = ( −4 2
)( −5 2
)
1.086086 ∗ 10 𝑠 + 0.02904𝑠 + 1 9.3654 ∗ 10 𝑠 + 0.02409𝑠 + 1

1
𝐻5 (𝑠) = ( )
1.01716298244𝑒 −8 𝑠 4 + 5.336093334𝑒 −6 𝑠 3 + 9.018362𝑒 −4 𝑠 2 + 5.313𝑒 −2 𝑠 + 1

1 1
𝐻6 (𝑠) = ( −5 2
)( −5 2
)
9.6162 ∗ 10 𝑠 + 0.03597𝑠 + 1 9.801 ∗ 10 𝑠 + 0.1254𝑠 + 1

1
𝐻6 (𝑠) = ( )
9.42483762𝑒 𝑠 + 1.55841345𝑒 𝑠 3 + 4.70481𝑒 −3 𝑠 2 + 1.6137𝑒 −1 𝑠 + 1
−9 4 −5

𝐻(𝑠)
1
=( )
1.01716298244𝑒 −8 𝑠 4 + 5.336093334𝑒 −6 𝑠 3 + 9.018362𝑒 −4 𝑠 2 + 5.313𝑒 −2 𝑠 + 1
1
∗( )
9.42483762𝑒 𝑠 + 1.55841345𝑒 𝑠 3 + 4.70481𝑒 −3 𝑠 2 + 1.6137𝑒 −1 𝑠 + 1
−9 4 −5

MOVEMENT OF THE MOUSE 24


1
𝐻(𝑠) =
9.58659594257191𝑒 −17 𝑠 8
+ 2.08807860428076𝑒 −13 𝑠 7 +
1.39513641618246𝑒 𝑠 6 + 4.13017794252002𝑒 −8 𝑠 5
−10

+5.9516348862135𝑒 −6 𝑠 4 + 4.16416090724𝑒 −4 𝑠 3
( +1.41802343𝑒 −2 𝑠 2 + 2.145𝑒 −1 s + 1 )

Image below shows the poles and zeros graph obtained with the transference
function. As is shown, there are no poles on the right side of the graph, so, it’s possible to
say the system is stable. This result is only possible when there no a unitary feedback

Figure.13. Poles and zeros graph without the unitary feedback

List below shows the poles founded for this case.

If a unitary feedback is added the location of poles changes. With this, also the system
stability changes, producing an unstable system, as shown in figure below.

MOVEMENT OF THE MOUSE 25


Figure 14. Poles and zeros graph adding a unitary feedback to the function.

List of poles for this graph are shown below:

Filters

During the procedure previously described, it was possible to obtain, amplify and
filter the EOG signal obtained through the electrodes. This signals represent the different
movements that the eye can do: up, down, left and right. Also it was possible to record
the eye flickering. Images below show the comparison between the amplified signal and
the filtered one.

MOVEMENT OF THE MOUSE 26


Figure 15. Signal representative of the movement to the right and then moving to the left

Figure 16. Signal obtained from the upward movement and the downward movement
immediately

MOVEMENT OF THE MOUSE 27


Figure 17. Eye blinking

Digital results

The following image shows the interface that allows the user to interpret the
information that throws the system. The module settings to visualize how the system is. The
two existing modes are the normal mode and the mode EOG. In normal mode the mouse
can be manipulated with either the touchpad or a conventional mouse. In the EOG so the
mouse can only be controlled by Electrooculography signal. The mouse direction to visualize
the direction in which the mouse is moving in the EOG mode.

Figure 18. Front view of final program


The next figure shows the block diagram of the final program developed in LabView.
For the preparation of the program in LabView, the use of tools called subvis to reduce space

MOVEMENT OF THE MOUSE 28


as well as providing efficiency in correcting errors are implemented. The section enclosed
in the black box represents the readout of the signal, the enclosed in the red square
represents the calibration step, the section enclosed in the blue box represents the
evaluation section of the cases and finally the enclosed section in the green box represents
the section of the actuator. Each of these parts will go explaining in detail below.

Figure 19. Stages of digital processing in LabView

I. SIGNAL READING

Signal reading was implemented through the connection of the blocks “INIT” and
“CLOSE” put outside the “WHILE” cycle. For this, it was necessary the usage of the block
“ANALOG READ.” Two of this blocks was used for this section, one for the X axis (right and
left movements) and one for the Y axis (up and down movements).

Figure 20. Stages blocks the signal reading

MOVEMENT OF THE MOUSE 29


Figure 21 shows the configuration for the
“INIT” block. The microcontroller Arduino 1 was used
for this project with the following configurations: baud
rate of 11520, packet size of 15 bytes and for the
communication between PC and the device, the
protocol USB was used.

Figure 21. Init block

II. CALIBRATION SECTION.

The digital processing is performed is as follows:

1. Pressing a button, the case will receive a true value, thus a series of samples of the
signal to the signal from the X axis and Y axis is take 1000 samples were taken, then
is the sum of these and is averaged in a thousand to get the average value of the
offset signal having then this value is returned as a double variable. This block can
be seen in the following figure:

Figure 22. Getting the offset value of the signals

MOVEMENT OF THE MOUSE 30


2. In the next phase offset is removed through a subtraction between the input signal
and the value obtained above. In addition to gain a better way to use the magnitudes
of the signals is established. This block can be seen in the following figure:

Figure 23. Elimination of offset.

In the next image can be displayed reduced so the calibration step. Each box
represents a subvi. The section marked with the number 1 and number 2 show the detailed
processes in subsection b, respectively, described above.

Figure 24. Calibration step

III. EVALUATION OF CASES.

The next image shows the evaluation stage of the cases, which was implemented with
a subvi.

Figure 25. Evaluation stage cases

MOVEMENT OF THE MOUSE 31


Figure below shows the blocks used on the evaluation section. Comparators return a
Boolean indicator (True or False) according to the proposed condition. Constant visualized
represent the temporary threshold. The principal “case” sentence asks if any of the threshold
was reached. When threshold is reached the “OR” indicator sends the Boolean “true.” A
series of questions are made to this to make the correct comparison. The structural code for
this section is described in Annexes II.

Figure 26. Block evaluation stage cases

IV. ACTUATOR.

The next figure shows the stage of the actuator by implementing a subvi. The bottom,
can be represented through a button, the action being undertaken by the mouse. It
serves as an indicator.

MOVEMENT OF THE MOUSE 32


Figure 27. Stage actuator implemented through a subvi

Figure 27 shows the block diagram of the Actuator section. The “CASE” block represents
the table previously shown. Function “CALL,” after the “CASE” function, allows the
movement of the mouse pointer. Two feedback loops were added in order to keep the
position of the mouse pointer. Also, initial conditions set the pointer at the center of the
display, considering a display of 1366 x 768 pixels.

Figure 28. Stage block actuator

MOVEMENT OF THE MOUSE 33


6. CONCLUSION

During the development of this document could be obtained the electrooculography


signal to both left and right movements, such as up and down. This signal was amplified,
filtered and digitally processed to achieve the movement of a mouse pointer.

Throughout the development of the work other problems arose. The first of these was
the way how to enter the Electrooculographic signal to the computer, since the documents
consulted for this work, income from pulse to an electromechanical mouse set. However this
creates many problems due to bearing system and pulses recorded in a mouse; so the
implementation of an interface was necessary with greater ease of use. To this was resorted
to various tools foregoing as the Arduino microcontroller, the LabView software, and some
own libraries Windows operating system. With this we can say that the system proposed in
this paper was more efficient and easy to procesas than earlier, which is an advantage.

In the area of filtering and amplification, various problems due to the variability in the
signal presented person to person. This results in a large variability in the amplitude of the
signal producing saturation of the operational amplifiers and baseline shift. These two, with
main problems, which must be solved to facilitate digital signal processing. The documents
consulted in the preparation of this project did not have a solution to these problems and in
many cases were not mentioned. In the case of the amplitude, a precision potentiometer
was placed on the AD620 amplifier stage, this allowed to vary the gain saturation point where
the signal is produced. In the case of the baseline, a potentiometer is used in the output of
the filtering step to vary the baseline, since if this is moved above the 5 V, the converter will
read it as a saturation, and only will display the measurement of 5 V. If the baseline remains
negative, the microcontroller will not be able to read the data. The above was an
improvement at this stage with respect to other works, could be obtained as a means of
calibration of the signal obtained.

Added to this, the cutoff frequency of 30 Hz was reduced to 16 Hz, which improved noise
rejection signal. Note that it could not remove the DC component of the signal, because this
variation is what gives rise to the signal.

In future work the improvement mainly be sought in the form of taking the signal. This
will require the use of other electrodes representing greater comfort for the patient and better
fixation and duration for taking signal. It will also be necessary to improve the shape of signal
calibration for better digital processing and better results.

MOVEMENT OF THE MOUSE 34


7. REFERENCES

 [1]. Acharya V. (2011). Improving Common-Mode Rejection Using the Right-Leg


Drive Amplifier, (Reporte de aplicación SBAA188), Texas Instruments.
 [2]. Brown, M., Marmor, M., Vaegan, Zrenner, E., Brigell, M. & Bach, M. (2006).
ISCEV Standard for Clinical Electro-oculography EOG. Documenta
Ophthalmologica, Vol. 113 (3), pp. 205–212.
 [3]. Bulling, A., Ward, J. A., Gellersen, H. &Troster, G. (2010). Eye
movementanalysis for activity recognition using electrooculography. IEEE
transactions on patternanalysis and machine intelligence. Vol. 33(4). pp. 741-743.
 [4]. Caballero Gaviria, A.D., Castro Miller, I.D., Ordoñez Medina, S & Rojas
González, D.M (2011) Implementación de una interfaz hombre-computador basada
en registros EOG mediante circuitos de señal mixta PSoC. Proceeding of the V Latin
American Congressonbiomedical engineering, CLAIB 2011, La Habana, Cuba, pp.
16-21.
 [5]. Choudhury, S. R., Venkataramanan, S., Nemade, H. B. &Sahambi, J. S. (2005).
Design and Development of a Novel EOG Biopotential Amplifier. International
Journal of Business and Emerging Markets, Vol. 7(5), pp. 271-274.
 [6]. Electrooculografía. Octubre 2007. Disponible en:
http://electronica.eia.edu.co/PROYECTOS/Electroculografia/introduccion.htm
 [7]. Gerard J. Tortora, Bergen Community College Bryan H. Derrickson, Valencia
Community College. (2011). Principios de anatomía y fisiología 11ª edición, EAN:
9789687988771, 1650 páginas
 [8]. Gips J. The Eagle eyes project, Boston College. Octubre de 2006. Disponible
en: http://www.bc.edu/schools/csom/eagleeyes/
 [9]. Rosas-Cholula, G., Ramírez Cortés, J.M., Escamilla Ambrosio, J. & Alarcón
Aquino V. (2011). On the development of a simple EOG-based mouse with
BCI technology applying empirical modele composition and DWT. Proceeding of the
15th International graphonomics society Conference, IGS2011, Cancún, México. pp.
70-73.
 [10]. Singh, H. & Singh, J. (2012). A review on electrooculography. International
Journal of Advanced Engineering Technology, Vol. 3(4), pp.112-122.

MOVEMENT OF THE MOUSE 35


 [11]. W Webster J. G. Medical Instrumentation, application and design Ed Wiley,
1998. Capítulo 3, 89-132; capítulo 4, 138-139 y 151-155; capítulo 5, 183-226;
capítulo 6, 233-281; capítulo 14, 623-656.

MOVEMENT OF THE MOUSE 36


8. ANNEXES

 Anexo 1

/**************************************************************************

** LVFA_Firmware - Provides Basic Arduino Sketch For InterfacingWithLabVIEW.

** Written By: Sam Kristoff - National Instruments

** WrittenOn: November 2010

** Last Updated: Dec 2011 - Kevin Fort - National Instruments

** This File May Be Modified And Re-DistributedFreely. Original File Content

** Written By Sam Kristoff And Available At www.ni.com/arduino.

/*******************************************************************************

** Includes.

********************************************************************************

// Standard includes. Theseshouldalways be included.

#include<Wire.h>

#include<SPI.h>

#include<Servo.h>

#include "LabVIEWInterface.h"

/*******************************************************************************

** setup()

** Initialize the Arduino and setup serial communication.

** Input: None

** Output: None

********************************************************************************

voidsetup()

// Initialize Serial Port WithThe Default Baud Rate

syncLV();

// Place your custom setup code here

MOVEMENT OF THE MOUSE 37


}

/*********************************************************************************

loop()

** Themainloop. Thislooprunscontinuouslyonthe Arduino. It

** receives and processes serial commandsfromLabVIEW.

** Input: None

** Output: None

********************************************************************************void loop()

// Check for commands from LabVIEW and process them.

checkForCommand();

// Place your custom loop code here (this may slow down communication with LabVIEW)

if(acqMode==1)

sampleContinously();

/******************************************************************************

** LVFA_Firmware - Provides Functions For Interfacing With The Arduino Uno

** Written By: Sam Kristoff - National Instruments

** Written On: November 2010

** Last Updated: Dec 2011 - Kevin Fort - National Instruments

** This File May Be Modified And Re-Distributed Freely. Original File Content

** Written By Sam Kristoff And Available At www.ni.com/arduino.

********************************************************************************

/*******************************************************************************

** Define Constants

** Define directives providing meaningful names for constant values.

MOVEMENT OF THE MOUSE 38


*******************************************************************************

#define FIRMWARE_MAJOR 02

#define FIRMWARE_MINOR 00

#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)

#define DEFAULTBAUDRATE 9600 // Defines The Default Serial Baud Rate (This must
match the baud rate specifid in LabVIEW)

#else

#define DEFAULTBAUDRATE 115200

#endif

#define MODE_DEFAULT 0 // Defines Arduino Modes (Currently Not Used)

#define COMMANDLENGTH 15 // Defines The Number Of Bytes In A Single LabVIEW


Command (This must match the packet size specifid in LabVIEW)

#define STEPPER_SUPPORT 1 // Defines Whether The Stepper Library Is Included -


Comment This Line To Exclude Stepper Support

// Declare Variables

unsigned char currentCommand[COMMANDLENGTH]; // The Current Command For The


Arduino To Process

//Globals for continuous aquisition

unsigned char acqMode;

unsigned char contAcqPin;

floatcontAcqSpeed;

floatacquisitionPeriod;

floatiterationsFlt;

int iterations;

floatdelayTime;

/******************************************************************************

** syncLV

** Synchronizes with LabVIEW and sends info about the board and firmware
(Unimplemented)

** Input: None

MOVEMENT OF THE MOUSE 39


** Output: None

********************************************************************************

voidsyncLV();

/*******************************************************************************

** setMode

** Sets the mode of the Arduino (Reserved For Future Use)

** Input: Int - Mode

** Output: None

********************************************************************************

voidsetMode(int mode);

/******************************************************************************

** checkForCommand

** Checks for new commands from LabVIEW and processes them if any exist

** Input: None

** Output: 1 - Command received and processed

** 0 - No new command

********************************************************************************

intcheckForCommand(void);

/******************************************************************************

** processCommand

** Processes a given command

** Input: command of COMMANDLENGTH bytes

** Output: 1 - Command received and processed

** 0 - No new command

*******************************************************************************

voidprocessCommand(unsigned char command[]);

/******************************************************************************

** writeDigitalPort

MOVEMENT OF THE MOUSE 40


** Write values to DIO pins 0 - 13. Pins must first be configured as outputs.

** Input: Command containing digital port data

** Output: None

********************************************************************************

voidwriteDigitalPort(unsigned char command[]);

/******************************************************************************

** analogReadPort

** Reads all 6 analog input ports, builds 8 byte packet, send via RS232.

** Input: None

** Output: None

********************************************************************************

voidanalogReadPort();

/******************************************************************************

** sevenSegment_Config

** Configure digital I/O pins to use for seven segment display. Pins are stored in
sevenSegmentPins array.

** Input: Pins to use for seven segment LED [A, B, C, D, E, F, G, DP]

** Output: None

*******************************************************************************

voidsevenSegment_Config(unsigned char command[]);

/******************************************************************************

** sevenSegment_Write

** Write values to sevenSegment display. Must first use sevenSegment_Configure

** Input: Eight values to write to seven segment display

** Output: None

*******************************************************************************

voidsevenSegment_Write(unsigned char command[]);

/******************************************************************************

** spi_setClockDivider

MOVEMENT OF THE MOUSE 41


** Set the SPI Clock Divisor

** Input: SPI Clock Divider 2, 4, 8, 16, 32, 64, 128

** Output: None

*******************************************************************************

voidspi_setClockDivider(unsigned char divider);

/******************************************************************************

** spi_sendReceive

** Sens / Receive SPI Data

** Input: Command Packet

** Output: None (This command sends one serail byte back to LV for each data byte.

********************************************************************************

voidspi_sendReceive(unsigned char command[]);

/******************************************************************************

** checksum_Compute

** Compute Packet Checksum

** Input: Command Packet

** Output: Char Checksum Value

********************************************************************************

unsigned char checksum_Compute(unsigned char command[]);

/******************************************************************************

** checksum_Test

** Compute Packet Checksum And Test Against Included Checksum

** Input: Command Packet

** Output: 0 If Checksums Are Equal, Else 1

*******************************************************************************

intchecksum_Test(unsigned char command[]);

/******************************************************************************

MOVEMENT OF THE MOUSE 42


** AccelStepper_Write

** Parse command packet and write speed, direction, and number of steps to travel

** Input: Command Packet

** Output: None

*******************************************************************************

voidAccelStepper_Write(unsigned char command[]);

/******************************************************************************

** SampleContinuosly

** Returns several analog input points at once.

** Input: void

** Output: void

*******************************************************************************

voidsampleContinously(void);

/******************************************************************************

** finiteAcquisition

** Returns the number of samples specified at the rate specified.

** Input: pin to sampe on, speed to sample at, number of samples

** Output: void

********************************************************************************

voidfiniteAcquisition(int analogPin, float acquisitionSpeed, int numberOfSamples );

/******************************************************************************

** lcd_print

** Prints Data to the LCD With The Given Base

** Input: Command Packet

** Output: None

*******************************************************************************

voidlcd_print(unsigned char command[]);

MOVEMENT OF THE MOUSE 43


 Anexo 2

if (A0>x1){
if (A1>y1){
'MOVIMIENTO DEL EJE X POSITIVO, MOVIMIENTO DE EJE Y POSITIVO'
}
else if(A1<y2){
'MOVIMIENTO DEL EJE X POSITIVO, MOVIMIENTO DE EJE Y NEGATIVO'
}
else{
'MOVIMIENTO DEL EJE X POSITIVO. EJE Y ESTATICO'
}
}
else if(A0<X2){
if (A1>y1){
'MOVIMIENTO DEL EJE X NEGATIVO, MOVIMIENTO DE EJE Y POSITIVO'
}
else if(A1<y2){
'MOVIMIENTO DEL EJE X NEGATIVO, MOVIMIENTO DE EJE Y NEGATIVO'
}
else{
'MOVIMIENTO DEL EJE X NEGATIVO. EJE Y ESTATICO'
}
else {
if (A1>y1){
'MOVIMIENTO DE EJE Y POSITIVO'
}
else if(A1<y2){
'MOVIMIENTO DE EJE Y NEGATIVO'
}
}

MOVEMENT OF THE MOUSE 44

You might also like