A real-time SSVEP (Steady-State Visual Evoked Potential) brain-computer interface system for controlling computer functions using EEG signals.
This project implements a BCI system that:
- Detects SSVEP responses at 8Hz and 13Hz frequencies
- Uses machine learning (SVM) for classification
- Provides real-time scroll control
- Works with BrainBit EEG devices
- BrainBit EEG Device (BrainBit or BrainBit Black)
- Windows/Linux/macOS computer
- USB connection for the EEG device
- Python 3.8 or higher
- Lab Streaming Layer (LSL)
- BrainBit SDK (neurosdk)
- Clone the repository:
git clone <repository-url>
cd bcih-project- Install Python dependencies:
pip install -r requirements.txt-
Install Lab Streaming Layer:
- Download LSL from: https://github.com/sccn/labstreaminglayer
- Follow platform-specific installation instructions
-
Install BrainBit SDK:
- Download from BrainBit official website
- Follow manufacturer's installation guide
python BrainBitLSL.pyThis creates an LSL stream from your BrainBit device.
python analysis.py- Click "Toggle Stimuli Window" to open the flicker window
- Click "Calibrate 8Hz" and look at the top flickering box for 30 seconds
- Click "Calibrate 13Hz" and look at the bottom flickering box for 30 seconds
- Click "Train Model" to train the classifier
- Click "Start Detection"
- Look at the top box (8Hz) to scroll up
- Look at the bottom box (13Hz) to scroll down
analysis.py- Main application (most complete implementation)BrainBitLSL.py- Bridge between BrainBit device and LSLfinal.py- Alternative simplified implementationSVM.py- CCA-based implementationscroller.py- Lightweight scroller implementationflash.py- Simple pygame-based stimuluspower.py- Basic power spectrum analyzer
- Real-time EEG processing with multiple filtering stages
- Signal quality monitoring for each electrode
- Dual-frequency SSVEP detection (8Hz and 13Hz)
- Machine learning classification using SVM
- Adaptive thresholding based on signal quality
- Smooth scrolling control with cooldown periods
- Comprehensive visualization of signals and detection
-
"No EEG stream found"
- Ensure BrainBitLSL.py is running
- Check BrainBit device connection
- Verify LSL installation
-
Poor signal quality
- Clean electrode contacts
- Apply conductive gel if needed
- Check electrode placement (O1, O2, T3, T4)
-
Inconsistent detection
- Collect more calibration data
- Ensure stable gaze on stimuli
- Check for environmental interference
- Good: >70% signal quality (green indicators)
- Acceptable: 50-70% (yellow indicators)
- Poor: <50% (red indicators) - recalibrate
Key parameters can be modified in the code:
FLICKER_FREQ_1 = 8.0- First stimulus frequencyFLICKER_FREQ_2 = 13.0- Second stimulus frequencyWINDOW_LENGTH = 2- Analysis window length (seconds)scroll_cooldown = 1.0- Time between scroll actions
- analysis.py: Most comprehensive implementation with full GUI
- BrainBitLSL.py: Hardware interface for BrainBit devices
- final.py: Simplified version with basic features
- SVM.py: CCA-based approach with enhanced signal processing
- scroller.py: Minimal implementation focused on scrolling
- flash.py: Simple pygame stimulus for testing
- power.py: Basic frequency analysis tool
- BrainBit for EEG hardware support
- Lab Streaming Layer community
- SSVEP research community