Olimex OpenEEG

From Polyphasic Sleep Wiki
Revision as of 19:30, 21 June 2025 by Admin (talk | contribs)

The Olimex EEG-SMT[1] is a compact, USB-powered EEG device designed for monitoring brain activity. When used with compatible software, it can record data during sleep and help visualize sleep architecture, which is an especially useful feature for those adapting to a polyphasic sleep schedule.

Signal quality depends on several factors, including electrode placement, electrical interference, and the user's environment. While results may vary, many users have successfully used this device to monitor sleep stages.

Generally, sleep stages follow a distinct pattern, as illustrated in the figure on the right. For more details, see section Sleep stage identification.

Sleep stages in Olimex

Components

Hardware

The Olimex EEG device[2]

The main component that has to be acquired is the EEG-SMT device[1], which can be ordered directly from the Olimex website. Next, you will need electrodes. There are two options:

  • 5 passive electrodes (EEG-PE)[3]
  • 4 active electrodes[4] + 1 passive electrode

The second option is slightly more expensive but is the recommended choice. Active electrodes provide better performance under imperfect conditions and require no skin preparation.[5]

Finally, you will need to purchase a USB A to B cable. [6] It is recommended to get a long cable, such as 1.8 meters, since you will be sleeping with the EEG connected to a laptop (in the default setup). The cable should be long enough to allow comfortable movement.

Lastly, you will need a way to secure the electrodes to your head while sleeping, which can be done using an elastic headband or other methods. The hardware setup section provides more details.

The standard way to set up an Olimex EEG for sleep recording is to connect it to a laptop during sleep. This method is the most widely tested by the community, so if you're unsure where to start, it's the recommended option. However, bringing a laptop to bed each night may be inconvenient. In that case, it's also possible to use a Raspberry Pi[7] or a PinePhone, though these setups require DIY work and are not covered in this guide. If you manage to get one of these alternative setups working, please consider joining the Discord server and sharing your configuration. Your contribution would be much appreciated.

Software

The software setup can be done on both Windows and Linux, and potentially on macOS (though this has not been tested).

The first component you'll need is a program to record sleep sessions. The recommended options are OpenViBE[8] or SleePi[7] for Raspberry Pi. Once your recordings are complete and saved, you’ll need to load them into another program to mark the sleep stages. SleepEEGTools is the recommended choice for this task.

Additionally, you can use DatPlot to view the raw EEG data, for example, to visualize REM movements or detect K-complexes.

Hardware setup

Active vs passive electrodes

First, identify one PE (passive electrode) and four AE (active electrodes). As shown in the image, active electrodes contain a black component (a chip), while passive electrodes do not.

Plug the electrodes into the main device: connect the PE to the DRL socket, and plug the remaining electrodes into the other four input sockets. Note: It’s recommended to avoid unplugging the electrodes from the device, as this can risk damaging the electrode jacks. Try to keep them plugged in at all times.

Electrode positioning

There are several ways to position the electrodes on the head. The main configurations are discussed below.

DRL in the middle, CH1 and CH2 on the sides

Electrode placement at FP1, FP2, and FPZ

The simplest configuration places the DRL electrode in the middle (FPZ), with CH1+ and CH2+ above the right eyebrow (FP1), and CH1– and CH2– above the left eyebrow (FP2). This setup is reliable and allows both channels to record the same data, providing redundancy and improving data reliability.

DRL on the ear

As a variation of the setup above, the DRL electrode can also be placed on the ear instead of the center of the forehead.

CH2 around the eyes

It's also possible to sacrifice redundancy in favor of collecting more data. The first channel is used as before, but CH2 can be repurposed, for example, by placing it near or around the eyes to capture more detailed REM data.

Electrode placement solutions

Electrode placement picture

The electrodes need to remain attached to the head during sleep to record data. There are several ways to keep them in place, some of which are described below.

Elastic headband

The easiest way to attach the electrodes is by wearing an elastic headband across the forehead, with the electrodes placed inside. It should be snug enough to keep them from slipping out. For added convenience, the electrodes can also be sewn into the headband to avoid repositioning them manually each time.

Ski goggles or sleep mask

This method involves more DIY effort, but it allows electrode placement around the eyes to collect more detailed REM data. However, keeping the sleep mask or ski goggles securely in place during sleep can be challenging, especially for side sleepers, as the electrodes may shift. This should be taken into account.

Skin preparation

With the 4 AE + 1 PE setup, little to no skin preparation is typically required, and the electrodes can usually be placed directly on the skin. However, some users may still find it helpful to clean the electrode sites beforehand. In contrast, for the 5 PE setup, proper skin preparation is essential.

To prepare the skin, first remove any excess hair from the electrode sites to ensure optimal contact. Clean the area with mild soap and water or a non-alcoholic wipe, as alcohol-based wipes can dry out the skin and reduce electrical conductivity.[9]

Software setup

The process of setting up the software will vary significantly depending on your operating system (assuming installation on a laptop). However, the general steps are similar and will be outlined in this guide.

Windows

Linux

OpenViBE installation

Start by downloading the stable source code (version 3.6.0 was used in this guide).[10] Then, follow the build instructions.

After running conda env update -f conda/env_linux.yaml, be sure to run conda activate openvibe. This step is required to build the program within the OpenViBE environment, even though it's not explicitly mentioned in the official instructions.

Configuring Acquisition Server

Run sude dmesg -w and plug in your device. This will help you identify the correct port (e.g. ttyUSB0).

Navigate to the build/ directory of OpenViBE, then run ./bin/openvibe-acquisition-server. Click Driver Properties, set Number of channels to 2, and set Device to the port you identified earlier (e.g. ttyUSB0).

You may also want to add your user to the uucp group and reboot to ensure proper permissions (sudo usermod -a -G uucp <username>).

To reduce signal noise, open the Acquisition Server's Preferences menu. Set Drift Correction to Disable and click Apply. Then, go back to Driver Properties and adjust the sampling frequency to minimize drift.

To do this:

  • Plug in your device.
  • Click Connect and Play in the Acquisition Server.
  • Observe the drift value over time.
  • Try different sampling frequencies (e.g., 256, 257, etc.) to find the setting that causes the drift to change as slowly as possible.

Configuring Designer

Design workspace connection

Disconnect and close the Acquisition Server window. Then run ./bin/openvibe-designer. Go to File -> New. In the search bar, type "acquisition" and drag Acquisition Client to the design workspace (to the left side of the interface). Repeat this process for Signal Display and CSV File Writer (Deprecated). Note: the deprecated CSV File Writer is required for compatibility with other software.

Next, connect all the elements in the design workspace as shown in the image.

Configure the CSV File Writer by double clicking it. Use the folder button to choose where you want to save your sleep recordings. Set the filename to record-[$core{date}-$core{time}].csv. This will automatically include the date and time in the file name. Click Apply. Press Save, and select the name (like design_scenario). This will save the design, and it will automatically load the next time you open the Designer. Finally, close all OpenViBE windows.

Running OpenViBE

To record your sleep, enter the build/ directory of OpenViBE and run ./bin/openvibe-acquisition-server. In the Acquisition server window, click Connect, then Play. Next, use another terminal tab to run ./bin/openvibe-designer. In the Designer window, click the Play button to start recording. You should see the signal being captured in real time.

Do not unplug the device while recording, as this may cause the program to hang.

When you're finished:

  1. Press Stop in the Designer window.
  2. Then press Stop and Disconnect in the Acquisition Server window.

After that, you can navigate to the folder you selected earlier to save your recordings. You’ll find the raw sleep data files there.

Installing SleepEEGTools

Run git clone https://github.com/polyphasicdev/SleepEEGTools to clone the SleepEEGTools repository. Then, navigate into the project directory by running cd SleepEEGTools. To set up a virtual environment, run python -m venv venv and source venv/bin/activate. Next, try running the program: python open.py. If it fails due to missing dependencies, install them using pip install <package name> (replace <package name> with the actual missing package listed in the error). Once everything is installed, the program should run correctly. When you're finished, deactivate the environment by running deactivate.

Running SleepEEGTools to mark sleep

Navigate to the SleepEEGTools project directory. If you set up a virtual environment in the previous step, activate it by running source venv/bin/activate. Then, run python open.py. This will open a file browser window. Select a recording file to open the sleep marking interface.

Alternatively, you can run python open.py openvibe <file name> to open the recording directly and skip the file selection dialog.

From there, you can manually analyze and mark the sleep stages. Detailed instructions for this process are provided in the Sleep stage identification section.

MacOS

This setup has not been tested on macOS yet, so contributions are welcome.

Sleep stage identification

References

  1. 1.0 1.1 "Low Cost Open Source EEG Device Completely Assembled USB Interface". Olimex. Retrieved 2025-06-21.
  2. "A first look at the Olimex EEG-SMT". Daniel's Visionarium. Retrieved 2025-06-21.
  3. "Low cost open source EEG device passive electrodes with 1m shielded cable to be used for the DRL connection". Olimex. Retrieved 2025-06-21.
  4. "Low cost open source EEG device active electrodes with 1m shielded cable". Olimex. Retrieved 2025-06-21.
  5. "OpenEEG". Olimex. Retrieved 2025-06-21.
  6. "USB A to B cable 1.8m". Olimex. Retrieved 2025-06-21.
  7. 7.0 7.1 "SleePi". Github. Retrieved 2025-06-21.
  8. "Software for Brain Computer Interfaces and Real Time Neurosciences". OpenViBE. Retrieved 2025-06-21.
  9. "Electrodes and Skin Prep". The Student Physiologist. Retrieved 2025-06-21.
  10. "OpenViBE Downloads". OpenViBE. Retrieved 2025-06-21.