Quantified Self Experiments / Hypnodyne ZMax vs OpenBCI EEG - personal home sleep PSG lab

I was using Hypnodyne ZMax for a hundred of nights and recently i notice some issues with hydrogel electrodes working for only for 2-3 days in contrast to ~3 weeks of work before. Since they cost some money (15 EUR each) and require manual ordering / shipping I decided to move forward to get my OpenBCI PSG pipeline finalized.

Introduction

After having a talk with Frederik Weber (spisop.org) i got more knowledge on sleep / PSG. OpenBCI with gold cup electrodes seems to be in a "gold-standard" PSG range. He made a cool home PSG guide which i've read multiple times to understand how to get everything setup and this night I had some success.

Before talk i was planning to compare ZMax vs OpenBCI to validate it for myself, but he told me about this validation study with 1000+ nights on different populations where ZMax has show good agreement vs PSG hypnogram. Also it was shown that some of ZMax EEG derived features not comparable to PSG, but this doesnt seem to affect final hypnogram which was autoscored by Dreamento which relies on YASA. So i decided not to spent my time on comparing OpenBCI vs ZMax and just sticked to ZMax. But after these issues with electrodes i've changed my mind and thinking about switching to OpenBCI for daily longterm sleep tracking.

Preliminary Results

First of all i would like to learn how get good EEG / hypnogram data for ObenBCI, at least at ZMax level. And for first night i've used them both. Setup

OpenBCI montage were not standard:

AASM montages are different: "recommended EEG montage (F4-M1, C4-M1, O2-M1) and acceptable EEG montage (Fz-Cz, C4-M1, Oz-Cz)."

Just to remind 10-20 System:

Source

Source

Usually lower half of my head are being cut to zero, so line Lobe - T3 - O1 - Pz - O2 - T4 is free from hairs and seems to be easiest to do a montage. Also using a simple elastic headband allows to avoid using of any tape thus lowering chances of skin irritation and provides enough cover to make electrodes stay in place full night.

Actually to get acceptable hypnogram 1-channel EEG without EOG/EMG (chin) seems to be enough, so i plan to use less electrodes in a future.

ZMax setup takes about 30-60 secs to be worn and start recording. Setting up OpenBCI takes longer but not too much, about 2-3 mins to take cup electrodes, get paste, put it on place and cover with headband. It also takes about a 1-2 minutes to turn on board, start OpenBCI GUI at my mac, start session, load hardware settings, start streaming, take off dongle. I think after i get more experience it will not take longer than 4-5 minutes and look at it as a sleep ritual :)

Lets look what have i got for that night. Small remark: OpenBCI turned off 20 minutes before i woke up because I forgot to charge battery, this is why OpenBCI data just a bit shorter than ZMax.

Here is ZMax spectrograms / hypnogram (YASA):

F7-Fpz and F8-Fpz seems to have good agreement. First short REM segment werent detected. There a lot of micro-awakenings (which were also noticed by QuantifiedScientist). Alpha waves (10Hz) during sleep onset not seen (but sometimes can be detected by using XRay filter in ZMax HDScorer). Some noise harmonics can be seen at 24 and 16Hz.

Here are OpenBCI spectrograms / hypnograms. OpenBCI session were started few minutes before ZMax session, this is why there are longer awake at start. I didnt aligned results, because this is preliminary rough comparison:

O1 - T3 channel Delta (< 4Hz) range looks pretty similar to ZMax, but upper ranges seems to have better representation of brain activity (might be due different electrode position). There a powerful Alpha detected at start of sleep onset! First REM segment also missed, like in ZMax data. There are less micro-awakenings, like x2 less. So it seems that OpenBCI placed at O1-T3 seems to give just a bit better representation of brain activity compared to ZMax F7/F8, but O1-T3 still missed 1st REM.

Lets look at other channel:

O2 - T3 seems to have more signal power in alpha band and detected more micro awakenings. The good thing is that it didnt miss first REM segment! Thus it seems to correctly detect all sleep cycles and seems to have better signal in Alpha range.

Last channel to look at:

 

T4-T3 channel seems to detect even more REM in a first segment. For sure it have less power in Alpha range compared to O1 / O2 but this is expected. Anyway it seems to outperform ZMax located at F7/F8.

Second night i've decided to sleep with OpenBCI only but reproduce ZMax montage with additional channel:

Lets look at F7 / F8 from OpenBCI:

Looking at OpenBCI data i can conclude that F8 / F7 looks pretty similar to ZMax, maybe just a bit better. Differences in spectrograms during first night was mostly due to electrode positions, not the device itself, at least at spectrogram level (need to look at slow waves, spindles etc and compare them also).

Lets look at additional Oz - Fpz channel:

Again, we can clearly see that Occipital area provides better representation of alpha activity in comparison with F7 / F8. But this night Oz - Fpz was able to detect only small part of first REM segment, thus maybe not optimal. During first night T4 - T3 and O2 - T3 detected first REM, O1 - T3 and ZMax's F7 / F8 was not able to detect it at all, so it seems O1 / Oz is not optimal zone for REM detection and O2 / T4 might be better. For sure, i may be wrong due to small dataset, i'm planning to sleep a few nights more to find optimal minimalistic setup to catch most important EEG features.

Lets look at raw EEG data during N3:

Dont look at scale, these are not uV but raw ADC values. Notch 50Hz filter and then 0.3Hz - 25Hz bandpass filter was applied for most in EDFBrowser to present EEG data (i think i forgot to do that in 1 or 2 pictures).

Slow waves can be clearly seen on O2 / O1, but T3 - T4 doesnt look great for them. Lets look at night 2 with different locations:

Slow waves can be clearly seen from all F locations.

During N2 sleep spindles occurs:

During first night T4-T3 seems to reveal spindles better. 

During second night Oz-Fpz seems to better catch spindles compared to F7 / F8.

Lets look at sleep onset:

Eye movements pass to F7 / F8 and can be clearly seen and may help in scoring REM. Oz-Fpz reveals alpha rhythm (mostly due O area) which is not clearly seen from F7 / F8.

3rd night i slept with OpenBCI with this montage:

Lets look at spectrograms:

F7 and F8 referenced to T3 seems to capture a bit more alpha activity versus montage where Fpz is a ref for both OpenBCI and ZMax. Thats expected, because F7 / F8 - T3 line intersect mostly frontal and middle part of brain, but most prominent alpha originates from occipital area.

O2 - T3 capture alpha pretty well, in agreement with first night.

T4 - T3 doesnt seem to add more information to F8 - T3 and O2 - T3 at least at spectrogram level.

Lets explore raw EEG:

F7 and F8 catch some  spindles, but T4 and O2 seems to catch them better (bigger amplitude etc). T4 seems to reveal them better, might be because usually C area (upper) is a best place to catch spindles and T3 - T4 line intersect C area.  

F7 catch spindles not well might be because F7 and T3 are on same side of brain (left) and not too far from themselves being able to capture less brain activity in contrast to F8 which catch spindles pretty well, might be because F8 and T3 on different sides and their line intersect C area. So F8 - T3 and T4 - T3 seems to catch spindles better than F7 - T3 or O2 - T3. It seems that minimal setup may include O2 - T3 for alpha and F8 - T3 spindles. Also F8 should offer better slow waves in comparison to T4 and O2.

This seems to be reasonable - slow wave activity originates mostly from frontal area (F) and F7 / F8 seems to do job pretty well. T4 - T3 seems to perform a bit worse but still fine and O2 seems to catch less slow waves.

F7 slow waves amplitude seems to be lower than F8 due to same reason as before (F8 - T3 intersect a lot bigger part of the brain because located on different sides). So F8 seems to be best one to catch slow waves so F8 - T3 seems to be a good candidate, because it also catch spindles well.

But having F7 and F8 simultaneously offers additional value - eye movement detection, due to eye muscle activitity passing into EEG signals at F7 and F8. Lets confirm that:

Here REMs can be clearly seen as negatively correlated simultaneous waves at F7 and F8. T4 - T3 and O2 - T3.

Here is another example (from different night where i did 5 channels):

REMs can be clearly seen as negatively correlatied waves from F7 and F8 . Also it is clear that eye movements reach other channels as well and maybe result in misenterpretation. So, F7 channel is still valuable and adds useful information.

I dont see a lot of added value from T4 - T3 when i already have F7+F8+O2, so i would go next nights with F7 - T3, F8 - T3 and O2 -T3.

Forth night spectrograms (i forgot to check batteries, so the last hour was not recorded):

This night doesnt add much to previous nights, F7 channel doesnt seems to add a lot of value, just can be used to detect REMs in a future, but for now if someone want to minimize electrodes it can be skipped and F8 - T3 with O2 - T3 will be enough. O2 will reveal alpha and F8 reveal slow waves. Both intersect C area enough to reveal spindles. Going futher seems to like a decision between F8 - T3 and O2 - T3, both a different enough to lose some information no matter that choice and in that case i would go with T3 - T4. T3 - T4 seems to be a balanced choice: better capture of Alpha compared to F8, and good enough for spindles and slow waves. But current montage is fine for me, so i keep using F7, F8, O2 and T3 as ref.

Fifth night:

This night for some reason i woke up too early and wasnt able to sleep back. This can clearly be seen at O2 channel with strong Alpha. First REM clearly detected

Lets quantify slow waves and spindles and compare different channels:

Looking at channels we can see that F8-T3 have maximum amplitude (116.9uV) and detected more slow waves than other channels (1126). F7 seems have lower amplitude and less waves due to shorter distance to ref, as a result most of waves didnt reach YASA default detection threshold. F7 also have wider confidence interval in comparison to F8, not sure why, but i get similar results for ZMax F7 / F8. Also there is strange pattern at O2-T3 at the end of wave. But anyway we can see that F8 - T3 seems to be preferred channel for slow wave detection (applies only to my specific montage). These results were expected, so nothing new for me.

Spindles usually best detected at C area, but seems i do not target it, then T3 - T4 should be closest one:

As expected T3 - T4 detected more spindles than other channels - 1883. F7 again had smaller amplitude. F and O channels seems to detect 10-15% less spindles.

Since i can build hypnogram for each channel separately, i can combine different information to build final hypnogram:

This seems to be in align with scientific evidence:

Source

Central (C) region seems to be most important and T3 - T4 seems to cover it well enough to get most features from it, so again we can go with minimalist setup for T3-T4 and 1 ground electrode (Fpz seems to be good location) and will get good hypnogram just from 3 electrodes! You may also dont need to cut hairs, because area around ears (T3 - T4) usually dont have hairs, so you just put electrodes and cover with headband.

Conclusions:

More throughts:

Parts list:

Code: