The REM detection device used in this implementation is the Zeo1, a wireless headband with three prefrontal electrodes, which are combined into a one-channel 128 Hz EEG signal. The raw signal is accessible with a time lag of less than 2 seconds, allowing nearly real-time REM detection. Moreover, the Zeo itself classifies the EEG signal into three different sleep stages or the awake stage, and can thus be used as a direct REM detector, too. It is connected via serial cable to the computer and sends once every second the raw EEG data and other metadata such as timestamp and the Zeo’s sleep stage classification to the computer.
There is an official open source Zeo library for processing the Zeo data which is used and was heavily modified by the author for the Sleeator 2. The Zeo library is modified so that the incoming raw signal, its Fourier transform, a notch-filtered version of the raw signal, Zeo’s detected sleep stage and metadata are saved directly into an SQLite2 database once every second. The recording can be started and stopped from the Sleeator 2 GUI and runs in a separate thread for better performance. The focus when developing the Zeo-Sleeator 2 connection was laid on data security, so that even if the program crashes, windows shuts down due to power saving options or other unforeseen problems, the data up to this point are stored on hard disk safely.
1 Produced and sold by Zeo Inc. (went out of market in May 2013).