With the hardware build complete, along with its firmware, it is time to begin creating the crucial part of this project: the brainwave analysis software. This program will analyze the EEG brainwaves received from the OpenLD hardware by Bluetooth and trigger specific cues to help the induction of Lucid Dreams. Let me explain the basic background and overview of the OpenLD Software:
Sleep Stages and their Characteristics
You might have heard a thing or two about something called sleep stages. Before the 1950's, sleep was assumed to be a period when the brain became inactive and passive. It was only after scientists discovered through EEG recordings that the brain went through different phases of activity (sleep stages) during the entire duration of sleep. These stages are comprised of Stage 1, 2, 3, and REM. They occur in the order described below, with each cycle being approximately 90 minutes long: (APA, "What is Sleep?")
- Stage 1: This stage takes place right after falling asleep, often known as light sleep.
- Stage 2: At this stage, the brainwaves start to slow down ...
- Stage 3: Here, slow delta waves begin. This stage is called deep sleep.
- Stage REM: This is when dreams occur. The brainwaves at this stage are very similar to waking state.
The diagram above shows a generalized depiction of how sleep cycles through these different stages. Note, these cycles are different for everyone and varies overtime.
Image Source: http://www.centerforsoundsleep.com/sleep-disorders/stages-of-sleep/
In this project, the REM stage is the phase that we are most interested in, as dreaming takes place here. It is important to note that at this stage, the Rapid Eye Movements actually reflect the eye movements of your dream. That means that if you look upwards in a dream, your physical eyes will do the same. Since the rest of the body's muscles are paralyzed during REM, which prevents the body from acting out the dream, these eye movements will be an important part of the OpenLD in-dream communication.
The OpenLD Software Overview
Overall, the OpenLD helps to induce Lucid Dreams by triggering a specified cue (such as a specific soundtrack) when it detects that he/she is dreaming. The difficulty lies in determining whether or not the person is dreaming. In the OpenLD software, this is determined by a 2-step verification process, as described in the flowchart below:
The software will first set up the appropriate hardware and files. After connecting to the OpenLD hardware through Bluetooth, the program will create a BDF file, which is a biosignal file format specified by BIOSEMI inc. This file can be opened by a great program EDFBrowser by Teuniz.
After setup, the program begins the analysis process. When 30 seconds of data has been collected, the software analyzes the data to detect if the subject is dreaming. If the data is confirmed by the two verification steps (described below) the subject is deemed to be dreaming and a Lucid Dream cue is triggered.
- EEG: REM Stage - This step uses a single EEG electrode, located at the site Fp1-A2 in the 10-20 system, to determine if the subject is in an REM state. The software will make this decision using an algorithm published by Imtiaz et al. More details about this procedure will be included in future project logs.
- EOG: REM Eye Movements - This step uses two EOG electrodes to detect if any rapid eye movements have been made. If the algorithm detects the eye movements, the current stage is flagged as being a dreaming state. A cue is then triggered in order to induce Lucid Dreams.
That is the general overview of the OpenLD software. In the future project logs I will be delving into the mathematics and the implementation of the mentioned algorithms. I will publish the alpha-but-working version of the software in Github in the near future.
What is Sleep? (2007, May). Retrieved September 21, 2016, from https://www.sleepassociation.org/patients-general-public/what-is-sleep/
Imtiaz, Syed Anas, and Esther Rodriguez-Villegas. "A low computational cost algorithm for rem sleep detection using single channel EEG." Annals of biomedical engineering 42.11 (2014): 2344-2359.