configuration for measuring EEG, ECG, and HR with Python
Hi there,
My team is using the Cyton+Daisy board to collect EEG (channel 1-15), ECG (channel 16), and HR (D11) data. We used python Brainflow API to send external markers and access the data, and have collected some datapoints from 15 participants.
Upon reading some of the previous threads, we found out that we might have missed two board configurations: 1. Turning off SRB2 for the ECG channel (channel 16) in the python script, 2. Setting the board to analog mode.
Given that we have collected some datapoints without those two configurations, we are wondering if there is still possibility to use the ECG data (channel 16) and the data from the accel channels (i.e., channel 17,18,19) for HR with some extra processing. One thing that we noticed is that values from channel 16 is significantly different from channel 1-15 (i.e., the EEG channels), unlike what we have observed from the time series widget in the GUI (i.e., when we don't turn SRB2 off for Channel 16 in the GUI, all channels have the same data).
Would really appreciate any pointers that could save these data points! Thank you!
Comments
Hi JCY,
Have you taken a look at this page?
https://docs.openbci.com/GettingStarted/Biosensing-Setups/ExGSetup/
Does your previously recorded / collected EEG data look ok? Not contaminated with ECG? If your previous collected data did not turn off SRB2 for the ECG channel, then ECG could have gotten into the EEG channels. Normally as the link above shows, ECG channels should have SRB2 turned off, and chest electrodes connected to the plus and minus pins of that channel. Contrary to the link above, I suggest NOT connecting Bias/Ground anywhere near the chest. As it already is connected at one ear lobe for the EEG.
Additionally, the link above shows the SRB2 switched off for the ECG or EMG channels. Those channels should ALSO switch off the Bias as well. What this does is tell the ADS1299 to not include those channels in the EEG noise cancelation. But Bias is still used for amplifier centering / grounding.
You are using the Pulse Sensor on D11? It only registers sample data when the board is in Analog Mode. Otherwise those Aux channels are collecting accelerometer data.
William
If your ECG was correctly recorded, that will give you HR, with some calculation. So using the pulse sensor seems redundant.
https://www.google.com/search?q=calculate+heart+rate+from+ecg
Hi @wjcroft ! Thanks so much for your response. A couple of questions -
We did read the page to set up our GUI. However, when we previously collected the data, we didn't know that we would need to reconfigure the board (i.e., turn off BIAS2 for ECG) when we are running the brainflow API with python. The original assumption is that BIAS and SRB2 would be separate columns in the output file. We were planning on processing the data after the collection. Do you know if there's any column in the raw output that has data collected from the BIAS and SRB pins?
Given that we did not turn off BIAS or SRB2 for the ECG data collection, do you know if there's a way to gauge whether the data is still usable? We were planning on processing the data with MNE but are open to other suggestions
Could you say more about turning of BIAS for ECG? Does that mean that we would need to add that configuration to our python script before we start streaming? Furthermore, should we simply not connect the 3-lead setup to BIAS? If not, what should we connect it to instead?
No, this is not how EEG or ECG works. Biosignals are DIFFERENTIAL, measured between two electrodes. In the case of EEG those two electrodes are the channel in question, and the SRB2 pin, which acts as common reference. Bias / Ground is only used for grounding, centering the amps, and to act as inverse cancellation of mains noise. Bias has no contribution to the channel data other than what I just mentioned.
Hmm, I have not seen any examples of your data stream on all channels. In general I would expect that without disconnecting SRB2 for your ECG channel, the high amplitude (millivolts) ECG data may have distorted your EEG channels. But you should be the judge of that. I assume with your ECG channel that you connected left and right chest electrodes to the plus and minus pins of the ECG channel.
As mentioned, Bias is used as mains cancellation for the EEG channels. So if you do not turn it off for the ECG, it will slightly distort the EEG data, in terms of ability to cancel mains. But this distortion will only be slight, as opposed to the much stronger distortion if you do not turn off the ECG SRB2.
You only need ONE Bias / Ground connection when doing mixed EEG ECG. Most commonly people put Bias on one ear lobe and SRB2 on the other. OR another way to go is to put Bias on a centrally located scalp channel such as AFz or POz or any 'z' channel. Your reference can go anywhere, as EEG processing packages can do 're-referencing' if needed.
William
Thanks William! @wjcroft. The first 2 points make sense. For the last point, does that mean that our 3-lead ECG should really be 2-lead in this case when we are mixing EEG and ECG?
One of the "3-leads" in the ECG is ground (or sometimes called DRL, driven right leg). Since you already are using Bias / Ground for the EEG channels, there is no need for the ECG ground connection. And in fact would contaminate the EEG Bias if you connected both scalp and lower torso grounds together. You disconnect Bias from the ECG channel, using the SDK commands, along with disconnecting SRB2 from ECG.
Gotcha. Thanks William!