Episode 1: BCI Core-8

In this episode, you learn how to record EEG data with g.Pype and the BCI Core-8.

Note

This page is still under development. Until we have the step-by-step instructions ready, please refer to the code example below.

File example_devices_bci_core8.pyView file on GitHub

  1"""
  2BCI Core-8 Device Example - Real-time EEG Acquisition and Processing
  3
  4This example demonstrates how to connect to and process real-time EEG data from
  5a g.tec BCI Core-8 amplifier system. It showcases professional EEG signal
  6processing with standard filtering techniques commonly used in clinical and
  7research BCI applications.
  8
  9This example demonstrates how to connect to and process real-time EEG data from
 10a g.tec BCI Core-8 amplifier system. It showcases EEG signal processing with
 11standard filtering techniques commonly used in clinical and research BCI
 12applications.
 13
 14What this example shows:
 15- Real-time data acquisition from BCI Core-8 hardware
 16- Bandpass filtering for EEG frequency band selection
 17- Power line interference removal with dual notch filters
 18- Real-time visualization of clean EEG signals
 19- Hardware integration with g.Pype framework
 20
 21Hardware requirements:
 22- g.tec BCI Core-8 EEG amplifier system
 23
 24Expected behavior:
 25When you run this example:
 26- Connects to BCI Core-8 amplifier automatically
 27- Displays real-time EEG from 8 channels
 28- Shows clean, filtered signals suitable for analysis
 29- Amplitude range: ±50 µV (typical EEG range)
 30- Time window: 10 seconds of continuous data
 31- Real-time updates at amplifier sampling rate
 32
 33Signal processing pipeline:
 341. Raw EEG acquisition (8 channels, 250 Hz)
 352. Bandpass filtering (1-30 Hz) - standard EEG band
 363. 50 Hz notch filter - removes European power line noise
 374. 60 Hz notch filter - removes American power line noise
 385. Real-time visualization
 39
 40Filtering rationale:
 41- Bandpass (1-30 Hz): Preserves main EEG rhythms while removing:
 42  * DC drift and very low frequencies (<1 Hz)
 43  * High-frequency noise and muscle artifacts (>30 Hz)
 44- Notch filters: Remove power line interference at:
 45  * 50 Hz (Europe, Asia, Africa, Australia)
 46  * 60 Hz (North America, parts of South America)
 47
 48Real-world applications:
 49- Clinical EEG monitoring and diagnosis
 50- BCI system development and testing
 51- Neurofeedback training applications
 52- Cognitive state monitoring research
 53- Sleep study and analysis
 54- Seizure detection systems
 55- Attention and meditation training
 56
 57Usage:
 58    1. Mount BCI Core-8 cap/electrodes
 59    2. Power on BCI Core-8
 60    4. Run: python example_devices_core8.py
 61    5. Monitor real-time EEG signals
 62
 63Note:
 64    This example provides the foundation for all BCI applications
 65    requiring real-time EEG data acquisition and processing.
 66"""
 67import gpype as gp
 68
 69# Sampling rate (hardware-dependent, typically 250 Hz for BCI Core-8)
 70fs = 250
 71
 72if __name__ == "__main__":
 73
 74    # Initialize main application for GUI and device management
 75    app = gp.MainApp()
 76
 77    # Create real-time processing pipeline for EEG data
 78    p = gp.Pipeline()
 79
 80    # === HARDWARE DATA SOURCE ===
 81    # BCI Core-8: Professional 8-channel EEG amplifier
 82    # Automatically detects and connects to available hardware
 83    # Provides high-quality, low-noise EEG signals at 250 Hz
 84    source = gp.BCICore8()
 85
 86    # === SIGNAL CONDITIONING STAGE ===
 87    # Bandpass filter: Extract standard EEG frequency range
 88    # 1-30 Hz preserves all major brain rhythms while removing:
 89    # - DC drift and movement artifacts (<1 Hz)
 90    # - EMG muscle artifacts and high-frequency noise (>30 Hz)
 91    bandpass = gp.Bandpass(
 92        f_lo=1, f_hi=30  # High-pass: remove DC and slow drift
 93    )  # Low-pass: remove muscle artifacts
 94
 95    # === POWER LINE INTERFERENCE REMOVAL ===
 96    # Notch filter for 50 Hz power line noise (European standard)
 97    # 48-52 Hz range accounts for slight frequency variations
 98    notch50 = gp.Bandstop(
 99        f_lo=48, f_hi=52  # Lower bound of 50 Hz notch
100    )  # Upper bound of 50 Hz notch
101
102    # Notch filter for 60 Hz power line noise (American standard)
103    # 58-62 Hz range accounts for slight frequency variations
104    # Both filters ensure compatibility with different power systems
105    notch60 = gp.Bandstop(
106        f_lo=58, f_hi=62  # Lower bound of 60 Hz notch
107    )  # Upper bound of 60 Hz notch
108
109    # === REAL-TIME VISUALIZATION ===
110    # Professional EEG scope with clinical amplitude scaling
111    # 50 µV range covers typical EEG signal amplitudes
112    # 10-second window provides good temporal context
113    scope = gp.TimeSeriesScope(
114        amplitude_limit=50, time_window=10  # ±50 µV range
115    )  # 10-second display
116
117    # === PIPELINE CONNECTIONS ===
118    # Create signal processing chain: Hardware → Filtering → Visualization
119    # Order matters: bandpass first, then notch filters, finally display
120
121    # Connect hardware source to initial bandpass filter
122    p.connect(source, bandpass)
123
124    # Connect bandpass output to first notch filter (50 Hz)
125    p.connect(bandpass, notch50)
126
127    # Connect first notch to second notch filter (60 Hz)
128    p.connect(notch50, notch60)
129
130    # Connect final filtered signal to visualization scope
131    p.connect(notch60, scope)
132
133    # === APPLICATION SETUP ===
134    # Add visualization widget to main application window
135    app.add_widget(scope)
136
137    # === EXECUTION ===
138    # Start real-time data acquisition and processing
139    p.start()  # Initialize hardware and begin data flow
140    app.run()  # Start GUI event loop (blocks until window closes)
141    p.stop()  # Clean shutdown: stop hardware and close connections