Last time, I talked about the EEG REM detection portion, which was the first REM verification step of the program. However, to further increase the accuracy of the detection algorithm, another REM detection algorithm is used. This algorithm will use EOG (Electrooculography) to detect Rapid Eye Movements (REM) during REM sleep.
Derivation of the EOG Eye Movement Detection Algorithm
If you are not interested in the mathematics of the algorithm, skip to the next section!
Eye movements produce a specific pattern in EOG signals, due to the potential difference between the front and the back of a human eye. This pattern is described in the figure below: (Adapted from Kerkhof, G. A., & Van Dongen, H.)
As you can see from the above figure, eye movements produce deflections which are always out of phase between the two EOG channels.
The EOG REM detection algorithm relies on this fact to detect eye movements. Since the signals are out of phase, when we add the two signals, they cancel each other out. In contrast, if we subtract the two channels, the patterns add up. By combining these two features and taking their square, we can create the following formula:
where N is the length of the current signal (which is 250 SPS * 2s = 500 for 2 seconds of data), EOG1 is the E1-A2 channel and EOG2 is the E2-A2 channel. The EM value will be high for out-of-phase signals (thus eye movements), and low for signals which are in-phase (such as noise, muscle artifacts, etc.).
If we simplify the formula, we obtain the following: (Note, I replaced EOG with E for simplicity)
We can see that the formula simplifies to a negative dot product if we ignore the constant 4. This is quite intuitive: Taking a dot product of two signals yield a value that indicates how "similar" the two signals are ("signal correlation"). But if we inverse the value, then the value reflects how "different" the two signals are. This is desired as the eye movements are always out of phase.
This feature is called the Inverse Dot Product (IDP).
Implementation of the Algorithm
The implementation closely follows to that of the EEG REM detection algorithm, described in the previous Project Log. Here is the corresponding flowchart:
Like before with the EEG data, the EOG data is converted to micro-volt format and filtered with a band-pass filter (0.1hz - 35hz). The Inverse dot product for 2 seconds of the data (which is 500 samples for 250 samples per second A/D speed) is then computed and compared to a minimum threshold (IDP min). If the current sleep stage is determined to be REM, and the IDP is larger than the minimum constant, the sleep stage is determined to be REM and a lucid dreaming trigger is cued.
In the next Project Log, I will talk about the code for the above implementation.
Sources:
Kerkhof, G. A., & Van Dongen, H. (2010). Human Sleep and Cognition: Basic Research (Vol. 185). Elsevier.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.