Showing posts with label Eye Artifact. Show all posts
Showing posts with label Eye Artifact. Show all posts

Tuesday, December 17, 2013

EEG While Meditating

Way back in September, I was with the OpenBCI folks at Maker Faire NYC showing off our very first OpenBCI prototype.  I was there wearing my bright blue EEG cap doing live demos of my brain waves.  It was fun.  On day 2, however, there was a guy who came up and demanded (politely) that he wear the EEG cap.  Given how long it takes to setup the cap correctly (with all the EEG gel and whatnot), I tried to decline his request.  But he persisted.  He told me that he was a meditator and that he needed to know if anything was actually happening in his brain when he was meditating.  Wow, you got me hooked me.  Let's do it!

Non-Meditating:  First, just so we all recognize what a normal, messy EEG recording looks like, check out the graphs below.  These are spectrograms of EEG signals recorded from my head using OpenBCI V1 and an EEG cap with tin electrodes.  The top plot is from the front of my head (Fp1-Fz) and the bottom plot is from the back-left area of my head (I think that its actually T5-Fz).  Note that both signals are highly corrupted by low-frequency artifacts from blinking my eyes.  Otherwise note that, when my eyes are closed, I show a nice signal ~10 Hz in the back of my head.  This is the classic posterior dominant rhythm that occurs in the Alpha band.  Notice that, besides the alpha and besides the eye blink, there is not much structure anywhere else in plots...it mostly just looks like messy noise.  Fine.

My EEG With My Eyes Open and Closed (No Meditating).
The arrows point to alpha waves that are commonly seen when one's eyes are closed.

Meditating:  So, now we turn to the data from my meditating friend.  The spectrograms below show data that we recorded from him using the same OpenBCI board and the same blue EEG cap.  In these plots, my friend was already meditating by the time I started to record the data.  So, to the left of the vertical line, this is data when his eyes were closed and he was meditating.  To the right of the line, he was not meditating and his eyes were open and closed at various times.  I find this data to be quite impressive.  Notice that there is clearly a band of signal energy between 15-20 Hz while he is meditating.  In the second half of the data, where his eyes are closed, there is maybe some of that 15-20 Hz signal, but it isn't nearly as strong as during the meditation.  I think that it is very cool that we appear to be seeing a physical (well, electrical) effect in his brain due to meditation.  Additionally, note also that he shows no alpha waves (nothing around 10 Hz) when his eyes are closed.   Is the meditation suppressing his posterior dominant rhythm, or does he just not exhibit one?  I don't know, but it's cool.

EEG recorded from a meditator.  Left of the line, he is meditating.  Right of the line, he is not.
Notice the signal energy between 15-20 Hz (and the absence of alpha waves) when he is meditating.

What Does It All Mean?  I make no claims regarding meditation being good or bad.  I make no claims regarding EEG signal energy in the 15-20 Hz band being good or bad.  All I know is that we can measure changes in his brain waves and that they appear to be due to him meditating.  That's really cool to me.

More Learning:  Via email, I showed this data to with my meditating friend.  He sent me back an outstanding link that was a survey of different schools of meditation and their relationship to changes in measured EEG. If you're into that kind of thing, it makes for fascinating reading:

Travis, F., & Shear, J. "Focused attention, open monitoring and automatic self-transcending: Categories to organize meditations from Vedic, Buddhist and Chinese traditions." Consciousness and Cognition (2010)
http://www.koepnick.de/Three%20Typs%20of%20Meditation.pdf

Have any of you recorded your brain waves while meditating?  What did you find?  Let me know!

Follow-Up: I recorded another meditator.  Check out his data here!


Tuesday, November 12, 2013

Measuring EOG with my EEG Setup

In a previous post, I discussed how you can use your EEG electronics to measure ECG to see the changing electrical potential in your body due to your heart beats.  In this post, I'm going to use my EEG electronics to measure EOG to see the changing electrical potential in your head due to eye motion.  "Eye artifact" is a commonly-seen type of corruption seen in EEG, so it is important to have a feeling for the effect of the eye when trying to study the brain.

Electrodes on my face to measure my EOG due to eye motion.
Setup

As you can see in the picture above, I used three electrodes: one above my eye, one below my eye, and one to the side of my eye.  I have no experience recording EOG, so I don't know what standard practice is.  This is just what I happened to try.

In my setup, the primary electrodes were the ones above and below my eye.  The electrode on the side was used only as my driven ground (or "bias" if that is your preferred language).  It turns out that this connection wasn't really necessary (EOG signals are very strong), so you might be able to omit it.

The electrodes themselves are reusable gold-plated electrodes commonly used in EEG.  Mine are similar to these.  I stuck them to my skin using standard Ten20 EEG paste.

I plugged these electrodes into my OpenBCI electronics using my new, homemade adapter cable.  My OpenBCI board was mounted to an Arduino Uno, which was pumping the data to my PC for logging and post-test analysis.


Results

Once I turned everything on and started collecting data, I found some really interesting things.  Again, I have no experience doing this, so I had no idea what to expect.  Below is a graph of the voltage recorded during a period of time where I was looking forward, I then turned my eyes to look upward (keeping my head itself fixed), and then returned my eyes to looking forward.  As you can see, the voltage clearly tracks the motion of my eye.  When my eye was "up", the voltage was up.  While that seems so sensible, it was not what I expected at all.

Voltage recorded between an electrode above my eye and an electrode below my eye.

What was I expecting?  Well, I do have some experience seeing muscle artfiact in EEG signals due to clenching my jaw.  Muscle artifact shows itself as a hashy, noisy, high-frequency signal.  Since it takes muscles to move your eye, I assumed that "eye artifact" would also be hashy and noisy.  I was wrong.   It is a low frequency signal that reflects the actual position of the eye...not the changing position of the eye.  Even a quick jump over to read about EOG on Wikipedia would have told me that.

To paraphrase Wiki, EOG measures the local effect of the electrical potential that always exists between the front and back of your retina.  So, changing the orientation of your eye changes the how much each electrode "sees" the positive side of the retina versus how much it sees the negative side of the retina.  Cool!

Zooming out on my data, let's look at a longer time span with more eye motion.  The plot below shows the EOG data recorded for a variety of eye positions...looking forward, looking up, and looking down.  As you can see, there is a clear relationship between the measured voltage and the eye position.  Clearly, this system could be used as an eye tracker to tell (roughly) where your eyes are looking.  I find this very exciting.

EOG data recorded for multiple eye positions.
Effect of Filtering

The signals shown above were plotted after filtering.  Whenever I present EEG/ECG/EOG data, I filter it to get rid of very high frequency noise and to get rid of drifting of the DC component of the signal.  For EEG, I often filter away the signal energy that is below 0.5 Hz.  Since I do not care about EEG signals this low, removing these low-frequency components makes the plots much easier to follow.  But, if you use these filter settings for EOG, you get a completely different type of EOG plot than the nice ones shown above.

My previous EOG plots were bandpass filtered to only include energy between 0.02 Hz and 50 Hz.  Below is a plot of the same EOG data, but using my typical EEG passband (0.5 Hz to 50 Hz).  Notice that the plot looks very different.

Same EOG data but filtered to remove low-frequency energy below 0.5 Hz.
In this plot, you basically only seen the moment of change from one eye position to the next.  So, if all you cared about whether the eye is *moving*, this filter setting is good.  But, if you want to know where the eye is pointing, this is the wrong filter setting...you really need to lower that low-frequency cutoff from the 0.5 Hz value down to something like the 0.02 Hz value that I showed in the previous graphs.

To be truthful, the graph above is what I first saw when looking at my EOG data.  This is the graph I saw because I was viewing the data using my usual EEG filters (0.5-50 Hz).  As a result, I thought EOG was only good for measuring eye motion.  It wasn't until I started exploring the data in greater detail (changing one's normal filter settings is a great way to explore the data) that I discovered the plots that I show at the top.  When I lowered my low-frequency cutoff to 0.02 Hz and got those plots, that's when I discovered that  EOG is really about measuring the change in DC potentials due to your eye position.  What a fun discovery!

Next Steps

So, that's my story of recording EOG with my EEG setup.  It was really fun.  My next step is to put electrodes to the sides of my eyes so measure side-to-side motion in addition to up-and-down motion.  Also, I might try my homemade electrodes to see how well they do.

The real challenge with EOG is to keep the electrodes stuck on your face as you move your head around.  One thing that I did try was to use my self-adhesive ECG electrodes.  These stuck great!  But, they sure did look silly...

ECG electrodes stick better, but look much more silly.
I think that I'll just stick with the small EEG electrodes.

Follow-Up: Want to get the data used in this post?  Try my github!