Skip to main content

Stream EEG data from MW75 Neuro headphones using BLE and RFCOMM

Project description

MW75 Neuro Streamer

CI Python 3.9+ Code style: black

Stream 12-channel EEG data from MW75 Neuro headphones with WebSocket, CSV, and LSL output support.

Features

  • Real-time streaming: 500Hz, 12-channel EEG with µV precision
  • Multiple outputs: WebSocket JSON, CSV files, Lab Streaming Layer (LSL)
  • Built-in testing: WebSocket servers with browser visualization
  • Robust protocol: Checksum validation and error detection

Installation

# Clone this repository
git clone https://github.com/arctop/mw75-streamer.git
cd mw75_streamer

Installation Demo

Option 1: Using uv (recommended)

  1. Install uv if you need (see installtion guide)
brew install uv
  1. install python, the dependencies and this package
uv venv && uv pip install -e ".[all]"

Option 2: Using pip

python -m venv .venv
source .venv/bin/activate
pip install -e ".[all]"

Usage

# Basic streaming
uv run -m mw75_streamer --browser
uv run -m mw75_streamer --csv eeg.csv
uv run -m mw75_streamer --ws ws://localhost:8080
uv run -m mw75_streamer --lsl MW75_EEG

# Combined outputs
uv run -m mw75_streamer --csv eeg.csv --ws ws://localhost:8080

Browser Visualization

Testing

# 1. Start test server
uv run -m mw75_streamer.testing --advanced
# Optional: Press 'b' + Enter in server terminal to open browser visualization

# 2. Start EEG streaming
uv run -m mw75_streamer --ws ws://localhost:8080

How It Works

  1. BLE Activation: Discovers MW75 via Bluetooth LE and sends activation commands
  2. RFCOMM Streaming: Connects to channel 25 and receives 63-byte packets
  3. Data Processing: Converts raw ADC to µV, validates checksums, outputs to CSV/WebSocket/LSL

Data Formats

CSV: Timestamp,EventId,Counter,Ref,DRL,Ch1RawEEG,...,Ch12RawEEG,FeatureStatus

WebSocket JSON: Real-time streaming with timestamp, counter, ref/drl, and 12 channel values in µV

Requirements

  • Hardware: MW75 Neuro headphones (paired via Bluetooth)
  • OS: macOS (fully supported), Linux (planned - contributions welcome)
  • Python: 3.9+

macOS Setup for LSL

# Install LSL library (for LSL support)
brew install labstreaminglayer/tap/lsl
export DYLD_LIBRARY_PATH="/opt/homebrew/lib:$DYLD_LIBRARY_PATH"

# Pair MW75 headphones in System Preferences > Bluetooth

Performance Optimization

For improved real-time performance and reduced packet drops, run with elevated priority:

# Run with high priority (requires sudo for optimal performance)
sudo uv run -m mw75_streamer --csv eeg.csv

# The streamer automatically sets:
# - Process priority (niceness -10)
# - Thread real-time scheduling policy
# - Optimized RFCOMM event loop timing (1ms intervals)

Note: Running without sudo will still work but may have higher packet drop rates under system load.

Troubleshooting

  • MW75 not found: Ensure headphones are powered on and paired
  • Connection failed: Re-pair device in Bluetooth settings
  • Dropped packets: Reduce Bluetooth interference, move away from WiFi routers and other 2.4GHz devices

Alternative: Using Python Directly

If you prefer to use regular Python instead of uv, activate your virtual environment first:

# After installation with pip
source .venv/bin/activate
python -m mw75_streamer --csv eeg.csv --ws ws://localhost:8080

Development

See CONTRIBUTING.md for development setup and contribution guidelines.

License

MIT License - see LICENSE for details.

About

MW75 EEG Streamer was developed by Arctop, a neurotechnology company focused on making brain-computer interfaces accessible and practical.

Acknowledgments

AI Assistance

Open Source Dependencies

This project builds upon excellent open source libraries:

  • bleak - Cross-platform Bluetooth Low Energy library for Python
  • PyObjC - Python bridge to Objective-C for macOS integration
  • websocket-client - WebSocket client library for real-time streaming
  • websockets - WebSocket server implementation for testing tools
  • pylsl - Python bindings for Lab Streaming Layer
  • black - Python code formatter for consistent style
  • mypy - Static type checker for Python
  • flake8 - Python linting tool for code quality

Hardware & Community

  • Master & Dynamic for creating the MW75 Neuro headphones and making EEG accessible
  • The Python community for excellent Bluetooth libraries and frameworks

For detailed technical information about the MW75 protocol, see the inline documentation in the source code.

Project details


Download files

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

Source Distribution

mw75_streamer-1.0.0.tar.gz (13.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mw75_streamer-1.0.0-py3-none-any.whl (123.5 kB view details)

Uploaded Python 3

File details

Details for the file mw75_streamer-1.0.0.tar.gz.

File metadata

  • Download URL: mw75_streamer-1.0.0.tar.gz
  • Upload date:
  • Size: 13.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for mw75_streamer-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d47d976b79d68f069d7f5a5c2fd9cc1e51cb370e5f04126a21849a85b0af9d23
MD5 96c000159ccea30d773182ac5fe812ec
BLAKE2b-256 d604b3f29ef569139ee2f398045bc16e2a4c811d91d2ea41fa4ba3c40d865106

See more details on using hashes here.

File details

Details for the file mw75_streamer-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: mw75_streamer-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 123.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for mw75_streamer-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cfdbfe076a7d7c5c1a6e58bb740bb0a848cfbfd1c6b06d0aae8d40fe9d9e910e
MD5 09bddeeb2f4460dcaddb1b545f4c85dc
BLAKE2b-256 723a1667604864d9c06e0644ccb6ae9732817c93a15e1f30c70595d314c14f49

See more details on using hashes here.

Supported by

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