A while back, I had a friend come over and I measured his EEG in response to staring at a blinking light. We saw (as we hoped) that his brainwaves oscillated in sync with the blinking of the light. I thought that this visual entrainment (aka “steady-stead visual evoked potential“) was pretty cool. Since then, I’ve learned that it can be used as the basis for a brain-computer interface (BCI). Because I’m still searching for a good BCI paradigm, I decided to return to my exploration of visual entrainment. Today, I’m going to show how I successfully used visual stimuli to induce brainwaves at different frequencies. As a result, I can now see an good avenue for an EEG-based BCI. Yes! Let’s go!
Inducing SSVEP Using a Toggling Checkerboard Pattern on my Computer Screen |
Goal: My goal today is to use visual stimuli to induce brainwaves across a range of frequencies. Because I want to use this for a BCI, I’m trying to determine what kind of visual stimuli I should use and what EEG frequencies I can induce. What does it take to make this work reliably?
Visual Setup: In my previous post, my visual stimulation was simply a blinking head-lamp. It was effective (and really bright!), but I had no control over its blink frequency. As a result, I also had no control over the frequency of the brainwaves that it induced. So, for today’s test, I needed to get fancier. I ditched the head-lamp and, instead, created a series of blinking movies that I could playback on my computer. I controlled the “blinking rate” by saving my movies at different frame rates. What exactly did the movie look like? Well, at first, because of a paper that I read in the VEP literature, my movie used the checkerboard pattern shown in the picture above. The movie toggled back-and-forth between this image and the inverse image (swap blacks and whites). While this worked OK, I later switched to a simpler movie (code here) where the screen was simply all-white or all-black. That seemed to work better.
EEG Setup: Once I made my movies, I set myself up with my EEG system (OpenBCI ). I my usual gold cup electrodes with Ten20 EEG paste. I put one electrode on the back of my head (near O1) and I put another electrode on my forehead. My reference electrode was on my left ear lobe and my bias electrode was on my right ear lobe. Using the impedance-measuring feature of OpenBCI, the electrode on my forehead had an impedance of 24 kOhm and the one on the back of my head was about 65 kOhm. I couldn’t seem to get the back electrode to a lower value.
Channel 1 was on my Forehead, Channel 2 was on the back of my head. My left ear lobe was my reference. My right ear lobe was the bias. |
I used my OpenBCI V1 board with Ten20 Paste. I think that those owl napkins are fun! |
Test Method: Once I got everything setup, I launched the OpenBCI GUI in Processing and started an EEG recording. To playback my homemade blinking movies, I opened up Windows Media Player and set it to full-screen mode. I had ten movies, with each movie blinking at a different rate. I had WMP play all 10 movies continuously in sequence. Each movie was 20 seconds long, so the whole test took about 200 seconds. It was nighttime when I did this test and my room was dimly lit. I tried to stare at the screen and I tried to only blink my eyes at the transition between the different blinking rates.
Results, Checkerboard: As usual, my preferred way to view the data is to make spectrograms. In the figure below, the top plot is the data from my forehead and the bottom plot is the data from the back of my head. From my forehead, there is nothing interesting except my eye blinks. From the back of my head, we see several interesting features, which I’ve marked with blue and white arrows. Note that these interesting features change every 20 seconds, which is the same as my 20-second movies. It seems clear to me that these features are my brainwaves responding to changing of the blink rate in my movies. Excellent!
Entrained with the Blink Rate? Looking at the three blue arrows, it appears that I have entrained brainwaves at 2 Hz, 4 Hz, and 6 Hz. At these times, any given square in my movie was blinking at 1 Hz, 2 Hz, and then 3 Hz, if you count from white period to white period (“W-W”). Because I have entrained brainwaves as 2x the white-to-white frequency, it suggests that it is NOT white-to-white that matters, but that it is the transition between white/black or black/white that matters. At least, that is what is implied for these three (out of 10) cases for the checkerboard stimuli.
Complications: While that would be a fine conclusion, why does this rule not continue through the other 7 cases in this checkerboard test? Why does it only work for the three cases with the blue arrows? The cases with the white arrows do show some sort of EEG response, but not at any frequency that makes sense given the speed of my movies. What is going on? I’ve got two possible explanations: (1) either my movies are not playing back reliably during these other cases, or (2) the checkerboard pattern is too complicated to be a good starting point for learning about my brainwaves.
Modifying the Test: Of these two possible explanations, it’s easier for me to simplify the checkerboard than it is for me to fix the reliability of my movie playback. So, I changed my movies so that the whole screen is either all all black or all white. Hopefully, this simpler visual stimuli will make my EEG response easier to understand.
Results, Whole-Screen Blinking: After recording my EEG while staring at the new movies, the spectrograms of my data are shown below. Again, all of the interesting action is in the back of my head. The bottom plot shows that I got good entrainment of my brainwaves for nearly *all* of the new movies. I’m very pleased. I’m also very curious about the jump between the cases marked with blue arrows versus the cases marked with red arrows. What is happening here?
Spectrogram of EEG Signal Recorded While Watching the Whole Screen Toggle White or Black. The top plot is the signal from my forehead. The bottom plot is from the back of my head. |
Quantifying Entrainment vs Frequency: If it’s simply the frequency that matters, it would be good to see which frequencies yield the strongest entrainment. Sure, the spectrograms above suggest which frequencies are best, but I took the next step and actually measured the EEG response at each of the stimulation frequencies. The plot below shows the EEG amplitude that I measured for each of the visual blinking frequencies. Note that there are two lines, one for if you count based on the white-to-white frequency (blue line) or whether you’re counting based on all the white/black and black/white transitions (red line). This graph suggests that I seem to yield decent responses in the 6-10 Hz frequency range. So, if I’m looking to use visual entrainment for a BCI, I should focus on the 6-10 Hz band.
Amplitude of EEG Signals Induced by Visual Entrainment. My best responses seem to be in the 6-10 Hz band. That could be a good target frequency range for use in a BCI. |
Computer Could be Limiting my Performance: As mentioned earlier, all of these results could be confounded by the possibility that my computer cannot reliably and steadily refresh my screen. Perhaps it can reliably handle the frequencies at 10 Hz and below, but is not steady above 10 Hz. Perhaps that’s why my apparent response above 10 Hz falls off. Sure, my computer claims that the screen has a 60 Hz refresh rate, but that doesn’t mean that Windows or that Windows Media Player can keep up. So, any next steps should include some method of assessing whether the computer is actually displaying my movies smoothly at the rate that I expect.
Entrainment for BCI: My overall goal is to make a cool brain-computer interface (BCI). Because I am showing that I can successfully measure visual entrainment, I would like to further explore how visual entrainment could be exploited for a BCI. One idea is that I could simultaneously show two movies side-by-side, each blinking at its own rate. Perhaps, if I’m lucky, my brainwaves will only respond to the one movie that I’m actually watching. If that’s the case, then I would have conscious control over my brainwaves (and, therefore, the BCI) simply by selecting which of the two movies that I watch. That could be very cool.
Follow-Up: I setup a photocell and my Arduino to measure the actual blink rate of the movies on my computer. In my results, I found that I can’t generate steady blinking faster than 10 Hz. This is probably a strong reason why my EEG recordings exhibited no entrainment above 10 Hz…how can I entrain to signals that aren’t there?!?
Follow-Up: I extended this work by having one movie blink at two different rates. I found that I could control my entrained brainwaves by choosing which of the blink rates I focused on. Pretty cool! If you’re interested, you can see the results in this post.
Follow-Up: Interested in getting the EEG data from this post? Try downloading it from my github!