Skip to main content

BCIGo 32-channel EEG smart brain-computer interface SDK

Project description

BrainCo 32ch-EEG SDK

[!IMPORTANT] 更名说明 (Renaming Notice)v1.0.0 起,本 SDK 的代码库及 Python 包名已由 bcigo_sdk 统一重命名为 bcigo_sdk(以配合 BCIGo 智能脑机接口系统 的品牌升级)。 底层 C 扩展模块对应重命名为 _bcigo_sdk。如果您从旧版本升级,请将代码中的所有 import bcigo_sdkuse bcigo_sdk 替换为 import bcigo_sdkuse bcigo_sdk

Python SDK for BrainCo 32-channel EEG Cap, providing easy-to-use APIs for real-time EEG data acquisition, processing, and visualization.

Features

  • 🧠 32-Channel EEG Data Acquisition - Real-time streaming from BrainCo EEG Cap
  • 📊 Signal Processing - Built-in filters (notch, bandpass, bandstop)
  • 📈 Data Visualization - Ready-to-use GUI tools for real-time and offline analysis
  • 💾 EDF Recording - Save data in standard EDF+ format
  • 🔌 Easy Integration - Simple async API with device auto-discovery
  • 🎯 SSVEP Support - Pre-configured channel selections for SSVEP experiments

Installation

pip install bcigo_sdk

Optional Dependencies

For GUI visualization tools:

pip install pyqtgraph PySide6 numpy scipy qasync pyedflib

Quick Start

Basic Usage

import asyncio
import bcigo_sdk as sdk

async def main():
    # Auto-discover and connect to device
    devices = await sdk.scan_devices()
    addr, port = devices[0]
    
    # Create client
    client = sdk.BCIGoClient(addr, port)
    parser = sdk.MessageParser("bcigo", sdk.MsgType.BCIGo)
    
    try:
        # Recommended: One-key unified stream startup
        await client.start_stream(
            parser,
            fs=sdk.EegSampleRate.SR_250Hz,
            gain=sdk.EegSignalGain.GAIN_6,
            signal=sdk.EegSignalSource.NORMAL
        )
        
        # Your processing code here...
        await asyncio.sleep(10)
        
    finally:
        # Safe TCP disconnect and background task release
        await client.disconnect_tcp()

asyncio.run(main())

EDF Recording

import bcigo_sdk as sdk

# Start recording
file_path = sdk.start_edf_recording(
    output_dir="./recordings",
    participant_code="P001",
    participant_sex="M",
    participant_birthdate="01-JAN-1990",
    participant_name="TestSubject"
)

# ... collect data ...

# Stop recording
sdk.stop_edf_recording()

Signal Filtering

# Create filters
notch_50hz = sdk.BandStopFilter(sample_rate=250, low_freq=49, high_freq=51)
notch_60hz = sdk.BandStopFilter(sample_rate=250, low_freq=59, high_freq=61)
bandpass = sdk.BandPassFilter(sample_rate=250, low_freq=2, high_freq=45)

# Apply filters
filtered_value = notch_50hz.apply(raw_value)
filtered_value = notch_60hz.apply(filtered_value)
filtered_value = bandpass.apply(filtered_value)

GUI Tools

The SDK includes two powerful visualization tools:

1. Real-time EEG Viewer

Real-time visualization of 32-channel EEG data with filtering and FFT analysis.

python -m bcigo_sdk.examples.eeg_32ch_realtime_gui

Features:

  • Real-time 32-channel waveform display
  • Time domain and frequency domain views
  • Channel selection (All/SSVEP Wet/SSVEP Dry)
  • Live filtering (50/60Hz notch + 2-45Hz bandpass)
  • Statistics display (mean, std, peak-to-peak)

2. EDF File Viewer

Load and visualize EDF recordings with playback controls.

python -m bcigo_sdk.examples.eeg_32ch_edf_gui

Features:

  • Load and replay EDF files
  • Playback controls (play/pause/speed adjustment)
  • Time and frequency domain analysis
  • Channel selection and filtering
  • Progress bar and statistics

Channel Layout

The SDK uses the standard 10-20 system with 32 channels:

FP1, FP2, F3, F4, F7, F8, Fz,
C3, C4, Cz,
P3, P4, P7, P8, Pz,
O1, O2,
T7, T8,
FC1, FC2, FC5, FC6,
CP1, CP2, CP5, CP6,
FT9, FT10,
TP9, TP10,
IO (reference)

SSVEP Channel Presets

Wet Electrodes (7 channels):

  • O1, O2 (occipital)
  • P3, P4 (parietal)
  • P7, P8 (temporal-parietal)
  • Pz (midline)

Dry Electrodes (7 channels):

  • O1 (occipital)
  • P3, P4 (parietal)
  • C3, C4 (central)
  • F3, F4 (frontal)

API Reference

Client

  • BCIGoClient(addr, port) - Create TCP client
  • start_stream(parser, fs, gain, signal) - One-key high-level stream startup (Recommended)
  • update_eeg_config(fs, gain, signal) - On-the-fly config hot-reloading (Recommended)
  • disconnect_tcp() - Safely release TCP connections and background listener tasks
  • start_data_stream(parser) - Start data streaming (Advanced)
  • set_eeg_config(sample_rate, gain, source) - Configure EEG (Advanced)
  • start_eeg_stream() / stop_eeg_stream() - Control streaming (Advanced)
  • get_device_info() - Get device information
  • get_battery_level() - Get battery status

Filters

  • BandPassFilter(sample_rate, low_freq, high_freq) - Bandpass filter
  • BandStopFilter(sample_rate, low_freq, high_freq) - Bandstop/notch filter
  • NotchFilter(center_freq, sample_rate, q_factor) - Notch filter
  • SosFilter.create_band_pass(order, sample_rate, low, high) - SOS bandpass

Recording

  • start_edf_recording(...) - Start EDF recording
  • stop_edf_recording() - Stop recording
  • is_edf_recording() - Check recording status

Enums

  • EegSampleRate: SR_250Hz, SR_500Hz, SR_1000Hz
  • EegSignalGain: GAIN_1, GAIN_2, GAIN_4, GAIN_6, GAIN_8, GAIN_12
  • EegSignalSource: NORMAL, TEST_SIGNAL

Examples

Check the GitHub repository for more examples:

  • Real-time data streaming
  • EDF recording with LSL markers
  • Signal processing and filtering
  • FFT analysis
  • Custom data callbacks

Requirements

  • Python 3.10+
  • Network connection to BrainCo EEG Cap device
  • Optional: GUI dependencies for visualization tools

License

See LICENSE file in the repository.

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 Distributions

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

bcigo_sdk-1.0.0-cp310-abi3-win_amd64.whl (2.5 MB view details)

Uploaded CPython 3.10+Windows x86-64

bcigo_sdk-1.0.0-cp310-abi3-manylinux_2_35_x86_64.whl (4.1 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.35+ x86-64

bcigo_sdk-1.0.0-cp310-abi3-manylinux_2_35_aarch64.whl (3.8 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.35+ ARM64

bcigo_sdk-1.0.0-cp310-abi3-macosx_11_0_arm64.whl (1.8 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

File details

Details for the file bcigo_sdk-1.0.0-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: bcigo_sdk-1.0.0-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 2.5 MB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bcigo_sdk-1.0.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 fdb16f8556238a657df1ce0e544203949f457faeea740bc44a08cc50ba1ea909
MD5 a2d5a2b55698fc7e7cc6ad80b04ef647
BLAKE2b-256 8c8b723bf83b860f488be66faed2826e3cb4c0928ef4dd6721e48227fadb4810

See more details on using hashes here.

Provenance

The following attestation bundles were made for bcigo_sdk-1.0.0-cp310-abi3-win_amd64.whl:

Publisher: build-python.yml on Yongle-Fu/eeg-32ch-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bcigo_sdk-1.0.0-cp310-abi3-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for bcigo_sdk-1.0.0-cp310-abi3-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 d8af46f9055a87b59a0ad9b780c9858442a66e2a7807d9b68554ecf4ed807e30
MD5 79b074ca7d7a0b6bfdf858f91603162f
BLAKE2b-256 891c5e1e05b1eff4ba5dc876b5ef76c35df2347de1271292101fdedfd4779ed3

See more details on using hashes here.

Provenance

The following attestation bundles were made for bcigo_sdk-1.0.0-cp310-abi3-manylinux_2_35_x86_64.whl:

Publisher: build-python.yml on Yongle-Fu/eeg-32ch-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bcigo_sdk-1.0.0-cp310-abi3-manylinux_2_35_aarch64.whl.

File metadata

File hashes

Hashes for bcigo_sdk-1.0.0-cp310-abi3-manylinux_2_35_aarch64.whl
Algorithm Hash digest
SHA256 107e6a3ba7a6fd64697b0d694343188e45b8c8c9c2417378f903be78f9099e53
MD5 d56f3cacd6ba731520b814bb70901502
BLAKE2b-256 30c3b92da61abc1866ebce8213fad0b04d62de55d2340a0461cc6436ff1c3b4b

See more details on using hashes here.

Provenance

The following attestation bundles were made for bcigo_sdk-1.0.0-cp310-abi3-manylinux_2_35_aarch64.whl:

Publisher: build-python.yml on Yongle-Fu/eeg-32ch-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bcigo_sdk-1.0.0-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: bcigo_sdk-1.0.0-cp310-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 1.8 MB
  • Tags: CPython 3.10+, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for bcigo_sdk-1.0.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a5f4f2209bfe9fc528a7ec6a09f4ceb2e7721c20ca360b4eb54f740a0cf945d2
MD5 79280b8c107201192e84e6a85ac8cdb3
BLAKE2b-256 dba5b1852106a15a2e01189b4fe5574086c284b631caf70023592a7b12cb0de2

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