Group 036-01: Using Biotechnology to Control a Music Player
Saturday, June 9, 2012
Monday, June 4, 2012
Week Ten Updates
The final touches were put on the project. The algorithm was changed slightly to include a temporary variable so that the command function is only called when the signal energy crosses the threshold. This prevents the function from executing the same command many times rapidly.
The electrodes continued to cause problems. The alligator clamps tend to peel the corners off of the face, and the electrodes are so sensitive that they must be completely attached or they will not detect muscle contractions properly. More adhesive electrodes would mitigate this problem.
We recorded a demo demonstrating control of foobar2000 using EMG signals.
The electrodes continued to cause problems. The alligator clamps tend to peel the corners off of the face, and the electrodes are so sensitive that they must be completely attached or they will not detect muscle contractions properly. More adhesive electrodes would mitigate this problem.
We recorded a demo demonstrating control of foobar2000 using EMG signals.
The final script and command function can be found here:
http://www.mediafire.com/?gnwzcfvslxr42oi
http://www.mediafire.com/?iy545a746d6y3nc
Friday, June 1, 2012
Week Nine Updates
The final adjustments to the project were made. Lines of MATLAB code were added so now skip ahead, skip backwards, and play/pause can all be controlled with blinks. The script was also edited to display the signal graphs for both eyes simultaneously.
There is some trouble with the electrodes because they are not sticking to the face very well. They are extremely touchy and must be completely attached to the the face to pick up a signal. There is also a small delay in the rolling display of the signals detected because of the amount of signals being read. Additionally, a few more adjustments need to be made that will cause the algorithm to wait a few milliseconds after reading one jump in energy before executing a command. This will fix the problem experienced when one eye is read before the other eye in a double blink.
![]() |
Plots for both eye signals |
There is some trouble with the electrodes because they are not sticking to the face very well. They are extremely touchy and must be completely attached to the the face to pick up a signal. There is also a small delay in the rolling display of the signals detected because of the amount of signals being read. Additionally, a few more adjustments need to be made that will cause the algorithm to wait a few milliseconds after reading one jump in energy before executing a command. This will fix the problem experienced when one eye is read before the other eye in a double blink.
Tuesday, May 29, 2012
Week Eight Updates
This past week, the algorithm was modified. It is now possible to pause and play the music player by forcefully blinking one eye. Only one eye can be used because so far the algorithm only has variables for one channel and can only interpret the voltage changes of one eye.
A second channel is currently being further researched and tested in order for both eyes to be used to send signals to MATLAB. After there are two working channels, one for each eye, MATLAB will be able to recognize multiple signals and execute more commands.
The raw EMG signals were slightly different from an ideal EMG signal. An ideal EMG signal always starts around -70 mV because this is the resting potential of the neuron when it is not contracting. In order for the muscle to contract, the neuron axon undergoes voltage changes in order to tell the muscle to contract. The voltage change includes polarization, when positive Na+ ions enter the axon and K+ ions leave the axon. This is why the graph of the EMG signal increases. The decrease in the graph of the signal is the axon depolarizing, which is when the K+ ions flood back into the axon and the Na+ ions are pushed out. The frequency of the signal depends on the intensity of the stimulus. A strong stimulus will cause a very high frequency and a weak stimulus will cause a low frequency[12]. An ideal signal does not have noise, however the raw signal almost always has noise. A filter of the frequency cuts out some of this noise and make the signal clearer. The low frequency cutoff is 15 Hz and the high frequency cutoff is 150 Hz. These frequencies are used in the filter in order to get a certain range of frequencies. Frequencies less than 15 Hz and grater than 150 Hz are not included in the filtered signal. The raw signal has added noise, and depending on the filter, not all of the voltage changes are read by MATLAB. The added noise is from motion artifact and other stimuli.
The motion artifact is noise caused by the motion of the electrodes against the skin as they sometimes start to peel off. The frequency of the motion artifact is 2-3 Hz. The motto artifact causes small peaks and valleys in the signal when the eye muscles are not being contracted. There is other noise caused by wall noise which is about 60 Hz in frequency. All of the electrical signals in the body can interfere with the raw signal because there are constantly signals being transmitted between the neurons and the central nervous system. These signals are caused by processes such as breathing, and outside stimuli such as changes in the environment. All of this background noise can be avoided by using a filter.
The energy signal is being read by MATLAB instead of the raw or filtered EMG signal. The energy signal is not the conventional energy unit in classical physics. The energy of signal processing is the sum of the squared values of the raw signal. It is more convenient to use the energy because it is always positive and therefore does not have to account for a negative threshold.
Once the MATLAB algorithm is working properly, the EMG signal will be used to control the music player. When the amplitude of the energy signal reaches a certain point, MATLAB will execute a command to play, pause, or skip the song. A hard blink of the right eye will skip to the next song. A hard blink of the left eye will skip backwards to the previous song. A double forceful blink of both eyes will cause the song to pause or play. The MATLAB algorithm is set up so that once the energy signal reaches a threshold of twenty energy units, the corresponding command will be executed.
![]() |
Rolling graph of raw signal, filtered signal, and energy |
A second channel is currently being further researched and tested in order for both eyes to be used to send signals to MATLAB. After there are two working channels, one for each eye, MATLAB will be able to recognize multiple signals and execute more commands.
The raw EMG signals were slightly different from an ideal EMG signal. An ideal EMG signal always starts around -70 mV because this is the resting potential of the neuron when it is not contracting. In order for the muscle to contract, the neuron axon undergoes voltage changes in order to tell the muscle to contract. The voltage change includes polarization, when positive Na+ ions enter the axon and K+ ions leave the axon. This is why the graph of the EMG signal increases. The decrease in the graph of the signal is the axon depolarizing, which is when the K+ ions flood back into the axon and the Na+ ions are pushed out. The frequency of the signal depends on the intensity of the stimulus. A strong stimulus will cause a very high frequency and a weak stimulus will cause a low frequency[12]. An ideal signal does not have noise, however the raw signal almost always has noise. A filter of the frequency cuts out some of this noise and make the signal clearer. The low frequency cutoff is 15 Hz and the high frequency cutoff is 150 Hz. These frequencies are used in the filter in order to get a certain range of frequencies. Frequencies less than 15 Hz and grater than 150 Hz are not included in the filtered signal. The raw signal has added noise, and depending on the filter, not all of the voltage changes are read by MATLAB. The added noise is from motion artifact and other stimuli.
![]() |
An ideal EMG signal |
The energy signal is being read by MATLAB instead of the raw or filtered EMG signal. The energy signal is not the conventional energy unit in classical physics. The energy of signal processing is the sum of the squared values of the raw signal. It is more convenient to use the energy because it is always positive and therefore does not have to account for a negative threshold.
Once the MATLAB algorithm is working properly, the EMG signal will be used to control the music player. When the amplitude of the energy signal reaches a certain point, MATLAB will execute a command to play, pause, or skip the song. A hard blink of the right eye will skip to the next song. A hard blink of the left eye will skip backwards to the previous song. A double forceful blink of both eyes will cause the song to pause or play. The MATLAB algorithm is set up so that once the energy signal reaches a threshold of twenty energy units, the corresponding command will be executed.
Tuesday, May 22, 2012
Week Seven Updates
This week, the alligator clamps were soldered to the stranded wires that were connected to the amplifier. The alligator clamps clamp onto the electrodes so the signals can be carried through the wire to the amplifier and data-aquisition system. The ideal place for electrodes was determined. The reference electrode will be placed on the neck. There will be two electrodes for each orbicularis occuli muscle around the eye. They will both be placed underneath the eye, one at the beginning of the muscle and the other at the end of the muscle. There are two electrodes for each muscle in order to capture the signal and to block out extra noise signal from the muscle.
In order to test signals, the electrodes were placed on the face and the amplifier was turned on. The signals were not being read in MATLAB because it was uncertain how to add multiple channels to detect multiple signals. When turned on, the amplifier became very hot and started to smoke, so it was turned off in order to avoid damage. These are problems that will be solved during the next week.
![]() |
The DAQ, amplifier, 9V batteries, and alligator clamps all connected by stranded wire. |
Tuesday, May 15, 2012
Week Six Updates
This week the amplifier was built. The amplifier is used to increase the biological signals by a multiple so they can be more easily read by MATLAB. The components were soldered onto a circuit board. The green LED lights light up depending on which gain resister the switch is set to. The data-aquisition system was connected to MATLAB through the computer and the drivers needed for the data-aquisition system were installed. The algorithm for MATLAB is now able to control the volume. It was originally thought that volume would not be able to be controlled because Foobar2000 uses a slider to control the volume, however it can be controlled up or down using a simple MATLAB command.
![]() |
Amplifier connected to a 9V battery |
Tuesday, May 8, 2012
Week Five Updates
The voltage amplitude for the average EMG signal is around 0.5mV. This value can differ depending on the specific muscle where the signals are being read. There was no specific voltage amplitude value of the bioelectrical signals found for the orbital orbicularis oculi, the muscle being used, so preliminary testing will be needed to determine the actual voltage range. The actual voltage range can then be used to determine the gain that should be used for the amplifier in order for the voltage to be large enough to be read by MATLAB. To stay within the dynamic range of the DAQ, the signal needs to be amplified to the maximum value of about 1.5V. The equation to find the gain is Gain=(Output Voltage)/(Voltage of EMG Signal before Amplification). Knowing that the output voltage needs to be 1.5V and that the average EMG signal is around 0.5mV, it can be determined that the gain should be set to about 3000.
From the INA2126 data sheet, it was determined that an R_G value, of the gain resistor, should be approximately 26.7 ohms. This was found using the equation 80000 ohms/(Gain-5)=R_G.
More code development was also done. The play, pause, next, and previous commands were put into a simple function. No signal data is available at this point, so arbitrary variable values were used to test. Once the signal data is available, the function will be able to be fully written.
MATLAB code to interface the instrumentation amplifier with MATLAB were procured, along with code to filter the signal and display the data in a rolling graph. These were mostly premade and little work was done with them. Once the equipment to retrieve the signals is available, more work will able to be done with the code. All codes are available for download through the links below.
Foobar2000 control: http://www.mediafire.com/?htm2t9ycyosjfth
MATLAB and instrumentation amplifier interface: http://www.mediafire.com/?c11gu1uatbgc9n3
Signal processing and display: http://www.mediafire.com/?ttuc16c59qc42au
From the INA2126 data sheet, it was determined that an R_G value, of the gain resistor, should be approximately 26.7 ohms. This was found using the equation 80000 ohms/(Gain-5)=R_G.
More code development was also done. The play, pause, next, and previous commands were put into a simple function. No signal data is available at this point, so arbitrary variable values were used to test. Once the signal data is available, the function will be able to be fully written.
![]() |
Foobar2000 control function |
MATLAB code to interface the instrumentation amplifier with MATLAB were procured, along with code to filter the signal and display the data in a rolling graph. These were mostly premade and little work was done with them. Once the equipment to retrieve the signals is available, more work will able to be done with the code. All codes are available for download through the links below.
Foobar2000 control: http://www.mediafire.com/?htm2t9ycyosjfth
MATLAB and instrumentation amplifier interface: http://www.mediafire.com/?c11gu1uatbgc9n3
Signal processing and display: http://www.mediafire.com/?ttuc16c59qc42au
Subscribe to:
Posts (Atom)