Monday, May 28, 2012

Problems...

Week  8
            Week 8's main objective was to finally obtain signals from both the EOG and EMG electrodes. This seemed plausible because the drivers were installed on the computer and the batteries were attached to the circuit boards, unlike the previous week.  After placing the electrodes and turning everything on, no signals came up on the MATLAB plots. A lot of thought went into figuring out why none of the signals were appearing.  A lab fellow suggested that an oscilloscope should be used to map out the signal and check its amplification by using the function generator.  After fiddling around with the equipment for a while, the lab period ended. A meeting with DJ, the advisor, was set up in order to figure out the source of the problem. The first problem was that the 2 data acquisition codes were saved under the same script and they should not have been. One of them was merely a practice to understand the commands in the real time code, and the other was the actual real time readings. Because they were both being run at the same time, it did not work. 
            After separating them, the signals still did not work. This occurred because the incorrect ports were specified in the MATLAB code, which was a simple fix.  After this, the signals were appearing on the MATLAB plots, but instead of being centered at 0 volts, all of the signal was occurring around 9 volts. This could be because such a large gain was used and a little noise from the amplification was amplified as well. Also, the electrodes noises were probably amplified a lot. This causes a problem for reading the signals, which prohibits the signals from being useful in the MATLAB code. Because of this, the goal for the following week is to install a capacitor at the end of the electrode input wires in order to remove the DC signal. This will hopefully correct the signals and put them down around the 0 volt range.

Thursday, May 17, 2012

Signal Acquisition System

Week 7
The next step in our project was to put all of the physical pieces together. The connection of the computer, data acquisition board, circuit boards and the person using the device was first on our agenda, and was readily placed on the table. For the DAQ to be able to work with both the computer and the circuit boards, a driver needed to be installed on the computer being used to accommodate the signals and MATLAB code.

Figure 1: Data Acquisition Board input diagram.
The next connection was the DAQ to the circuit board. Because the ports on our DAQ were not labeled, we used the diagram, found in Figure 1. We used ports 1, 2 and 3. For every analog input, there is a matching ground input. Additionally, there are two sets of inputs for the EOG signal circuit board (ports 2 and 3), and a single set of inputs for the EMG signal circuit board (port 1). Each of the wires then connected to the corresponding port on each circuit board.
Figure 2: The entire configuration of the system.
Finally, the wires from the circuit boards to the electrodes were connected, and then the electrodes were stuck to the face of the user. The entire setup is shown in Figure 2.  Unfortunately, the adhesive on the electrodes were very weak, and fell off of the face under the weight of the alligator clips. To solve this, we will either use additional adhesive, or find electrodes that will stick better to the face. 

Monday, May 14, 2012

MATLAB Implementation One

As mentioned in Week 6's post, a website was found containing code  that could be run through MATLAB that would programmatically control the mouse movements on a computer screen.  Currently,  MATLAB does not its own code that can access cursor movement, whereas a Java class, more specifically "java.awt.Robot," can.  This Java class executes cursor functions which can be manipulated via MATLAB code.  One of the Java Class functions found was a mouse clicking script.  Figure 1 shows an example code for a particular mouse clicking function.



import java.awt.Robot;
import java.awt.event.*;
mouse = Robot;

mouse.mousePress(InputEvent.BUTTON3_MASK);
mouse.mouseRelease(InputEvent.BUTTON3_MASK);
 
 








Figure 1: Java class code used to programmatically click the mouse on a computer screen.

Also, another code was found that demonstrated how to move a cursor on a computer screen.  When this code was run, the cursor would begin in the upper left hand corner of the computer screen and move down diagonally because it follows the screen resolution defined by MATLAB.



import java.awt.Robot;
mouse = Robot;

mouse.mouseMove(0, 0);
screenSize = get(0, 'screensize');
for i = 1: screenSize(4)
mouse.mouseMove(i, i);
pause(0.00001);
end
 
 














Figure 2: Java class code used to programmatically move the cursor on a computer screen.

            Using these Java class codes, the goal is to be able to use the electrodes to control the mouse movements instead of manually picking points in which the cursor would be moved to.  The plan is to create a function that takes the inputs of initial position, direction of movement, and extent of motion to determine a new position of the cursor.  Then, the new position would be looped into the initial position of the function to create a new final position.  As for the mouse clicking, a function was created that takes the input of type, amount, and delay to determine whether the mouse was clicked and released or was not.  The type differentiates between left and right clicking of the mouse, which is expressed in a switch that executes code that follows the switch.  The amount determines how often the mouse would be clicked and released, expressed by a for loop surrounding the pressing and releasing action.  The delay is the amount of time of delay between clicking and releasing the mouse.

Saturday, May 12, 2012

Mouse Movement & Circuit Board

Week 6:
      During the week 6, the MATLAB team began the code. The internet was used to understand the concept behind the coding and the various functions that would need to used. While researching the group came across a JAVA applet that included code which was set to make the mouse move from a predefined point on the computer screen to the opposite/diagonal corner. There was also a command in the code that caused the mouse to click. This program was used to assist the group in creating further code for the project. 
The website where the code was found is:
http://www.mathworks.com/support/solutions/en/data/1-2X10AT/index.html?solution=1-2X10AT
      To make the project cohesive the group decided to also use MATLAB for data acquisition. This minimizes the cross over of data between the LabVIEW and MATLAB. 
      Outside the classroom time the group met with DJ to work on MATLAB coding and to solder the circuit boards and electrode leads. Since the code, found earlier in the week, was preset to carryout a certain pattern. To modify the code to work with the project a function needs to be added to the code. This will allow for the mouse to perform according to the signal that is received from the electrodes. 
      Two circuit boards, each containing a switch, LED's, resistors, amplifier, battery leads, and connectors for the alligator clips were soldered. The electrode leads are connected to the electrodes which are attached to various muscles on the face. The the signal is then amplified with the instrumentation amplifier. This amplified signal is sent through the connection between the circuit board and the data acquisition to the computer to generate signal waves. 
Figure 1: The picture shows the completed circuit board with all of the components.

Tuesday, May 8, 2012

EOG/EMG Instrumentation Questions


Where does the electrical conduction in your muscles of interest come from?


In the cases of both EOG and EMG signals, the electrical conduction comes from the excitation of a motor unit, which consists of several muscle fibers and motoneurons. These motoneurons stem from the Central Nervous System and are used to control muscles. When this unit is in an excited state, there is a transfer of ions across a cell’s membrane. This transfer of ions changes the electric potential, essentially changing the polarity of the membrane [1].


In the case of EOG signal capturing, the measurement of electrical conduction occurs on the contours of the eyes muscles (i.e. superior/inferior oblique and rectus, and medial/lateral rectus). When the eyes are rotated in a particular direction, the light passing through the cornea is altered where it is later captured by the retina. The retina is composed of seven layers of cells that act as a neural receiver from the network of muscles that act on it [1]. As previously mentioned, the neurons are transmitted through motor units that trigger the muscles behind the eye. Placing electrodes on the sides of the eyes can show which muscles have formed dipoles, indicating the direction in which the eye is turned.


EMG signal captures the muscular activity of skeletal muscles. For the clicking controls of the mouse, the masseter (jaw muscles) will be used.

What does the electrical signal taken from their muscle of interest look like and why (i.e. shape when activated/deactivated, signal amplitude, etc)


The electrical signal taken from the EOG-measured muscles shows pulses in either the positive or negative direction depending on the polarity of the particular dipole. The signal shows a DC signal because it behaves like a single dipole and stabilizes once the eye muscles show no more change in retina rotation. Since the EOG signals shows a stabilization in electrical potential when no additional rotation of the eye occurs, the voltage output can determine the degree at which the eye is turned. The magnitude of the EOG plot indicates how much the eye is turned and the orientation with respect to the DC offset indicates the direction at which the eye is turned. 
Figure 1 shows an example of the raw signal from an EOG reading.



The electrical signal taken from the EMG- measured jaw muscles show more spikes, partially due to the several dipoles that are captured by the electrode. The "disorderly" group of action potentials caused by the numerous muscle fibers activated can be seen in Figure 2.
Figure 2 shows an example of the raw signal from an EMG reading.

Using 9V batteries, the two amplifiers in the INA2126 can produce signals in the range of -9V to +9V each. What should the gain used for the amplifiers be and why?


The raw signal of an EOG signal ranges from 15 to 200 microvolts [2]. In order for the signal to be in the desired threshold, a gain of 10,000 will be used in order to bring the signal from microvolts to volts. This would lead to an amplitude of roughly 0.15 to 2 volts, which comfortably satisfies the given range of voltage. 


The raw signal for an EMG signal tends to be roughly around 260 microvolts. In order for this signal to reach a desirable threshold, a gain of 5,000 would be used. Then, the total amplitude of the voltage would be approximately 1.3 V.


Using the INA2126 datasheet, what should the value of the gain resistor R_G be, given the above information?


The value of the gain resistor should be 8.0 ohms according to the designated gain for the EOG signal.
The value of the gain resistor should be 16.0 ohms according to the designated gain for the EMG signal.  


     References 
[1] (2001). Fundamental Concepts in EMG Signal Acquisition. [Online] Available:
http://www.delsys.com/Attachments_pdf/WP_Sampling1-4.pdf


[2] (2006). QUADRIPLEGIA (In Encyclopedia of Special Education: A Reference for the Education of the Handicapped and Other Exceptional Children and Adults.) [Online] Available: http://www.credoreference.com/entry/wileyse/quadriplegia

Wednesday, May 2, 2012

Preliminary LabVIEW Code

Week 5:

           A preliminary code in LabVIEW was created after playing around with the different aspects that it offers. LabVIEW seems to be the best option as far as receiving and filtering signals, and so far the visual code makes it seem simple. Unfortunately, the DAQ is not set up yet, so the code cannot be fully completed because it needs a source of input. The code can be seen in Figure 1. It begins with a start function, followed by a DAQ assistant that tells the program which port to get the signal from and what kind of signal it is. From there, the signal will be filtered using a filter block. The filtered signal will then be translated to a real-time graph and table. A sample of these graphs and tables are seen in Figure 2.

Figure 1: Preliminary code in LabVIEW that will acquire, filter, and show the data from the electrodes.
Figure 2: Sample graphs and tables that will be used to gather and analyze EOG signals.

Friday, April 27, 2012

Change Can Be a Good Thing!


Week 4:
During the week four lab, the plan was to connect the mouse to the oscilloscope to determine what each wire in the mouse specifically controls (for example, moving left or right clicking), which would give a better understanding of how the mouse works. This would also be helpful when interfacing the signals from the EOG tests with the mouse to control the movement on the screen.
After examining the internal system of the mouse, there was a realization that there was a a micro-computer chip that converts the movements from the mouse into digital signals that the computer can read.  This chip seen in Figure 1 was pre-programmed, so it would be very difficult to interpret the signals of the mouse from the wires. The signals would not give readings for the individual movements of the mouse.
                              
 Figure 1: Close-Up View of the Pre-Programmed Micro-Computer Chip (Black Rectangle on the Left)

Entirely, the idea of interfacing the mouse with the electrode signals would be too difficult and time consuming, due to the complexity of the computer chip inside and the wires. Because of this, it was ultimately decided that a MATLAB simulation program would be created to see how a mouse can control the cursor on a computer screen instead of actually interfacing with the wheel mouse. Essentially, there will be a MATLAB window that will act as a computer screen and there will be a code that will work in conjunction with the electrode signals captured to replicate the idea of an EOG controlled mouse.  
Because of the changes made, the week's procedure was slightly altered.  During the remainder of the time period, the mechanical team, now mainly the MATLAB programming team, watched tutorial videos to assist in creating the MATLAB program later on in the project. The video tutorials provide a basis for the complicated code that needs to be written, especially helpful for Freshmen with minor MATLAB programming experience.

Monday, April 23, 2012

The Anatomy of a Mouse!

Week 3:
         The first thing attempted this week for the project on the mechanics side was to try to understand how a wheel mouse works. To do this, an ordinary wheel mouse was taken apart in order to see how the mechanics work and how everything was put together. Below in Figure 1 is a diagram of the components of the mouse labeled with their respective functions. Basically, there is a rubber ball located on the underside of the mouse. The ball is kept in place by a spring that forces the ball against the top and left sides. Because the ball is against these sides, when the mouse is moved, the ball rotates the top and side rods. The top rod is moved when the mouse is moved vertically, and the side rod is moved when the mouse is moved horizontally. The rod then spins the wheels, which are made with little plastic spokes around the edges (seen in Figure 2). There is a light emitter that goes through these spokes and is read by a light detector. The number of times the beam is detected by the light detector is the way that the computer measures how far and how quickly the mouse is being pushed. Besides those main parts of the mouse, there is also a chip that converts the mouse movements into digital signals that can be read by the computer. Towards the top of the mouse are switches that detect the right and left clicks of the mouse.  There is also a scroll wheel in the center. Like all circuit boards, there is a capacitor and resistors (not labeled due to lack of space). Lastly, there are different wires (as of yet, their exact functions are unknown) that connect to a PS/2, which is an outdated connection to the computer. Because of this, a converter to USB is currently being ordered so the mouse can be connected to laptops.

Figure 1: Labeled Diagram of the Components of a Wheel Mouse

Figure 2: Close-Up View of the Wheel along with the LED Emitter and Receptor

        Also, one of the goals of the week for the electrode team was to research how an electrode interface would be implemented. In addition to learning where to place the electrodes on the user, it was also important to find out the magnitude of signal being received from each electrode. That way, there would be a better understanding as to what extent the raw input should be amplified. 
        Below in Figure 3 shows the configuration of the electrodes when placed on the user's face. These electrodes will capture the EOG signals when the user moves their eyes. This signal is produced when light enters the retina, where the light signal is processed into a neural signal.

Figure 3: Sensor Placements for EOG Signals


Friday, April 13, 2012

"With Great Power Comes Great Responsibility"

Week 2:
               After finally deciding on a project topic, the group used the class time to discuss the final decision with the advisor. The proposed idea was approved, so from there the roles of the project were assigned. Jasmin and Gabrielle were assigned the role of Mouse Prototyping Interface. Maxime was assigned the role of Physiological Interfacing via Instrumentation. Jenna was assigned the role of Signal Processing and Extraction. Once the roles were assigned, a general timeline for the project was established, as seen in Table 1.

Table 1: Schedule for the course of the project

Week
Electrode- team
Mechanical-team
3
Sensor placement justification; determine specs
Take apart mouse
4
Amplification design; Signal processing
Run through oscilloscope/determine pulses for specific actions
5
Signal filtering/ spec matching
Run through oscilloscope/determine pulses for specific actions
6
Calibration of pulse sensitivity
Run through oscilloscope/determine pulses for specific actions
7
EOG test/ make sure sensor activation initiates proper LEDs
Convert LED signals to proper pulses to feed through USB
8
Assembly of circuit board
Assembly of circuit board
9
Final touches/error modifications
Final touches/error modifications
10
Presentation + Report
Presentation + Report

          After creating the weekly goals of the project, this blogging website was created in order to keep track of the weekly activities. It will be updated at least once a week to show the progress of the project. In week 3, a project proposal page will be posted, which is what the remainder of this week's lab period was dedicated to.

Monday, April 9, 2012

Bioelectrically Controlled Devices


                Week 1:

                In Section 33 held on Tuesday from 1-3, the project topic is "Bioelectrically Controlled Devices".  This topic is mainly geared towards Biomedical Engineers with an interest who have an interest in Biomedical devices. Bioelectrically controlled devices usually involve the use of signals gathered by sensors from muscle movements, such as EOG or EMG sensors, along with amplifiers. Projects under this topic can deal with actions such as muscle movements, brain activity, and even the cardiac cycle. The Biomedical Engineering field has been able to produce a large amount of Bioelectrically Controlled Devices in the past few years, so this is definitely a prevalent field of study and a great topic for students to explore.

                Even though this Engineering lab section has a proposed topic, the specific project of each group will vary and needs to be determined. Group 8 had a difficult time coming up with a subtopic, so a meeting with DJ, the project advisor, was set up to discuss possible projects. Some of the project ideas were as follows:
  • An airplane simulation game controlled by eye and arm muscle movements
  • Controlling the duck hunt video game with arm muscle contractions
  • Controlling a computer mouse via the use of EOG and EMG signals
  • Controlling an E-reader with eye movements
                The general consensus of group 8 was to focus on a Bioelectrically Controlled Device that would be an assistive, making it more relevant to the Biomedical Engineering field.  Because of this, the ultimate decision was to make the project "EOG Controlled Mouse Movement".