Skip to main content

Stream and visualize EEG data from the Muse headset.

Project description

UVic MUSE

An application for streaming from MUSE headsets to MATLAB and other platforms.

Requirements

The code relies on pygatt for BLE communication and pylsl for Muse streaming. For the best result use BLED112. We highly recommend installing on a virtual environment (VE). You can build and manage those VEs using Anaconda, the instructions to install and setup a conda environment is described here.

Compatible with Python 3.x

Compatible with MUSE MU-02 and MU-03

Note: if you run into any issues, first check out out Common Issues and then the Issues section of this repository

Getting Started

To stream from MUSE to MATLAB ro other platforms, a Streamer application is required. Transmitted data from Streamer side then can be received and used by the Receiver application. Take a look at this chart below:

Top

This project has two sections, first, UVic MUSE that connects to MUSE over Bluetooth and streams its data over UDP and LSL. Second, a MATLAB toolbox (and MuseUdp.m) that allows the user to receive UVic MUSE transmitted data over UDP protocol. In the following sections we go through installation and usage of UVic MUSE and then explain about part two, MuseUdp.

UVic MUSE Installation

On Windows we suggest the user to install Anaconda and run all of the following commands (including optional commands) in an Anaconda Prompt. You may need to install Microsoft Visual C++ Build Tools (~1GB) from microsoft website if you don't use Anaconda.

On MacOS and linux, install Anaconda (or miniconda), open a terminal, and follow these commands:

If you don't want to use a virtual environment, use Terminal (Linux and OSx) or Command Prompt (Windows) and skip the optional steps.

(optinal) Create a new conda environment.

conda create --name muse_env python=3.7

(optinal) Activate conda environment

conda activate muse_env

Install UVicMUSE using pip

pip install --upgrade uvicmuse

Running UVicMUSE:

To run and use UVic MUSE open a Terminal (Linux & OSx) or Command Prompt (Windows) and type in the commands below:

(optional) Activate the virtual environment

conda activate muse_env

Run UVicMUSE:

uvicmuse

If you manage to install UVicMUSE without conda in Windows, you can run it by opening the start menu and typing uvicmuse

GUI:

Top

Streaming Procedure:

Follow steps shown below to stream the MUSE sensory data. Remember to correctly specify the Required Entries variables before moving on to the next step.

  1. Search to get a list of available MUSEs
  2. Connect to one of the MUSEs. Required Entries = Checkboxes (UDP, LSL, EEG, PPG, ACC, GYRO)
  3. Start Streaming over UDP and LSL (if enabled). Required Entries = Filters (Highpass, Lowpass, Notch)

Notes:

  • Stopping the stream won't disconnect the MUSE (use this feature for changing filters configurations)
  • Search is required after disconnecting from a MUSE

Receiver Toolbox (MuseUdp)

In this section we explain the methods available in the MATLAB toolbox. The main responsibility of a receiver is to connect to UDP socket (same socket as UVic MUSE) and receive data that is being transmitted from MUSE device.

MATLAB Toolbox

Donwload MuseUdp Toolbox from MATLAB file exchange. Open and install the toolbox on MATLAB. Moreover, you need to install Instrument Control Toolbox to establish UDP connections.

To see all of the available methods (functions), create an object from MuseUdp and call methods for it:

mu = MuseUdp();
methods(mu);

To get a single sample from UVic MUSE use:

mu = MuseUdp();
[data, timestamp, success] = mu.get_xxx_sample()

Repace xxxwith eeg, ppg, acc or gyro. The sampled data may have different size according to xxx, eeg has 5 channels per sample, the rest of the sensors return 3 channels data.

To read sampled data in chunks, you need to specify the chunk size and call mu.get_xxx_chunk(###), replace xxx with sensor type and ### with the chunk size. The output size, size(data), will be [chunk_size, 5] for eeg and [chunk_size, 3] for others.

*Note: since the buffer size is limited for UDP protocols, each sample of eeg contains four bytes for timestamp and 4 * 5 = 20 bytes for data (24B total). Since default buffer size in UDP is 1kB, one cannot get a chunk larger that 40 samples. We suggest using multiple instances of get_xxx_chunk(), but you can change the buffer size by calling the function below:

mu.set_udp_buffer_size(2048) % 2kB buffer

Issues

On MacOSx: Application crashes after running:

pip uninstall serial pyserial
conda uninstall serial pyserial
pip install pyserial esptool

Citing UVicMUSE

@misc{UVicMUSE,
  author       = {Bardia Barabadi, Jamieson Fregeau},
  title        = {uvic-muse},
  month        = March,
  year         = 2020,
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

uvicmuse_debug-1.0.1-py2.py3-none-any.whl (64.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file uvicmuse_debug-1.0.1-py2.py3-none-any.whl.

File metadata

  • Download URL: uvicmuse_debug-1.0.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 64.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.10

File hashes

Hashes for uvicmuse_debug-1.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 9ce6f75d702e4bf00703426b0c9f26288eaf98c04da9684e3a0341d3ad3dd966
MD5 d39d3bed7cb7c8e3a7987c8ce0f73d1e
BLAKE2b-256 ca0b78d01112e6e430ea286a0fd8e7f36092d1f63ba7e6256378add2c1ed4602

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page