Failing to see any SSVEP. Is my raw data bad quality?
I've been trying to see SSVEP using:
- a ganglion board with 4 channels around Oz
- An Arduino stimulus flickering LED bulbs at 12Hz
I have verified that I am getting data at 200Hz by dividing the number of samples by the amount of time. The sample rate is always near-perfect.
I have good connections with the electrodes. The impedance is always below 20 kOhms.
I have verified that my data analysis pipeline is good by running it on publicly available SSVEP data. Using the publicly available data, I easily see a peak in the power spectrum for the stimulated frequency. So I'm pretty sure my analysis steps are good. They are:
1. Highpass filter above 5Hz
2. Bandstop 59-61Hz (I am in the US)
3. Get power spectrums with DFT, FFT, Bartlett's Method and Welch's Method
I record my data using BrainFlow for Java. I have verified that my data is coming in the same way it does in OpenBCI GUI.
I analyze my data both in java and then export it and and analyze it in MATLAB as well, and see the same results.
I tried putting a makeshift faraday shield with aluminum foil around the OpenBCI board, but this was silly because it just prevented the bluetooth connection from working correctly. So I had to do my recordings with no EMF shielding, and I'm unsure if this could be the source of the issue or not.
My raw data looks really noisy. Even after filtering it, it never looks nearly as smooth as the data I've seen from other devices. The publicly available data I mentioned above is sampled at 256 Hz and looks much less noisy.
Attached is a picture of some of my data as well as a zip file with all of my data and code. In the data, there are markers in milliseconds. The SSVEP stimulus starts at the second marker and ends at the third.
There are a couple of specific concerns I have about the data.
- The raw data has constant jumps. It looks "rectangular" because it will hover around one amplitude for some milliseconds then suddenly jump to another, constantly.
- The filtered data has random spikes, probably reflecting those jumps from the raw data
- The power spectrums always look pretty much the same. In DFTs and FFTs, there are spikes at semi-regular frequency intervals in the power spectrum. In Bartlett's and Welch's methods, there is never any signals above 10 Hz apart from occasionally a bump at 20Hz.
Comments
Link to data and code
Matt, hi.
A number of previous threads have addressed what you are seeing.
https://www.google.com/search?as_q=ssvep+timing&as_sitesearch=openbci.com
The MindAffect free cVEP system also includes a number of calibration / stability tests that will confirm the stabile frequency generation capability of your monitor. See links in the first thread below.
https://openbci.com/forum/index.php?p=/discussion/3052/not-getting-expected-results-from-vep-visual-stimuli-eeg-data-resolved
https://openbci.com/forum/index.php?p=/discussion/3122/ssvep-experiment-no-fft-peaks-found
https://openbci.com/forum/index.php?p=/discussion/2549/ssvep-fft-too-noisy
William
OK, also I'm realizing your light source is the LED, and not a computer monitor. However square wave sources of light stimulation, are also known to generate additional frequency components when received by the brain. For this reason, some therapeutic light stimulation systems I am aware of, modulate the LED light intensity with a sine wave, to avoid the sharp edges.
I'm not understanding the noise spikes in your filtered data. If you turn off your Arduino light generator, do these noise spikes continue? These spikes may be related to some EMF electromagnetic field emissions from the Arduino. What EEG do you see running the eyes closed alpha test, using the OpenBCI_GUI?
https://docs.openbci.com/GettingStarted/Biosensing-Setups/EEGSetup/
Hi William,
Thanks for the ideas.
The previous threads that you mentioned first, am I correct that those are specifically regarding issues with flicker stimuli coming from a computer monitor? If so, I think that this type of issue is avoided by using the Arduino and I shouldn't have to worry about it. In any case, MindAffect system looks really useful and I'll keep it in mind.
Yes, I used square wave stimulation. I will redo the experiment with a sin-shaped flicker and share the results with you.
I believe I do still see the noise with the Arduino off. I will share more data with you to address your questions.
Please try the eyes closed alpha test, using the OpenBCI_GUI to process the data. I want to see if the spikes go away and you get a clean FFT peak around 10 Hz.
We still don't know the source of your high frequency noise pulses. But I suggest instead of your highpass filter, you try a simple bandpass filter say from 1 Hz to 40 Hz. That upper limit will block high frequency noise. Still maintain your notch filter.
I have recorded a closed-eye alpha test directly from OpenBCI GUI. All 4 electrodes were around Oz and impedance was below 50 for all of them. The data is here: https://drive.google.com/file/d/19iKIgrWK8e3rsp0mBPAEv88feInV-GCO/view?usp=sharing
The arduino was off and not plugged in during the recording. I had my eyes closed and sat still for the duration of it.
I can observe a small peak at 10Hz. However, the data shows lots of noise, low frequency power, and a peak at 20Hz.
The data above uses a bandpass filter of 5-40Hz. I tried to use a bandpass filter, like you suggested, at 1-40Hz. It was very noisy and the power spectrum was flat after the lower frequencies:
Next, I have a new SSVEP recording. I programmed the Arduino to do sinusoidal stimulation like you suggested (it was way more comfortable to look at). Like with the closed-eye alpha test above, the power spectrum is only useful when the bandpass filter starts at 5Hz as opposed to 1Hz. The stimulation frequency was 12 Hz, and there is one small peak there (though it could be coming straight from the arduino EMF, who knows).
Link to data and code: https://drive.google.com/file/d/1sAMDQNxMOEo0Y5KbSAIXndFPqwtLbeYP/view?usp=sharing
Finally, I took your advice to do an SSVEP experiment with the Arduino disconnected. Here, everything is the same as the experiment above except:
The data here seems to have less noise than the above, with the Arduino. However, there is still some of the same patterns in the raw, filtered, and power spectrum data.
Data and code: https://drive.google.com/file/d/1GsUTYlIU-AeRAFln-ISDc72AHZ873oQZ/view?usp=sharing
Note that I made a mistake earlier and mixed up some data. I edited the post a few minutes after posting it. Everything is good as of now.
Now what I am wondering is:
1. Does my data look relatively normal, or are there atypical noise patterns?
2. Which, if any of these would be logical steps to take?
- Creating some sort of EMF shielding around the Arduino and/or somehow the OpenBCI board
- Recording inside of a faraday-shielded EEG booth
- Setting up a wired connection so that I can more easily put a EMF shielding around the OpenBCI board without having to worry about loosing bluetooth connectivity? I found some links showing you guys have worked on this, but I'm not sure how complex or involved it is to set up.
What do you mean, "Everything is good as of now." ?? I still see tons of spike noise in your graphs, regardless of your filters. These spikes are not normal. And a bandpass of 1-40Hz plus notch should be fine in 99% of cases. The fact that you have to go up to 5Hz is very suspect.
In the eyes closed alpha test, I was asking to see the OpenBCI_GUI FFT and time series graphs, with filters and notch applied. This was to eliminate possible artifacts from the filtering you are doing in software. If you are running the eyes closed alpha test and still see that spike noise with the GUI, I would then suspect you have some issues with your Ganglion hardware. Is this a new system, when purchased? Has it ever worked correctly?
I further see that the spike noise is at about 10 Hz on some of your graphs, and 5 Hz on others.
Is your Ganglion setup near any EMF generating equipment: power cords, power supplies, extension cords, LED lighting, conduits in walls, floors, ceiling, other computer equipment, etc.
Sorry for the miscommunication. By "everything is good", I just meant that I had corrected the mistake in a previous post where I previously had reported the wrong data.
The OpenBCI board is on my desk next to my computer and monitor. Yes, there are power cords around. Maybe this is the issue.
Here is the test you are asking for. The arduino is disconnected and off. I start closing eyes right when the stream starts. I open them in the middle to fix the plot ranges then close them again until the end.
https://drive.google.com/file/d/1hbDlAL7H4S4UKEb79s_SkT5NcfQyZpin/view?usp=sharing
I purchased the board recently. The date on the board says 1520. This is the first time I did any serious recordings and expected to see results, so I can't confirm or deny if its a hardware issue.
But based on your concerns about EMF, I'm thinking maybe my next step is to find or setup a recording environment that has less interference?
Well, your GUI movie shows hundreds of microvolts of noise throughout, and ZERO spikes matching what your graphs show. I honestly don't know which is your valid scalp channel. All channels look equally noisy.
Normally it's not a good idea to leave unused channel pins floating. They can pick up noise. However generally not hundreds of microvolts of noise like we see here. Which kind of implies that you may be in strong EMF fields in your area.
Have you done the setup for the eyes closed test as outlined? The movie looks nothing like what one would expect.
https://docs.openbci.com/GettingStarted/Biosensing-Setups/EEGSetup/
I just went to check the EEG Setup guide again to make sure I didn't miss anything. Turns out I missed the point about switching from differential mode to REF mode. After switching all 4 of the switches, my signal looks amazing. In the OpenBCI GUI I clearly see alpha waves. The difference is like night and day.
Thank you so much for your help.
I just saw crystal clear SSVEP for the first time from my own recording!
And that was from a computer screen video stimulus, so there's no possibility of it being caused by the arduino (it was unplugged).
The samples came in at around 190Hz, which explains why the peak is slightly below 12Hz. This is a bluetooth issue which I have discussed with others that affects Macbook users.
How are you deriving the 190 Hz sample rate figure? Are you seeing any packet loss in the GUI? The time stamps on the samples cannot be used to derive sample rate.
The 190Hz is from dividing the number of samples from the time elapsed. There is no packet loss in the GUI. I am ignoring the timestamps.
Please see the conversation on slack I had here: https://openbraintalk.slack.com/archives/C01053V5W6N/p1665958594903569
The Slack thread at the end says you achieved 200.5 Hz with the proper USB-C to USB-A adapter. I added a comment.
Yes, that's correct. I don't know why my sample rate is perfect sometimes and not other times. But I largely suspect it has to do with the bluetooth connectivity.
If the Bluetooth channel and adapters are operating correctly, you should see very close to 200 Hz almost all the time. It does sound like the USB-C MacBooks still have some further debugging to do, in terms of the best adapter.
Matt,
In the case of your malfunctioning Macbook USB-C interface you cannot infer sample rate by this division. This is because some extra buffering is going on in the USB system, because of hardware errors with the USB-A adapter being used. Since you have measured 200.5 Hz in the past when it was functioning correctly, that will always be your sample rate. Plus or minus maybe tenths of a Hz.
When the adapter is malfunctioning, then the extra samples are being held 'somewhere' in internal buffers in the hardware. And will result eventually that the samples received by your program in real-time, will be FAR OFF synchronization with the actual samples being received at the same real-time moment at the Ganglion. This is obviously undesirable and hopefully OpenBCI staff will converge soon on the best adapter to use.
The GUI monitors "packet loss" by watching the sample counters on each radio packet. Since in this case there are no skips or gaps, there is no packet loss. But GUI is unaware that packets are being 'hidden' inside the USB buffering system. But it DOES show this by the abnormal number of packets received per second.
William
See this related Github issue:
https://github.com/OpenBCI/OpenBCI_GUI/issues/1080
It turns out this is likely NOT an issue caused by 'faulty' adapters. But in timing glitches in the code that interacts with the BLED112 serial port. Issue above outlines several possible solutions.
Hey William,
Despite this issue I am seeing a very high peak at the expected frequency for my SSVEP experiment and want to move forward.
I see these high peaks both for flickers generated from the Arduino and flickers generated from an .mp4 video. Always 12hz. Always with 4 sensors near Oz and references on earlobes.
Now, I am wondering if I can ask your advice about how to verify this. I'm concerned that I cannot verify if the signal is coming from the brain or from interference.
I'd say the fact that I get a good signal from .mp4 alone is pretty good validation. However, I am not completely sure. Who knows, maybe an electrical field is generated from my computer screen when it flickers. Also, moving forward I will probably want to use the Arduino. And I want to be able to say with confidence that there is an no significant contribution from EMF interference and that it's really coming from the brain.
I could just wrap the Arduino in aluminum foil. But even then, I want to be so confident that I could event eventually publish this data. Do you know if there is anything I can do with the data or the device to ensure what I am seeing is in fact a neural oscillation?
For now, I will try redoing the experiment with an eye mask on. Do you think that not seeing peaks there would be a good enough verification?
If you are stimulating with 12 Hz and see the 12 Hz FFT peak, then it is working. I'm not sure if the harmonic at 24 Hz is a result of the square wave stimulation. May disappear with AM sine wave modulation. There is no need to wrap anything in foil. Besides such foil does not block low frequency EMF electromagnetic fields. Foil would block Bluetooth, which would wreck the operation of the Ganglion and BLED112.
Another good confirmation of your EEG setup is with eyes closed alpha generation. But I think you've already done that.
Regards, William
Sure, eye mask would be another confirmation.